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
5a83f79a
Commit
5a83f79a
authored
Jul 16, 2024
by
Michael Yang
Browse files
remove unneeded tool calls
parent
a8388beb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
15 deletions
+1
-15
api/types.go
api/types.go
+0
-2
server/model.go
server/model.go
+1
-6
server/model_test.go
server/model_test.go
+0
-7
No files found.
api/types.go
View file @
5a83f79a
...
@@ -115,8 +115,6 @@ type Message struct {
...
@@ -115,8 +115,6 @@ type Message struct {
}
}
type
ToolCall
struct
{
type
ToolCall
struct
{
ID
string
`json:"id"`
Type
string
`json:"type"`
Function
struct
{
Function
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
Arguments
map
[
string
]
any
`json:"arguments"`
Arguments
map
[
string
]
any
`json:"arguments"`
...
...
server/model.go
View file @
5a83f79a
...
@@ -16,7 +16,6 @@ import (
...
@@ -16,7 +16,6 @@ import (
"strings"
"strings"
"text/template/parse"
"text/template/parse"
"github.com/google/uuid"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/api"
"github.com/ollama/ollama/convert"
"github.com/ollama/ollama/convert"
"github.com/ollama/ollama/llm"
"github.com/ollama/ollama/llm"
...
@@ -363,11 +362,7 @@ func (m *Model) parseToolCalls(s string) ([]api.ToolCall, bool) {
...
@@ -363,11 +362,7 @@ func (m *Model) parseToolCalls(s string) ([]api.ToolCall, bool) {
var
toolCalls
[]
api
.
ToolCall
var
toolCalls
[]
api
.
ToolCall
for
_
,
kv
:=
range
objs
{
for
_
,
kv
:=
range
objs
{
call
:=
api
.
ToolCall
{
var
call
api
.
ToolCall
ID
:
uuid
.
New
()
.
String
(),
Type
:
"function"
,
}
for
k
,
v
:=
range
kv
{
for
k
,
v
:=
range
kv
{
switch
k
{
switch
k
{
case
name
:
case
name
:
...
...
server/model_test.go
View file @
5a83f79a
...
@@ -181,7 +181,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
...
@@ -181,7 +181,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
calls
:=
[]
api
.
ToolCall
{
calls
:=
[]
api
.
ToolCall
{
{
{
Type
:
"function"
,
Function
:
function
{
Function
:
function
{
Name
:
"get_current_weather"
,
Name
:
"get_current_weather"
,
Arguments
:
map
[
string
]
any
{
Arguments
:
map
[
string
]
any
{
...
@@ -191,7 +190,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
...
@@ -191,7 +190,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
},
},
},
},
{
{
Type
:
"function"
,
Function
:
function
{
Function
:
function
{
Name
:
"get_current_weather"
,
Name
:
"get_current_weather"
,
Arguments
:
map
[
string
]
any
{
Arguments
:
map
[
string
]
any
{
...
@@ -228,11 +226,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
...
@@ -228,11 +226,6 @@ The temperature in San Francisco, CA is 70°F and in Toronto, Canada is 20°C.`,
}
}
if
tt
.
ok
{
if
tt
.
ok
{
for
i
:=
range
actual
{
// ID is randomly generated so clear it for comparison
actual
[
i
]
.
ID
=
""
}
if
diff
:=
cmp
.
Diff
(
actual
,
calls
);
diff
!=
""
{
if
diff
:=
cmp
.
Diff
(
actual
,
calls
);
diff
!=
""
{
t
.
Errorf
(
"mismatch (-got +want):
\n
%s"
,
diff
)
t
.
Errorf
(
"mismatch (-got +want):
\n
%s"
,
diff
)
}
}
...
...
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