mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-20 02:34:02 +00:00
feat: add function and tools support for Gemini (#1358)
* Update model.go * Support Gemini tool_calls. * Fix gemini tool calls (also keep support functions). * Fixed the problem of arguments not being stringified. Fix panic: candidate.Content.Parts out of range
This commit is contained in:
@@ -12,9 +12,15 @@ type InlineData struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
type FunctionCall struct {
|
||||
FunctionName string `json:"name"`
|
||||
Arguments any `json:"args"`
|
||||
}
|
||||
|
||||
type Part struct {
|
||||
Text string `json:"text,omitempty"`
|
||||
InlineData *InlineData `json:"inlineData,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
InlineData *InlineData `json:"inlineData,omitempty"`
|
||||
FunctionCall *FunctionCall `json:"functionCall,omitempty"`
|
||||
}
|
||||
|
||||
type ChatContent struct {
|
||||
@@ -28,7 +34,7 @@ type ChatSafetySettings struct {
|
||||
}
|
||||
|
||||
type ChatTools struct {
|
||||
FunctionDeclarations any `json:"functionDeclarations,omitempty"`
|
||||
FunctionDeclarations any `json:"function_declarations,omitempty"`
|
||||
}
|
||||
|
||||
type ChatGenerationConfig struct {
|
||||
|
Reference in New Issue
Block a user