How can I use web search with Gemini models in the google-generativeai package?
题意:
我该如何在 google-generativeai 包中为 Gemini 模型启用网页搜索功能?
问题背景:
I'm trying to utilize the google-generativeai Python package to call various Gemini models and also equip them with web search functionality. I can do something similar with OpenAI models and the openai package like this:
我正尝试借助 google-generativeai 这个 Python 包调用各类 Gemini 模型,同时为这些模型配置网页搜索功能。我此前用 OpenAI 的模型搭配 openai 包,已经实现过类似的功能,具体代码如下:
from openai import OpenAI
client = OpenAI(api_key="...")
response = client.responses.






