一声棒喝,本不立文字
偏要著録,已是二义

X · 研究者一手

@_philschmid Gemini Interactions API 更新 🔄 当我们不再局限于简单 prompts…

@_philschmid Gemini Interactions API Update 🔄 As we move beyond simple prompts…

二〇二六年五月八日 · 英文原文

Google 更新 Gemini Interactions API,将 `outputs` 与 `roles` 改为 `steps`,支持 `user_input`、`thought`、`function_call` 等动作;SDK Python/JS 需 ≥2.0.0,或使用 `Api-Revision: 2026-05-26`。Gemini API 的 File Search tool 现支持 multimodal retrieval,可用 `gemini-embedding-2` 为 PDF 和图像构建 RAG,并返回 citations 与 grounding metadata。

Gemini Interactions API 更新 🔄 随着我们不再局限于简单的 prompt,严格的 “user” 和 “model” 角色显得有些受限。因此,我们正在演进 Gemini Interactions API,以支持丰富的、多领域的 agentic steps。

有什么变化? 📐 outputs + rolessteps,每个动作(user_inputthoughtfunction_calltool_callmodel_output 等)都是独立的 step,不再有 user/model 角色。 📄 每份 Gemini API Documentation 中都加入了切换开关,可在 Interactions API 和 generateContent 之间切换。 🎛️ 整合后的 response_format 控制项(宽高比、文件格式等)。 🤖 更新了 Interactions API skill,使迁移和更新更顺畅。

升级你的 SDK(Python ≥2.0.0 / JS ≥2.0.0),或添加 Api-Revision: 2026-05-26 header 以选择启用。

我们正处在 GA 前的最后阶段!如果你有反馈、发现 bug,或看到文档问题,请告诉我们!我们会听取并持续修改。完整指南和 Agent skill 如下 👇

安装 Skill:

npx skills add google-gemini/gemini-skills --skill gemini-interactions-api

给你的 agent 输入 prompt: "/gemini-interactions-api migrate to the new steps change instead of outputs"

Agent Skill: https://t.co/aBT9r4f4fZ 完整指南: https://t.co/tlTHMHdMoN

Gemini API 的 File Search tool 现在支持 multimodal retrieval。使用 gemini-embedding-2 作为 embedding model,只需一次调用,就能为 PDF 和图像构建真正的 multimodal RAG 系统。

工作方式:

  1. 使用 gemini-embedding-2 作为 embedding model 创建一个 store
  2. 上传文档和图像,API 会处理 chunking、embedding 和 indexing。
  3. 通过 Gemini API 使用 file_search tool,API 会处理 embedding、retrieval,并生成有依据的 response。
  4. 检查 citations,每个 response 都包含带页码和可下载图像引用的 grounding metadata。

定价:

完整可运行示例👇

译自 X · 研究者一手 · 录于 二〇二六年五月八日