类 GeminiToolsHelper
java.lang.Object
io.agentscope.core.formatter.gemini.GeminiToolsHelper
Handles tool registration and configuration for Gemini API.
This helper converts AgentScope tool schemas to Gemini's Tool and ToolConfig format:
- Tool: Contains function declarations with JSON Schema parameters
- ToolConfig: Contains function calling mode configuration
Tool Choice Mapping:
- Auto: mode=AUTO (model decides)
- None: mode=NONE (disable tool calling)
- Required: mode=ANY (force tool call from all provided tools)
- Specific: mode=ANY + allowedFunctionNames (force specific tool)
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected com.google.genai.types.TypeconvertJsonTypeToGeminiType(String jsonType) Convert JSON Schema type string to Gemini Type.protected com.google.genai.types.SchemaconvertParametersToSchema(Map<String, Object> parameters) Convert parameters map to Gemini Schema object.com.google.genai.types.ToolconvertToGeminiTool(List<ToolSchema> tools) Convert AgentScope ToolSchema list to Gemini Tool object.com.google.genai.types.ToolConfigconvertToolChoice(ToolChoice toolChoice) Create Gemini ToolConfig from AgentScope ToolChoice.
-
构造器详细资料
-
GeminiToolsHelper
public GeminiToolsHelper()Creates a new GeminiToolsHelper.
-
-
方法详细资料
-
convertToGeminiTool
Convert AgentScope ToolSchema list to Gemini Tool object.- 参数:
tools- List of tool schemas (may be null or empty)- 返回:
- Gemini Tool object with function declarations, or null if no tools
-
convertParametersToSchema
Convert parameters map to Gemini Schema object.- 参数:
parameters- Parameter schema map (JSON Schema format)- 返回:
- Gemini Schema object
-
convertJsonTypeToGeminiType
Convert JSON Schema type string to Gemini Type.- 参数:
jsonType- JSON Schema type string (e.g., "object", "string", "number")- 返回:
- Gemini Type object
-
convertToolChoice
Create Gemini ToolConfig from AgentScope ToolChoice.Tool choice mapping:
- null or Auto: mode=AUTO (model decides)
- None: mode=NONE (disable tool calling)
- Required: mode=ANY (force tool call from all provided tools)
- Specific: mode=ANY + allowedFunctionNames (force specific tool)
- 参数:
toolChoice- The tool choice configuration (null means auto)- 返回:
- Gemini ToolConfig object, or null if auto (default behavior)
-