agentscope-extensions-model-gemini 接入 Google Gemini 模型。它支持 Gemini API,也可以通过显式配置走 Vertex AI 路径。
添加依赖
ModelRegistry
设置GEMINI_API_KEY 后,使用 gemini:<model> 字符串 id:
显式 builder
需要自定义 API 设置、Vertex AI credentials、formatter、transport 或生成参数时,使用 builder:服务端工具
Gemini 内置工具由模型服务商执行,不会通过 AgentScope 本地 Toolkit 执行。使用显式 model builder 配置这些工具:GeminiServerTool.of(...) 可用于包装 Google GenAI SDK Tool builder 构建的内置服务端工具定义,
例如 Google Search、Google Maps、URL Context、Code Execution、File Search 和 Enterprise Web Search。
配置至少一个服务端工具后,AgentScope 会自动启用 Gemini 服务端调用上下文,并在对话历史中保留返回的
工具调用和结果。服务端工具与本地 function tools 相互独立,因此可以在同一次请求中同时提供。
不要用它包装自定义 function tools;GeminiServerTool.of(...) 会拒绝这类定义。