Class OpenAIToolConverter
java.lang.Object
io.agentscope.core.chat.completions.converter.OpenAIToolConverter
Converter for converting OpenAI tool format to AgentScope ToolSchema.
This converter handles the transformation from OpenAI's tool format (used in Chat Completions API requests) to AgentScope's internal ToolSchema format. Tools converted by this converter are intended to be registered as schema-only tools, which will trigger tool suspension when called.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.agentscope.core.model.ToolSchemaConverts a single OpenAI tool to a ToolSchema.List<io.agentscope.core.model.ToolSchema>convertToToolSchemas(List<OpenAITool> tools) Converts a list of OpenAI tools to AgentScope ToolSchemas.
-
Constructor Details
-
OpenAIToolConverter
public OpenAIToolConverter()
-
-
Method Details
-
convertToToolSchemas
Converts a list of OpenAI tools to AgentScope ToolSchemas.Only tools with type "function" are converted. Other tool types are skipped with a warning.
- Parameters:
tools- The list of OpenAI tools to convert (may be null or empty)- Returns:
- A list of converted ToolSchema objects; returns an empty list if input is null or empty
-
convertToToolSchema
Converts a single OpenAI tool to a ToolSchema.- Parameters:
tool- The OpenAI tool to convert- Returns:
- The converted ToolSchema, or null if conversion fails
-