【问题】调用gemini api长时间无法返回,手动暂停发现报错detail=“failed to connect to all addresses; last error: UNAVAILABLE: ipv4:172.217.160.74:443: Connection timed out”
【解决方案】
genai.configure(api_key=os.environ["GEMINI_API_KEY"],transport='rest')
(参考链接https://github.com/google-gemini/generative-ai-python/issues/117)