fix function calling for gemini 2.5 series (#65)

This commit is contained in:
Olcan 2025-04-20 19:05:27 -07:00 committed by GitHub
parent d55168f51f
commit c095091853
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -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,