diff --git a/app/client/platforms/google.ts b/app/client/platforms/google.ts
index 654f0e3e4c7..a1c806e490d 100644
--- a/app/client/platforms/google.ts
+++ b/app/client/platforms/google.ts
@@ -150,7 +150,7 @@ export class GeminiProApi implements LLMApi {
model: options.config.model,
},
};
- const requestPayload = {
+ const requestPayload: any = {
contents: messages,
generationConfig: {
// stopSequences: [
@@ -181,6 +181,10 @@ export class GeminiProApi implements LLMApi {
],
};
+ if (modelConfig.enableWebSearch) {
+ requestPayload.tools = [{ googleSearch: {} }];
+ }
+
let shouldStream = !!options.config.stream;
const controller = new AbortController();
options.onController?.(controller);
diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx
index e845bfeac7a..efdd256b171 100644
--- a/app/components/model-config.tsx
+++ b/app/components/model-config.tsx
@@ -241,6 +241,23 @@ export function ModelConfigList(props: {
}
>
+ {props.modelConfig?.providerName == ServiceProvider.Google && (
+
+
+ props.updateConfig(
+ (config) => (config.enableWebSearch = e.currentTarget.checked),
+ )
+ }
+ >
+
+ )}