diff options
| author | Olcan <[email protected]> | 2025-04-20 19:05:27 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-20 19:05:27 -0700 |
| commit | c095091853b70affdd9cf2cc6cc590451c658c1f (patch) | |
| tree | 75224f5d17a35466dc6098688b8c03b9214f97a0 | |
| parent | d55168f51ff989f6818ce386ae5ab7f383b9d3e3 (diff) | |
fix function calling for gemini 2.5 series (#65)
| -rw-r--r-- | packages/server/src/core/gemini-client.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/server/src/core/gemini-client.ts b/packages/server/src/core/gemini-client.ts index c7415ed8..d78a0559 100644 --- a/packages/server/src/core/gemini-client.ts +++ b/packages/server/src/core/gemini-client.ts @@ -64,9 +64,12 @@ export class GeminiClient { async startChat(toolDeclarations: FunctionDeclaration[]): Promise<Chat> { const envPart = await this.getEnvironment(); - const tools: Tool[] = toolDeclarations.map((declaration) => ({ - functionDeclarations: [declaration], - })); + // const tools: Tool[] = toolDeclarations.map((declaration) => ({ + // functionDeclarations: [declaration], + // })); + // merge all functions into a single tool, as seems to be required for gemini 2.5 series + // can test by asking "what tools do you have?", which lists single function unless merged + const tools: Tool[] = [{ functionDeclarations: toolDeclarations }]; try { const chat = this.ai.chats.create({ model: this.model, |
