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
c4c5a4a0
"vscode:/vscode.git/clone" did not exist on "36215690087430caa77cccec7d5c0971e990a576"
Unverified
Commit
c4c5a4a0
authored
Oct 14, 2025
by
Parth Sareen
Committed by
GitHub
Oct 14, 2025
Browse files
types: send index for tool calls (#12625)
parent
3dcfd5f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
api/types.go
api/types.go
+1
-1
api/types_test.go
api/types_test.go
+24
-0
No files found.
api/types.go
View file @
c4c5a4a0
...
@@ -204,7 +204,7 @@ type ToolCall struct {
...
@@ -204,7 +204,7 @@ type ToolCall struct {
}
}
type
ToolCallFunction
struct
{
type
ToolCallFunction
struct
{
Index
int
`json:"index
,omitempty
"`
Index
int
`json:"index"`
Name
string
`json:"name"`
Name
string
`json:"name"`
Arguments
ToolCallFunctionArguments
`json:"arguments"`
Arguments
ToolCallFunctionArguments
`json:"arguments"`
}
}
...
...
api/types_test.go
View file @
c4c5a4a0
...
@@ -298,6 +298,30 @@ func TestToolFunction_UnmarshalJSON(t *testing.T) {
...
@@ -298,6 +298,30 @@ func TestToolFunction_UnmarshalJSON(t *testing.T) {
}
}
}
}
func
TestToolCallFunction_IndexAlwaysMarshals
(
t
*
testing
.
T
)
{
fn
:=
ToolCallFunction
{
Name
:
"echo"
,
Arguments
:
ToolCallFunctionArguments
{
"message"
:
"hi"
},
}
data
,
err
:=
json
.
Marshal
(
fn
)
require
.
NoError
(
t
,
err
)
raw
:=
map
[
string
]
any
{}
require
.
NoError
(
t
,
json
.
Unmarshal
(
data
,
&
raw
))
require
.
Contains
(
t
,
raw
,
"index"
)
assert
.
Equal
(
t
,
float64
(
0
),
raw
[
"index"
])
fn
.
Index
=
3
data
,
err
=
json
.
Marshal
(
fn
)
require
.
NoError
(
t
,
err
)
raw
=
map
[
string
]
any
{}
require
.
NoError
(
t
,
json
.
Unmarshal
(
data
,
&
raw
))
require
.
Contains
(
t
,
raw
,
"index"
)
assert
.
Equal
(
t
,
float64
(
3
),
raw
[
"index"
])
}
func
TestPropertyType_UnmarshalJSON
(
t
*
testing
.
T
)
{
func
TestPropertyType_UnmarshalJSON
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
...
...
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