OpenAITool
@JsonInclude(JsonInclude.Include.NON_NULL) public class OpenAITool
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:44–82OpenAI 工具,封装可被智能体调用的能力。位于 io.agentscope.core.chat.completions.model 包。核心成员包括 getType、setType、getFunction、setFunction、OpenAITool。
OpenAI tool definition for Chat Completions API requests.
This class represents a tool that can be called by the model, following OpenAI's format.
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` 实例。 Default constructor for deserialization. |
public OpenAITool(OpenAIToolFunction function) | 初始化 `OpenAITool` 实例。 Creates a new OpenAITool with the specified function. |
方法摘要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. |
构造器详情Constructor Detail
OpenAITool
public OpenAITool()
初始化 OpenAITool 实例。
Default constructor for deserialization.
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:56OpenAITool
public OpenAITool(OpenAIToolFunction function)
初始化 OpenAITool 实例。
Creates a new OpenAITool with the specified function.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
function | OpenAIToolFunction | 函数定义。The function definition |
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:63–65方法详情Method Detail
getType
public String getType()
获取类型。
Returns the type.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:67–69setType
public void setType(String type)
设置类型。
Sets the type.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | String | 类型(类型 `String`)。The type. |
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:71–73getFunction
public OpenAIToolFunction getFunction()
获取函数。
Returns the function.
OpenAIToolFunction返回OpenAIToolFunction。Returns OpenAI tool function.
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:75–77setFunction
public void setFunction(OpenAIToolFunction function)
设置函数。
Sets the function.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
function | OpenAIToolFunction | 函数(类型 `OpenAIToolFunction`)。The function. |
源码Source
io/agentscope/core/chat/completions/model/OpenAITool.java:79–81