Skip to content

Commit 2053de7

Browse files
roomote[bot]roomote
andauthored
feat: remove Enable URL context and Enable Grounding with Google search checkboxes (RooCodeInc#11253)
Remove the "Enable URL context" and "Enable Grounding with Google search" checkboxes from Gemini and Vertex provider settings, along with: - enableUrlContext and enableGrounding fields from provider settings schemas - URL context and Google Search tool injection in completePrompt methods - Associated translation keys from all 18 locale files - Related test cases updated to reflect the removal - simplifySettings prop removed from Gemini and Vertex components (it was only used for the removed checkboxes in those components) Co-authored-by: Roo Code <roomote@roocode.com>
1 parent 5b0897b commit 2053de7

29 files changed

Lines changed: 33 additions & 672 deletions

packages/types/src/provider-settings.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ const vertexSchema = apiModelIdProviderModelSchema.extend({
227227
vertexJsonCredentials: z.string().optional(),
228228
vertexProjectId: z.string().optional(),
229229
vertexRegion: z.string().optional(),
230-
enableUrlContext: z.boolean().optional(),
231-
enableGrounding: z.boolean().optional(),
232230
vertex1MContext: z.boolean().optional(), // Enable 'context-1m-2025-08-07' beta for 1M context window.
233231
})
234232

@@ -273,8 +271,6 @@ const lmStudioSchema = baseProviderSettingsSchema.extend({
273271
const geminiSchema = apiModelIdProviderModelSchema.extend({
274272
geminiApiKey: z.string().optional(),
275273
googleGeminiBaseUrl: z.string().optional(),
276-
enableUrlContext: z.boolean().optional(),
277-
enableGrounding: z.boolean().optional(),
278274
})
279275

280276
const geminiCliSchema = apiModelIdProviderModelSchema.extend({

src/api/providers/__tests__/gemini-handler.spec.ts

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ describe("GeminiHandler backend support", () => {
2727
it("createMessage uses AI SDK tools format", async () => {
2828
const options = {
2929
apiProvider: "gemini",
30-
enableUrlContext: true,
31-
enableGrounding: true,
3230
} as ApiHandlerOptions
3331
const handler = new GeminiHandler(options)
3432

@@ -50,36 +48,9 @@ describe("GeminiHandler backend support", () => {
5048
)
5149
})
5250

53-
it("completePrompt passes tools when URL context and grounding enabled", async () => {
51+
it("completePrompt generates text without tools", async () => {
5452
const options = {
5553
apiProvider: "gemini",
56-
enableUrlContext: true,
57-
enableGrounding: true,
58-
} as ApiHandlerOptions
59-
const handler = new GeminiHandler(options)
60-
61-
mockGenerateText.mockResolvedValue({
62-
text: "ok",
63-
providerMetadata: {},
64-
})
65-
66-
const res = await handler.completePrompt("hi")
67-
expect(res).toBe("ok")
68-
69-
// Verify generateText was called with tools
70-
expect(mockGenerateText).toHaveBeenCalledWith(
71-
expect.objectContaining({
72-
prompt: "hi",
73-
tools: expect.any(Object),
74-
}),
75-
)
76-
})
77-
78-
it("completePrompt passes config overrides without tools when URL context and grounding disabled", async () => {
79-
const options = {
80-
apiProvider: "gemini",
81-
enableUrlContext: false,
82-
enableGrounding: false,
8354
} as ApiHandlerOptions
8455
const handler = new GeminiHandler(options)
8556

@@ -100,7 +71,6 @@ describe("GeminiHandler backend support", () => {
10071
it("should handle grounding metadata extraction failure gracefully", async () => {
10172
const options = {
10273
apiProvider: "gemini",
103-
enableGrounding: true,
10474
} as ApiHandlerOptions
10575
const handler = new GeminiHandler(options)
10676

@@ -134,7 +104,6 @@ describe("GeminiHandler backend support", () => {
134104
it("should handle malformed grounding metadata", async () => {
135105
const options = {
136106
apiProvider: "gemini",
137-
enableGrounding: true,
138107
} as ApiHandlerOptions
139108
const handler = new GeminiHandler(options)
140109

@@ -181,11 +150,9 @@ describe("GeminiHandler backend support", () => {
181150
}
182151
})
183152

184-
it("should handle API errors when tools are enabled", async () => {
153+
it("should handle API errors", async () => {
185154
const options = {
186155
apiProvider: "gemini",
187-
enableUrlContext: true,
188-
enableGrounding: true,
189156
} as ApiHandlerOptions
190157
const handler = new GeminiHandler(options)
191158

src/api/providers/__tests__/vertex.spec.ts

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ vitest.mock("vscode", () => ({}))
55

66
// Mock the createVertex function from @ai-sdk/google-vertex
77
const mockCreateVertex = vitest.fn()
8-
const mockGoogleSearchTool = vitest.fn()
9-
const mockUrlContextTool = vitest.fn()
108

119
vitest.mock("@ai-sdk/google-vertex", () => ({
1210
createVertex: (...args: unknown[]) => {
1311
mockCreateVertex(...args)
1412
const provider = Object.assign((modelId: string) => ({ modelId }), {
15-
tools: {
16-
googleSearch: mockGoogleSearchTool,
17-
urlContext: mockUrlContextTool,
18-
},
13+
tools: {},
1914
})
2015
return provider
2116
},
@@ -48,8 +43,6 @@ describe("VertexHandler", () => {
4843
mockStreamText.mockClear()
4944
mockGenerateText.mockClear()
5045
mockCreateVertex.mockClear()
51-
mockGoogleSearchTool.mockClear()
52-
mockUrlContextTool.mockClear()
5346

5447
handler = new VertexHandler({
5548
apiModelId: "gemini-1.5-pro-001",
@@ -241,58 +234,6 @@ describe("VertexHandler", () => {
241234
const result = await handler.completePrompt("Test prompt")
242235
expect(result).toBe("")
243236
})
244-
245-
it("should add Google Search tool when grounding is enabled", async () => {
246-
const handlerWithGrounding = new VertexHandler({
247-
apiModelId: "gemini-1.5-pro-001",
248-
vertexProjectId: "test-project",
249-
vertexRegion: "us-central1",
250-
enableGrounding: true,
251-
})
252-
253-
mockGenerateText.mockResolvedValue({
254-
text: "Search result",
255-
providerMetadata: {},
256-
})
257-
mockGoogleSearchTool.mockReturnValue({ type: "googleSearch" })
258-
259-
await handlerWithGrounding.completePrompt("Search query")
260-
261-
expect(mockGoogleSearchTool).toHaveBeenCalledWith({})
262-
expect(mockGenerateText).toHaveBeenCalledWith(
263-
expect.objectContaining({
264-
tools: expect.objectContaining({
265-
google_search: { type: "googleSearch" },
266-
}),
267-
}),
268-
)
269-
})
270-
271-
it("should add URL Context tool when enabled", async () => {
272-
const handlerWithUrlContext = new VertexHandler({
273-
apiModelId: "gemini-1.5-pro-001",
274-
vertexProjectId: "test-project",
275-
vertexRegion: "us-central1",
276-
enableUrlContext: true,
277-
})
278-
279-
mockGenerateText.mockResolvedValue({
280-
text: "URL context result",
281-
providerMetadata: {},
282-
})
283-
mockUrlContextTool.mockReturnValue({ type: "urlContext" })
284-
285-
await handlerWithUrlContext.completePrompt("Fetch URL")
286-
287-
expect(mockUrlContextTool).toHaveBeenCalledWith({})
288-
expect(mockGenerateText).toHaveBeenCalledWith(
289-
expect.objectContaining({
290-
tools: expect.objectContaining({
291-
url_context: { type: "urlContext" },
292-
}),
293-
}),
294-
)
295-
})
296237
})
297238

298239
describe("getModel", () => {

src/api/providers/gemini.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -286,20 +286,6 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
286286
const { id: modelId, info } = this.getModel()
287287

288288
try {
289-
// Build tools for grounding - cast to any to bypass strict typing
290-
// Google provider tools have a different shape than standard ToolSet
291-
const tools: Record<string, any> = {}
292-
293-
// Add URL context tool if enabled
294-
if (this.options.enableUrlContext) {
295-
tools.url_context = this.provider.tools.urlContext({})
296-
}
297-
298-
// Add Google Search grounding tool if enabled
299-
if (this.options.enableGrounding) {
300-
tools.google_search = this.provider.tools.googleSearch({})
301-
}
302-
303289
const supportsTemperature = info.supportsTemperature !== false
304290
const temperatureConfig: number | undefined = supportsTemperature
305291
? (this.options.modelTemperature ?? info.defaultTemperature ?? 1)
@@ -309,7 +295,6 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
309295
model: this.provider(modelId),
310296
prompt,
311297
temperature: temperatureConfig,
312-
...(Object.keys(tools).length > 0 && { tools: tools as ToolSet }),
313298
})
314299

315300
let text = result.text ?? ""

src/api/providers/vertex.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,6 @@ export class VertexHandler extends BaseProvider implements SingleCompletionHandl
303303
const { id: modelId, info } = this.getModel()
304304

305305
try {
306-
// Build tools for grounding - cast to any to bypass strict typing
307-
// Google provider tools have a different shape than standard ToolSet
308-
const tools: Record<string, any> = {}
309-
310-
// Add URL context tool if enabled
311-
if (this.options.enableUrlContext) {
312-
tools.url_context = this.provider.tools.urlContext({})
313-
}
314-
315-
// Add Google Search grounding tool if enabled
316-
if (this.options.enableGrounding) {
317-
tools.google_search = this.provider.tools.googleSearch({})
318-
}
319-
320306
const supportsTemperature = info.supportsTemperature !== false
321307
const temperatureConfig: number | undefined = supportsTemperature
322308
? (this.options.modelTemperature ?? info.defaultTemperature ?? 1)
@@ -326,7 +312,6 @@ export class VertexHandler extends BaseProvider implements SingleCompletionHandl
326312
model: this.provider(modelId),
327313
prompt,
328314
temperature: temperatureConfig,
329-
...(Object.keys(tools).length > 0 && { tools: tools as ToolSet }),
330315
})
331316

332317
let text = result.text ?? ""

src/core/task/__tests__/grounding-sources.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ describe("Task grounding sources handling", () => {
183183
mockApiConfiguration = {
184184
apiProvider: "gemini",
185185
geminiApiKey: "test-key",
186-
enableGrounding: true,
187186
} as ProviderSettings
188187
})
189188

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -601,19 +601,11 @@ const ApiOptions = ({
601601
)}
602602

603603
{selectedProvider === "vertex" && (
604-
<Vertex
605-
apiConfiguration={apiConfiguration}
606-
setApiConfigurationField={setApiConfigurationField}
607-
simplifySettings={fromWelcomeView}
608-
/>
604+
<Vertex apiConfiguration={apiConfiguration} setApiConfigurationField={setApiConfigurationField} />
609605
)}
610606

611607
{selectedProvider === "gemini" && (
612-
<Gemini
613-
apiConfiguration={apiConfiguration}
614-
setApiConfigurationField={setApiConfigurationField}
615-
simplifySettings={fromWelcomeView}
616-
/>
608+
<Gemini apiConfiguration={apiConfiguration} setApiConfigurationField={setApiConfigurationField} />
617609
)}
618610

619611
{selectedProvider === "openai" && (

webview-ui/src/components/settings/providers/Gemini.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import { inputEventTransform } from "../transforms"
1212
type GeminiProps = {
1313
apiConfiguration: ProviderSettings
1414
setApiConfigurationField: (field: keyof ProviderSettings, value: ProviderSettings[keyof ProviderSettings]) => void
15-
simplifySettings?: boolean
1615
}
1716

18-
export const Gemini = ({ apiConfiguration, setApiConfigurationField, simplifySettings }: GeminiProps) => {
17+
export const Gemini = ({ apiConfiguration, setApiConfigurationField }: GeminiProps) => {
1918
const { t } = useAppTranslation()
2019

2120
const [googleGeminiBaseUrlSelected, setGoogleGeminiBaseUrlSelected] = useState(
@@ -73,31 +72,6 @@ export const Gemini = ({ apiConfiguration, setApiConfigurationField, simplifySet
7372
className="w-full mt-1"
7473
/>
7574
)}
76-
77-
{!simplifySettings && (
78-
<>
79-
<Checkbox
80-
className="mt-6"
81-
data-testid="checkbox-url-context"
82-
checked={!!apiConfiguration.enableUrlContext}
83-
onChange={(checked: boolean) => setApiConfigurationField("enableUrlContext", checked)}>
84-
{t("settings:providers.geminiParameters.urlContext.title")}
85-
</Checkbox>
86-
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
87-
{t("settings:providers.geminiParameters.urlContext.description")}
88-
</div>
89-
90-
<Checkbox
91-
data-testid="checkbox-grounding-search"
92-
checked={!!apiConfiguration.enableGrounding}
93-
onChange={(checked: boolean) => setApiConfigurationField("enableGrounding", checked)}>
94-
{t("settings:providers.geminiParameters.groundingSearch.title")}
95-
</Checkbox>
96-
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
97-
{t("settings:providers.geminiParameters.groundingSearch.description")}
98-
</div>
99-
</>
100-
)}
10175
</div>
10276
</>
10377
)

webview-ui/src/components/settings/providers/Vertex.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import { inputEventTransform } from "../transforms"
1212
type VertexProps = {
1313
apiConfiguration: ProviderSettings
1414
setApiConfigurationField: (field: keyof ProviderSettings, value: ProviderSettings[keyof ProviderSettings]) => void
15-
simplifySettings?: boolean
1615
}
1716

18-
export const Vertex = ({ apiConfiguration, setApiConfigurationField, simplifySettings }: VertexProps) => {
17+
export const Vertex = ({ apiConfiguration, setApiConfigurationField }: VertexProps) => {
1918
const { t } = useAppTranslation()
2019

2120
// Check if the selected model supports 1M context (supported Claude 4 models)
@@ -116,30 +115,6 @@ export const Vertex = ({ apiConfiguration, setApiConfigurationField, simplifySet
116115
</div>
117116
</div>
118117
)}
119-
120-
{!simplifySettings && apiConfiguration.apiModelId?.startsWith("gemini") && (
121-
<div className="mt-6">
122-
<Checkbox
123-
data-testid="checkbox-url-context"
124-
checked={!!apiConfiguration.enableUrlContext}
125-
onChange={(checked: boolean) => setApiConfigurationField("enableUrlContext", checked)}>
126-
{t("settings:providers.geminiParameters.urlContext.title")}
127-
</Checkbox>
128-
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
129-
{t("settings:providers.geminiParameters.urlContext.description")}
130-
</div>
131-
132-
<Checkbox
133-
data-testid="checkbox-grounding-search"
134-
checked={!!apiConfiguration.enableGrounding}
135-
onChange={(checked: boolean) => setApiConfigurationField("enableGrounding", checked)}>
136-
{t("settings:providers.geminiParameters.groundingSearch.title")}
137-
</Checkbox>
138-
<div className="text-sm text-vscode-descriptionForeground mb-3 mt-1.5">
139-
{t("settings:providers.geminiParameters.groundingSearch.description")}
140-
</div>
141-
</div>
142-
)}
143118
</>
144119
)
145120
}

0 commit comments

Comments
 (0)