💄 style: Enable googleSearch Tool for gemini-2.0-flash-exp (#4997)

* Update index.ts

* Update index.ts
This commit is contained in:
sxjeru
2024-12-12 22:39:01 +08:00
committed by GitHub
parent a7eb8008ea
commit cde0d1a6c1
+6 -1
View File
@@ -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);