AS AgentScopeAPI 手册 / API Reference

OpenAIToolFunction

@JsonInclude(JsonInclude.Include.NON_NULL) public class OpenAIToolFunction
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:42–95

OpenAI 工具函数,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.chat.completions.model 包。核心成员包括 getName、setName、getDescription、setDescription、getParameters、setParameters。

OpenAI tool function definition for Chat Completions API requests.

This class represents the function definition in a tool, following OpenAI's format.

Example:

`{
"name": "get_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
`

构造器摘要Constructor Summary

构造器Constructor说明Description
public OpenAIToolFunction()
初始化 `OpenAIToolFunction` 实例。
Default constructor for deserialization.

方法摘要Method Summary

方法Method说明Description
public String getName()
获取名称。
Returns the name.
public void setName(String name)
设置名称。
Sets the name.
public String getDescription()
获取 `getDescription`。
Returns the description.
public void setDescription(String description)
设置 `setDescription`。
Sets the description.
public Map<String, Object> getParameters()
获取参数。
Returns the parameters.
public void setParameters(Map<String, Object> parameters)
设置参数。
Sets the parameters.
public Boolean getStrict()
获取 `getStrict`。
Returns the strict.
public void setStrict(Boolean strict)
设置 `setStrict`。
Sets the strict.

构造器详情Constructor Detail

OpenAIToolFunction

public OpenAIToolFunction()

初始化 OpenAIToolFunction 实例。

Default constructor for deserialization.

源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:62

方法详情Method Detail

getName

public String getName()

获取名称。

Returns the name.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:64–66

setName

public void setName(String name)

设置名称。

Sets the name.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:68–70

getDescription

public String getDescription()

获取 getDescription。

Returns the description.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:72–74

setDescription

public void setDescription(String description)

设置 setDescription。

Sets the description.

参数Parameters
名称Name类型Type说明Description
descriptionString描述(类型 `String`)。The description.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:76–78

getParameters

public Map<String, Object> getParameters()

获取参数。

Returns the parameters.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:80–82

setParameters

public void setParameters(Map<String, Object> parameters)

设置参数。

Sets the parameters.

参数Parameters
名称Name类型Type说明Description
parametersMap<String, Object>参数(类型 `Map`)。The parameters.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:84–86

getStrict

public Boolean getStrict()

获取 getStrict。

Returns the strict.

返回Returns Boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:88–90

setStrict

public void setStrict(Boolean strict)

设置 setStrict。

Sets the strict.

参数Parameters
名称Name类型Type说明Description
strictBooleanstrict(类型 `Boolean`)。The strict.
源码Source io/agentscope/core/chat/completions/model/OpenAIToolFunction.java:92–94
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.