I’m trying to access the URL context capability of Gemini using OpenAI’s library, but my code doesn’t seem to be working. And I just read OpenAI compatibility | Gemini API | Google AI for Developers and URL context | Gemini API | Google AI for Developers, cannot find anything helpful to achieve this. Thanks a lot!
import openai
client = openai.OpenAI(
api_key="", # or os.getenv("POE_API_KEY")
base_url="https://api.poe.com/v1",
)
tools = [
{"url_context": {}},
]
chat = client.chat.completions.create(
model="Gemini-2.0-Flash",
messages=[{"role": "user", "content": "tell me the author of this paper:https://arxiv.org/pdf/2108.11539"}],
# tools=tools,
)
print(chat.choices[0])