fix function calling for gemini 2.5 series (#65)
This commit is contained in:
parent
d55168f51f
commit
c095091853
|
@ -64,9 +64,12 @@ export class GeminiClient {
|
||||||
|
|
||||||
async startChat(toolDeclarations: FunctionDeclaration[]): Promise<Chat> {
|
async startChat(toolDeclarations: FunctionDeclaration[]): Promise<Chat> {
|
||||||
const envPart = await this.getEnvironment();
|
const envPart = await this.getEnvironment();
|
||||||
const tools: Tool[] = toolDeclarations.map((declaration) => ({
|
// const tools: Tool[] = toolDeclarations.map((declaration) => ({
|
||||||
functionDeclarations: [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 {
|
try {
|
||||||
const chat = this.ai.chats.create({
|
const chat = this.ai.chats.create({
|
||||||
model: this.model,
|
model: this.model,
|
||||||
|
|
Loading…
Reference in New Issue