Feat: llm tool use

This commit is contained in:
Grail Finder
2025-09-05 14:03:17 +03:00
parent 8b88d2d824
commit 8699b1a84e
3 changed files with 119 additions and 44 deletions

View File

@@ -7,16 +7,15 @@ type Question struct {
}
type Answer struct {
Q Question
Answer string `json:"answer"`
Model string `json:"model"`
// resp time?
ToolCall ToolCall `json:"tool_call"`
Q Question
Answer string `json:"answer"`
Model string `json:"model"`
ToolCall ToolCallInfo `json:"tool_call,omitempty"`
}
type ToolCall struct {
Name string `json:"name"`
Args map[string]ToolArgProps `json:"args"`
type ToolCallInfo struct {
Name string `json:"name"`
Args map[string]string `json:"args"`
}
// type OpenRouterResp struct {
@@ -44,13 +43,31 @@ type ToolCall struct {
// } `json:"usage"`
// }
type ToolCallFunction struct {
Name string `json:"name"`
Arguments string `json:"arguments"`
}
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function ToolCallFunction `json:"function"`
}
type DSRespChoice struct {
Text string `json:"text"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
Message struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
} `json:"message,omitempty"`
}
type DSResp struct {
ID string `json:"id"`
Choices []struct {
Text string `json:"text"`
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
ID string `json:"id"`
Choices []DSRespChoice `json:"choices"`
Created int `json:"created"`
Model string `json:"model"`
SystemFingerprint string `json:"system_fingerprint"`