OpenAITool
@JsonInclude(JsonInclude.Include.NON_NULL) public class OpenAITool
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:44–86OpenAI 工具,封装可被智能体调用的能力。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 getType、setType、getFunction、setFunction、function、OpenAITool。
OpenAI tool definition DTO.
This class represents a tool that can be called by the model.
Example:
`{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
}
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public OpenAITool() | 初始化 `OpenAITool` 实例。 Creates a new instance. |
public OpenAITool(OpenAIToolFunction function) | 初始化 `OpenAITool` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getType() | 获取类型。 Returns the type. |
public void setType(String type) | 设置类型。 Sets the type. |
public OpenAIToolFunction getFunction() | 获取函数。 Returns the function. |
public void setFunction(OpenAIToolFunction function) | 设置函数。 Sets the function. |
public static OpenAITool function(OpenAIToolFunction function)static | 创建函数工具。 Create a function tool. |
构造器详情Constructor Detail
OpenAITool
public OpenAITool()
初始化 OpenAITool 实例。
Creates a new instance.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:55OpenAITool
public OpenAITool(OpenAIToolFunction function)
初始化 OpenAITool 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
function | OpenAIToolFunction | 函数(类型 `OpenAIToolFunction`)。The function. |
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:57–59方法详情Method Detail
getType
public String getType()
获取类型。
Returns the type.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:61–63setType
public void setType(String type)
设置类型。
Sets the type.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | String | 类型(类型 `String`)。The type. |
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:65–67getFunction
public OpenAIToolFunction getFunction()
获取函数。
Returns the function.
OpenAIToolFunction返回OpenAIToolFunction。Returns OpenAI tool function.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:69–71setFunction
public void setFunction(OpenAIToolFunction function)
设置函数。
Sets the function.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
function | OpenAIToolFunction | 函数(类型 `OpenAIToolFunction`)。The function. |
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:73–75function
public static OpenAITool function(OpenAIToolFunction function)
static
创建函数工具。
Create a function tool.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
function | OpenAIToolFunction | 函数定义。the function definition |
OpenAITool一种新的OpenAITool。a new OpenAITool
源码Source
io/agentscope/extensions/model/openai/dto/OpenAITool.java:83–85