Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cde0d1a

Browse files
authored
💄 style: Enable googleSearch Tool for gemini-2.0-flash-exp (#4997)
* Update index.ts * Update index.ts
1 parent a7eb800 commit cde0d1a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/libs/agent-runtime/google/index.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ export class LobeGoogleAI implements LobeRuntimeAI {
9191
.generateContentStream({
9292
contents,
9393
systemInstruction: payload.system as string,
94-
tools: this.buildGoogleTools(payload.tools),
94+
tools: (() => {
95+
if (!payload.tools && model.startsWith('gemini-2.0')) {
96+
return [{ googleSearch: {} } as GoogleFunctionCallTool];
97+
}
98+
return this.buildGoogleTools(payload.tools);
99+
})(),
95100
});
96101

97102
const googleStream = convertIterableToStream(geminiStreamResult.stream);

0 commit comments

Comments
 (0)