Google GenAI SDK Python v2.30.0:新增交互续传与用量字段,修复流式中断问题
v2.30.0
推荐理由
本次更新引入了关键的交互续传机制与自动恢复功能,对构建高可用 AI Agent 至关重要;同时强化了 mTLS 安全配置,建议依赖该 SDK 处理长任务或敏感数据的开发者尽快升级。
2.30.0 (2026-10-13)
Features
功能特性
- Accumulate streaming continuation usage metadata and expose initial_prompt_token_count (b27f3cd)
- Add continuation_token to the Interactions interaction.status_update event. (02db4c5)
- Add a CONTINUATION_REQUIRED Interaction status (bf9d6d7)
- Add billable token counts fields (6a6501c)
- Add startOffset/endOffset to Transcription and interimTranscriptTimestampEnabled to RealtimeInputConfig (c644a94)
- Add usage in InteractionStatusUpdate events (56c3a1a)
- Allow automatic resumption of continuation token for in generate content and generate content stream. Default behavior for this feature is disabled (83e43ea)
- cli: Update Speakeasy generator to v2.948.0, bump CLI to v0.4.2, and apply CLI overlay fixes (cdcd3dd)
- Enable automatic continuation token resumption for chats module. (9ebf714)
- 累积流式续传使用元数据,并暴露 initial_prompt_token_count(b27f3cd)
- 在 Interactions interaction.status_update 事件中添加 continuation_token。(02db4c5)
- 添加 CONTINUATION_REQUIRED Interaction 状态(bf9d6d7)
- 添加可计费 token 计数字段(6a6501c)
- 为 Transcription 添加 startOffset/endOffset,并为 RealtimeInputConfig 添加 interimTranscriptTimestampEnabled(c644a94)
- 在 InteractionStatusUpdate 事件中添加使用情况信息(56c3a1a)
- 允许在 generate content 和 generate content stream 中自动恢复续传 token。此功能的默认行为已禁用(83e43ea)
- cli:将 Speakeasy 生成器更新至 v2.948.0,将 CLI 升级至 v0.4.2,并应用 CLI 覆盖修复(cdcd3dd)
- 启用 chats 模块的自动续传 token 恢复功能。(9ebf714)
Bug Fixes
错误修复
- Clear intermediate CONTINUATION finish_reason in streaming continuation (8a641d8)
- Do not record incomplete continuation stream turns in curated chat history (b382e01)
- gemini-api-cli: Remove unsupported 2.5 and 1.6 models from Interactions model options and CLI examples (fe5fb10)
- genai: Deduplicate Flash and Omni descriptions in ModelOption (33efaad)
- interactions: Restore super().model_construct in Interaction model validator (ccd5dd3)
- python: Discard stale checkpoint token on non-resumable finish reason (f44e8ee)
- Raise default HTTP timeouts so long-running requests aren't killed client-side (b006b4b)
- Resume streaming generation from the latest checkpoint continuation token on mid-stream errors or cutoffs (90bb32b)
- Update EnvironmentConfig.env schema to map keys to EnvVar or string. (3108d8c)
- Use the mTLS endpoint on the httpx and websocket transports (97d5821)
- 在流式续传中清除中间 CONTINUATION finish_reason(8a641d8)
- 不在精选聊天历史记录中记录不完整的续传流轮次(b382e01)
- gemini-api-cli:从 Interactions 模型选项和 CLI 示例中移除不受支持的 2.5 和 1.6 模型(fe5fb10)
- genai:去重 ModelOption 中的 Flash 和 Omni 描述(33efaad)
- interactions:在 Interaction 模型验证器中恢复 super().model_construct(ccd5dd3)
- python:在非可恢复的 finish reason 下丢弃过期的检查点 token(f44e8ee)
- 提高默认 HTTP 超时设置,防止长运行请求在客户端被终止(b006b4b)
- 在中途错误或截断时,从最新的检查点续传 token 恢复流式生成(90bb32b)
- 更新 EnvironmentConfig.env 架构,将键映射到 EnvVar 或字符串。(3108d8c)
- 在 httpx 和 websocket 传输中使用 mTLS 端点(97d5821)
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力