mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 02:04:22 +01:00
fix: gemini tool calling
This commit is contained in:
committed by
Kujtim Hoxha
parent
5859dcdc00
commit
792e2b164b
@@ -132,7 +132,8 @@ func (g *geminiClient) convertMessages(messages []message.Message) []*genai.Cont
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
|
func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
|
||||||
geminiTools := make([]*genai.Tool, 0, len(tools))
|
geminiTool := &genai.Tool{}
|
||||||
|
geminiTool.FunctionDeclarations = make([]*genai.FunctionDeclaration, 0, len(tools))
|
||||||
|
|
||||||
for _, tool := range tools {
|
for _, tool := range tools {
|
||||||
info := tool.Info()
|
info := tool.Info()
|
||||||
@@ -146,12 +147,10 @@ func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
geminiTools = append(geminiTools, &genai.Tool{
|
geminiTool.FunctionDeclarations = append(geminiTool.FunctionDeclarations, declaration)
|
||||||
FunctionDeclarations: []*genai.FunctionDeclaration{declaration},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return geminiTools
|
return []*genai.Tool{geminiTool}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *geminiClient) finishReason(reason genai.FinishReason) message.FinishReason {
|
func (g *geminiClient) finishReason(reason genai.FinishReason) message.FinishReason {
|
||||||
|
|||||||
Reference in New Issue
Block a user