[控场AI]
产品google-generativeai SDK / 旧版 Gemini SDK

google-generativeai

Google 推出的旧版 Python SDK,用于调用 Gemini API,采用 GenModel 构造方式,已被 google-genai 取代。

时间轴 (近 90 天)

10月18日

Google Gemini SDK(如 google-generativeai)抛出 ResourceExhausted(对应429)和 ServiceUnavailable(对应503)。

待验证50%
10月14日

Gemini API 的官方 Python 包可通过 `pip install google-generativeai` 安装。

待验证50%
10月14日

在旧版 `google-generativeai` SDK 中,使用 `genai.GenModel("gemini-1.5-pro")` 初始化模型,然后调用 `model.generate(prompt)` 生成内容。

待验证50%
10月14日

两套 SDK(`google-generativeai` 和 `google-genai`)在方法命名、响应字段和异常类型上都有差异,混用示例代码时容易踩坑。

待验证50%

全部知识事实 (4)

来源文章