How to enable URL Context and Google Search Grounding using this SDK?
The Gemini models support URL Context and Google Search Grounding features, which are very useful. However, after searching online and trying various parameters like extraBody, I still can't figure out how to enable these features through this SDK.
For example, when I provide a Reddit post URL and ask a question about its content, it works in Google AI Studio but fails here—indicating these features aren't properly enabled in my implementation.
I've tried the following approaches without success:
const { text } = await generateText({
model: openrouter(GEMINI_MODEL, {
extraBody: {
tools: [{ urlContext: {} }]
}
}),
prompt: "xxx"
});
const { text } = await generateText({
model: openrouter(GEMINI_MODEL, {
extraBody: {
config: {
tools: [{ urlContext: {} }]
}
}
}),
prompt: "xxx"
});
Could you please provide guidance on the correct way to enable these features? Any documentation references or working examples would be greatly appreciated.
cc @yogasanas
is there any update on this issue ?
same problem!
Facing the same issue as well. Any updates on this?