Skip to content

Commit

Permalink
💄 style: Enable googleSearch Tool for gemini-2.0-flash-exp (#4997)
Browse files Browse the repository at this point in the history
* Update index.ts

* Update index.ts
  • Loading branch information
sxjeru authored Dec 12, 2024
1 parent a7eb800 commit cde0d1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libs/agent-runtime/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ export class LobeGoogleAI implements LobeRuntimeAI {
.generateContentStream({
contents,
systemInstruction: payload.system as string,
tools: this.buildGoogleTools(payload.tools),
tools: (() => {
if (!payload.tools && model.startsWith('gemini-2.0')) {
return [{ googleSearch: {} } as GoogleFunctionCallTool];
}
return this.buildGoogleTools(payload.tools);
})(),
});

const googleStream = convertIterableToStream(geminiStreamResult.stream);
Expand Down

0 comments on commit cde0d1a

Please sign in to comment.