Skip to content

Commit 792e2b1

Browse files
loukotalkujtimiihoxha
authored andcommitted
fix: gemini tool calling
1 parent 5859dcd commit 792e2b1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/llm/provider/gemini.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ func (g *geminiClient) convertMessages(messages []message.Message) []*genai.Cont
132132
}
133133

134134
func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
135-
geminiTools := make([]*genai.Tool, 0, len(tools))
135+
geminiTool := &genai.Tool{}
136+
geminiTool.FunctionDeclarations = make([]*genai.FunctionDeclaration, 0, len(tools))
136137

137138
for _, tool := range tools {
138139
info := tool.Info()
@@ -146,12 +147,10 @@ func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
146147
},
147148
}
148149

149-
geminiTools = append(geminiTools, &genai.Tool{
150-
FunctionDeclarations: []*genai.FunctionDeclaration{declaration},
151-
})
150+
geminiTool.FunctionDeclarations = append(geminiTool.FunctionDeclarations, declaration)
152151
}
153152

154-
return geminiTools
153+
return []*genai.Tool{geminiTool}
155154
}
156155

157156
func (g *geminiClient) finishReason(reason genai.FinishReason) message.FinishReason {

0 commit comments

Comments
 (0)