Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
89eb7952
Unverified
Commit
89eb7952
authored
Dec 15, 2025
by
Parth Sareen
Committed by
GitHub
Dec 15, 2025
Browse files
parsers/renderers: use think from user for nemotron (#13492)
parent
7e3ea813
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
59 deletions
+25
-59
model/parsers/nemotron3nano.go
model/parsers/nemotron3nano.go
+5
-6
model/parsers/nemotron3nano_test.go
model/parsers/nemotron3nano_test.go
+10
-19
model/parsers/parsers.go
model/parsers/parsers.go
+1
-3
model/renderers/nemotron3nano.go
model/renderers/nemotron3nano.go
+3
-5
model/renderers/nemotron3nano_test.go
model/renderers/nemotron3nano_test.go
+5
-21
model/renderers/renderer.go
model/renderers/renderer.go
+1
-5
No files found.
model/parsers/nemotron3nano.go
View file @
89eb7952
...
@@ -24,19 +24,18 @@ const (
...
@@ -24,19 +24,18 @@ const (
)
)
type
Nemotron3NanoParser
struct
{
type
Nemotron3NanoParser
struct
{
state
Nemotron3NanoParserState
state
Nemotron3NanoParserState
buffer
strings
.
Builder
buffer
strings
.
Builder
tools
[]
api
.
Tool
tools
[]
api
.
Tool
HasThinking
bool
}
}
func
(
p
*
Nemotron3NanoParser
)
HasToolSupport
()
bool
{
return
true
}
func
(
p
*
Nemotron3NanoParser
)
HasToolSupport
()
bool
{
return
true
}
func
(
p
*
Nemotron3NanoParser
)
HasThinkingSupport
()
bool
{
return
p
.
HasThinking
}
func
(
p
*
Nemotron3NanoParser
)
HasThinkingSupport
()
bool
{
return
true
}
func
(
p
*
Nemotron3NanoParser
)
Init
(
tools
[]
api
.
Tool
,
lastMessage
*
api
.
Message
,
thinkValue
*
api
.
ThinkValue
)
[]
api
.
Tool
{
func
(
p
*
Nemotron3NanoParser
)
Init
(
tools
[]
api
.
Tool
,
lastMessage
*
api
.
Message
,
thinkValue
*
api
.
ThinkValue
)
[]
api
.
Tool
{
p
.
tools
=
tools
p
.
tools
=
tools
//
Check both model capability AND request preference
//
thinking is enabled if user requests it
thinkingEnabled
:=
thinkValue
!=
nil
&&
thinkValue
.
Bool
()
thinkingEnabled
:=
thinkValue
!=
nil
&&
thinkValue
.
Bool
()
prefill
:=
lastMessage
!=
nil
&&
lastMessage
.
Role
==
"assistant"
prefill
:=
lastMessage
!=
nil
&&
lastMessage
.
Role
==
"assistant"
...
...
model/parsers/nemotron3nano_test.go
View file @
89eb7952
...
@@ -203,7 +203,7 @@ func TestNemotron3NanoParser(t *testing.T) {
...
@@ -203,7 +203,7 @@ func TestNemotron3NanoParser(t *testing.T) {
for
_
,
tt
:=
range
tests
{
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
tt
.
thinkValue
!=
nil
&&
tt
.
thinkValue
.
Bool
()
}
p
:=
&
Nemotron3NanoParser
{}
p
.
Init
(
nil
,
nil
,
tt
.
thinkValue
)
p
.
Init
(
nil
,
nil
,
tt
.
thinkValue
)
content
,
thinking
,
calls
,
err
:=
p
.
Add
(
tt
.
input
,
false
)
content
,
thinking
,
calls
,
err
:=
p
.
Add
(
tt
.
input
,
false
)
...
@@ -441,7 +441,7 @@ func TestNemotron3NanoParser_Streaming(t *testing.T) {
...
@@ -441,7 +441,7 @@ func TestNemotron3NanoParser_Streaming(t *testing.T) {
for
_
,
tt
:=
range
tests
{
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
tt
.
thinkValue
!=
nil
&&
tt
.
thinkValue
.
Bool
()
}
p
:=
&
Nemotron3NanoParser
{}
p
.
Init
(
nil
,
nil
,
tt
.
thinkValue
)
p
.
Init
(
nil
,
nil
,
tt
.
thinkValue
)
var
allContent
string
var
allContent
string
...
@@ -488,24 +488,15 @@ func TestNemotron3NanoParser_HasToolSupport(t *testing.T) {
...
@@ -488,24 +488,15 @@ func TestNemotron3NanoParser_HasToolSupport(t *testing.T) {
}
}
func
TestNemotron3NanoParser_HasThinkingSupport
(
t
*
testing
.
T
)
{
func
TestNemotron3NanoParser_HasThinkingSupport
(
t
*
testing
.
T
)
{
t
.
Run
(
"with thinking enabled"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{}
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
true
}
if
!
p
.
HasThinkingSupport
()
{
if
!
p
.
HasThinkingSupport
()
{
t
.
Error
(
"expected HasThinkingSupport to return true"
)
t
.
Error
(
"expected HasThinkingSupport to return true"
)
}
}
})
t
.
Run
(
"with thinking disabled"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
false
}
if
p
.
HasThinkingSupport
()
{
t
.
Error
(
"expected HasThinkingSupport to return false"
)
}
})
}
}
func
TestNemotron3NanoParser_Init
(
t
*
testing
.
T
)
{
func
TestNemotron3NanoParser_Init
(
t
*
testing
.
T
)
{
t
.
Run
(
"starts in thinking state when enabled"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"starts in thinking state when enabled"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
true
}
p
:=
&
Nemotron3NanoParser
{}
p
.
Init
(
nil
,
nil
,
&
api
.
ThinkValue
{
Value
:
true
})
p
.
Init
(
nil
,
nil
,
&
api
.
ThinkValue
{
Value
:
true
})
if
p
.
state
!=
Nemotron3NanoCollectingThinking
{
if
p
.
state
!=
Nemotron3NanoCollectingThinking
{
t
.
Errorf
(
"expected state Nemotron3NanoCollectingThinking, got %v"
,
p
.
state
)
t
.
Errorf
(
"expected state Nemotron3NanoCollectingThinking, got %v"
,
p
.
state
)
...
@@ -513,7 +504,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
...
@@ -513,7 +504,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
})
})
t
.
Run
(
"starts in content state when thinking disabled"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"starts in content state when thinking disabled"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
true
}
p
:=
&
Nemotron3NanoParser
{}
p
.
Init
(
nil
,
nil
,
&
api
.
ThinkValue
{
Value
:
false
})
p
.
Init
(
nil
,
nil
,
&
api
.
ThinkValue
{
Value
:
false
})
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
t
.
Errorf
(
"expected state Nemotron3NanoCollectingContent, got %v"
,
p
.
state
)
t
.
Errorf
(
"expected state Nemotron3NanoCollectingContent, got %v"
,
p
.
state
)
...
@@ -521,7 +512,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
...
@@ -521,7 +512,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
})
})
t
.
Run
(
"starts in content state when nil thinkValue"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"starts in content state when nil thinkValue"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
true
}
p
:=
&
Nemotron3NanoParser
{}
p
.
Init
(
nil
,
nil
,
nil
)
p
.
Init
(
nil
,
nil
,
nil
)
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
t
.
Errorf
(
"expected state Nemotron3NanoCollectingContent, got %v"
,
p
.
state
)
t
.
Errorf
(
"expected state Nemotron3NanoCollectingContent, got %v"
,
p
.
state
)
...
@@ -529,7 +520,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
...
@@ -529,7 +520,7 @@ func TestNemotron3NanoParser_Init(t *testing.T) {
})
})
t
.
Run
(
"starts in content state with assistant prefill"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"starts in content state with assistant prefill"
,
func
(
t
*
testing
.
T
)
{
p
:=
&
Nemotron3NanoParser
{
HasThinking
:
true
}
p
:=
&
Nemotron3NanoParser
{}
prefill
:=
&
api
.
Message
{
Role
:
"assistant"
,
Content
:
"Starting..."
}
prefill
:=
&
api
.
Message
{
Role
:
"assistant"
,
Content
:
"Starting..."
}
p
.
Init
(
nil
,
prefill
,
&
api
.
ThinkValue
{
Value
:
true
})
p
.
Init
(
nil
,
prefill
,
&
api
.
ThinkValue
{
Value
:
true
})
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
if
p
.
state
!=
Nemotron3NanoCollectingContent
{
...
...
model/parsers/parsers.go
View file @
89eb7952
...
@@ -63,9 +63,7 @@ func ParserForName(name string) Parser {
...
@@ -63,9 +63,7 @@ func ParserForName(name string) Parser {
case
"olmo3-think"
:
case
"olmo3-think"
:
return
&
Olmo3ThinkParser
{}
return
&
Olmo3ThinkParser
{}
case
"nemotron-3-nano"
:
case
"nemotron-3-nano"
:
return
&
Nemotron3NanoParser
{
HasThinking
:
false
}
return
&
Nemotron3NanoParser
{}
case
"nemotron-3-nano-thinking"
:
return
&
Nemotron3NanoParser
{
HasThinking
:
true
}
default
:
default
:
return
nil
return
nil
}
}
...
...
model/renderers/nemotron3nano.go
View file @
89eb7952
...
@@ -8,15 +8,13 @@ import (
...
@@ -8,15 +8,13 @@ import (
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/api"
)
)
type
Nemotron3NanoRenderer
struct
{
type
Nemotron3NanoRenderer
struct
{}
IsThinking
bool
}
func
(
r
*
Nemotron3NanoRenderer
)
Render
(
messages
[]
api
.
Message
,
tools
[]
api
.
Tool
,
thinkValue
*
api
.
ThinkValue
)
(
string
,
error
)
{
func
(
r
*
Nemotron3NanoRenderer
)
Render
(
messages
[]
api
.
Message
,
tools
[]
api
.
Tool
,
thinkValue
*
api
.
ThinkValue
)
(
string
,
error
)
{
var
sb
strings
.
Builder
var
sb
strings
.
Builder
// thinking is enabled
: model must support it AND
user
must
request it
// thinking is enabled
if
user request
s
it
enableThinking
:=
r
.
IsThinking
&&
(
thinkValue
!=
nil
&&
thinkValue
.
Bool
()
)
enableThinking
:=
thinkValue
!=
nil
&&
thinkValue
.
Bool
()
// Extract system message if present
// Extract system message if present
var
systemMessage
string
var
systemMessage
string
...
...
model/renderers/nemotron3nano_test.go
View file @
89eb7952
...
@@ -14,7 +14,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -14,7 +14,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
msgs
[]
api
.
Message
msgs
[]
api
.
Message
tools
[]
api
.
Tool
tools
[]
api
.
Tool
thinkValue
*
api
.
ThinkValue
thinkValue
*
api
.
ThinkValue
isThinking
bool
expected
string
expected
string
}{
}{
{
{
...
@@ -22,7 +21,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -22,7 +21,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
msgs
:
[]
api
.
Message
{
msgs
:
[]
api
.
Message
{
{
Role
:
"user"
,
Content
:
"Hello!"
},
{
Role
:
"user"
,
Content
:
"Hello!"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
...
@@ -33,7 +31,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -33,7 +31,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
msgs
:
[]
api
.
Message
{
msgs
:
[]
api
.
Message
{
{
Role
:
"user"
,
Content
:
"Hello!"
},
{
Role
:
"user"
,
Content
:
"Hello!"
},
},
},
isT
hink
ing
:
false
,
t
hink
Value
:
nil
,
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>assistant
\n
<think></think>"
,
"<|im_start|>assistant
\n
<think></think>"
,
...
@@ -44,7 +42,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -44,7 +42,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
Role
:
"system"
,
Content
:
"You are a helpful assistant."
},
{
Role
:
"system"
,
Content
:
"You are a helpful assistant."
},
{
Role
:
"user"
,
Content
:
"Hello!"
},
{
Role
:
"user"
,
Content
:
"Hello!"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
You are a helpful assistant.<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
You are a helpful assistant.<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
...
@@ -57,7 +54,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -57,7 +54,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
Role
:
"assistant"
,
Content
:
"Hello! How can I help?"
},
{
Role
:
"assistant"
,
Content
:
"Hello! How can I help?"
},
{
Role
:
"user"
,
Content
:
"Tell me a joke"
},
{
Role
:
"user"
,
Content
:
"Tell me a joke"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hi<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hi<|im_end|>
\n
"
+
...
@@ -86,7 +82,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -86,7 +82,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -141,7 +136,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -141,7 +136,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -198,7 +192,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -198,7 +192,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -228,7 +221,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -228,7 +221,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
Role
:
"assistant"
,
Content
:
"Hello!"
,
Thinking
:
"Let me think about this..."
},
{
Role
:
"assistant"
,
Content
:
"Hello!"
,
Thinking
:
"Let me think about this..."
},
{
Role
:
"user"
,
Content
:
"How are you?"
},
{
Role
:
"user"
,
Content
:
"How are you?"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hi<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hi<|im_end|>
\n
"
+
...
@@ -274,7 +266,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -274,7 +266,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -299,12 +290,11 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -299,12 +290,11 @@ func TestNemotron3NanoRenderer(t *testing.T) {
"<|im_start|>assistant
\n
<think>
\n
"
,
"<|im_start|>assistant
\n
<think>
\n
"
,
},
},
{
{
name
:
"thinking disabled
ev
en
when model supports
it"
,
name
:
"thinking disabled
wh
en
user doesn't request
it"
,
msgs
:
[]
api
.
Message
{
msgs
:
[]
api
.
Message
{
{
Role
:
"user"
,
Content
:
"Hello!"
},
{
Role
:
"user"
,
Content
:
"Hello!"
},
},
},
isThinking
:
true
,
// model supports thinking
thinkValue
:
nil
,
thinkValue
:
nil
,
// but user didn't request it
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>user
\n
Hello!<|im_end|>
\n
"
+
"<|im_start|>assistant
\n
<think></think>"
,
"<|im_start|>assistant
\n
<think></think>"
,
...
@@ -351,7 +341,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -351,7 +341,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -390,7 +379,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -390,7 +379,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
{
name
:
"empty messages list"
,
name
:
"empty messages list"
,
msgs
:
[]
api
.
Message
{},
msgs
:
[]
api
.
Message
{},
isT
hink
ing
:
false
,
t
hink
Value
:
nil
,
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
<|im_start|>assistant
\n
<think></think>"
,
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
<|im_start|>assistant
\n
<think></think>"
,
},
},
{
{
...
@@ -417,7 +406,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -417,7 +406,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -446,7 +434,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -446,7 +434,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
Role
:
"assistant"
,
Thinking
:
"Deep thoughts here..."
,
Content
:
""
},
{
Role
:
"assistant"
,
Thinking
:
"Deep thoughts here..."
,
Content
:
""
},
{
Role
:
"user"
,
Content
:
"What did you think?"
},
{
Role
:
"user"
,
Content
:
"What did you think?"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
Think about this<|im_end|>
\n
"
+
"<|im_start|>user
\n
Think about this<|im_end|>
\n
"
+
...
@@ -483,7 +470,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -483,7 +470,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -512,7 +498,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -512,7 +498,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
{
Role
:
"assistant"
,
Content
:
"To call a tool, use <tool_call> tags with <function=name> inside."
},
{
Role
:
"assistant"
,
Content
:
"To call a tool, use <tool_call> tags with <function=name> inside."
},
{
Role
:
"user"
,
Content
:
"Thanks!"
},
{
Role
:
"user"
,
Content
:
"Thanks!"
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
expected
:
"<|im_start|>system
\n
<|im_end|>
\n
"
+
"<|im_start|>user
\n
How do I format a tool call?<|im_end|>
\n
"
+
"<|im_start|>user
\n
How do I format a tool call?<|im_end|>
\n
"
+
...
@@ -546,7 +531,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -546,7 +531,6 @@ func TestNemotron3NanoRenderer(t *testing.T) {
},
},
},
},
},
},
isThinking
:
true
,
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
thinkValue
:
&
api
.
ThinkValue
{
Value
:
true
},
expected
:
"<|im_start|>system
\n
"
+
expected
:
"<|im_start|>system
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
"# Tools
\n\n
You have access to the following functions:
\n\n
<tools>
\n
"
+
...
@@ -572,7 +556,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
...
@@ -572,7 +556,7 @@ func TestNemotron3NanoRenderer(t *testing.T) {
for
_
,
tt
:=
range
tests
{
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
renderer
:=
&
Nemotron3NanoRenderer
{
IsThinking
:
tt
.
isThinking
}
renderer
:=
&
Nemotron3NanoRenderer
{}
rendered
,
err
:=
renderer
.
Render
(
tt
.
msgs
,
tt
.
tools
,
tt
.
thinkValue
)
rendered
,
err
:=
renderer
.
Render
(
tt
.
msgs
,
tt
.
tools
,
tt
.
thinkValue
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
model/renderers/renderer.go
View file @
89eb7952
...
@@ -77,11 +77,7 @@ func rendererForName(name string) Renderer {
...
@@ -77,11 +77,7 @@ func rendererForName(name string) Renderer {
renderer
:=
&
Olmo3ThinkRenderer
{
Variant
:
Olmo3Think32B
}
renderer
:=
&
Olmo3ThinkRenderer
{
Variant
:
Olmo3Think32B
}
return
renderer
return
renderer
case
"nemotron-3-nano"
:
case
"nemotron-3-nano"
:
renderer
:=
&
Nemotron3NanoRenderer
{
IsThinking
:
false
}
return
&
Nemotron3NanoRenderer
{}
return
renderer
case
"nemotron-3-nano-thinking"
:
renderer
:=
&
Nemotron3NanoRenderer
{
IsThinking
:
true
}
return
renderer
default
:
default
:
return
nil
return
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment