Enable index tracking for tools - openai api support (#7888)

This commit is contained in:
Parth Sareen
2024-11-29 20:00:09 -08:00
committed by GitHub
parent 39e29ae5dd
commit 5f8051180e
4 changed files with 89 additions and 4 deletions

View File

@@ -140,6 +140,7 @@ type CompletionChunk struct {
type ToolCall struct {
ID string `json:"id"`
Index int `json:"index"`
Type string `json:"type"`
Function struct {
Name string `json:"name"`
@@ -206,6 +207,7 @@ func toToolCalls(tc []api.ToolCall) []ToolCall {
toolCalls[i].ID = toolCallId()
toolCalls[i].Type = "function"
toolCalls[i].Function.Name = tc.Function.Name
toolCalls[i].Index = tc.Function.Index
args, err := json.Marshal(tc.Function.Arguments)
if err != nil {