Builder
public static class Builder
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:217–270构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 role、content、name、toolCallId、toolCalls、reasoningContent。
A class in io.agentscope.extensions.model.openai.dto that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.openai.dto.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder role(String role) | 设置角色。 Performs the role operation. |
public Builder content(String content) | 设置内容。 Performs the content operation. |
public Builder content(List<OpenAIContentPart> content) | 设置内容。 Performs the content operation. |
public Builder name(String name) | 设置名称。 Performs the name operation. |
public Builder toolCallId(String toolCallId) | 设置工具调用标识。 Performs the tool call id operation. |
public Builder toolCalls(List<OpenAIToolCall> toolCalls) | 设置工具调用。 Performs the tool calls operation. |
public Builder reasoningContent(String reasoningContent) | 设置推理内容。 Performs the reasoning content operation. |
public Builder reasoningDetails(List<OpenAIReasoningDetail> reasoningDetails) | 设置推理详情。 Performs the reasoning details operation. |
public Builder refusal(String refusal) | 设置拒答。 Performs the refusal operation. |
public OpenAIMessage build() | 构建并返回最终实例。 Creates and returns an instance. |
方法详情Method Detail
role
public Builder role(String role)
设置角色。
Performs the role operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
role | String | 角色(类型 `String`)。The role. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:220–223content
public Builder content(String content)
设置内容。
Performs the content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
content | String | 内容(类型 `String`)。The content. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:225–228content
public Builder content(List<OpenAIContentPart> content)
设置内容。
Performs the content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
content | List<OpenAIContentPart> | 内容(类型 `List`)。The content. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:230–233name
public Builder name(String name)
设置名称。
Performs the name operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:235–238toolCallId
public Builder toolCallId(String toolCallId)
设置工具调用标识。
Performs the tool call id operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:240–243toolCalls
public Builder toolCalls(List<OpenAIToolCall> toolCalls)
设置工具调用。
Performs the tool calls operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCalls | List<OpenAIToolCall> | 工具调用(类型 `List`)。The tool calls. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:245–248reasoningContent
public Builder reasoningContent(String reasoningContent)
设置推理内容。
Performs the reasoning content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reasoningContent | String | 推理内容(类型 `String`)。The reasoning content. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:250–253reasoningDetails
public Builder reasoningDetails(List<OpenAIReasoningDetail> reasoningDetails)
设置推理详情。
Performs the reasoning details operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reasoningDetails | List<OpenAIReasoningDetail> | 推理详情(类型 `List`)。The reasoning details. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:255–258refusal
public Builder refusal(String refusal)
设置拒答。
Performs the refusal operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
refusal | String | 拒答(类型 `String`)。The refusal. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:260–263build
public OpenAIMessage build()
构建并返回最终实例。
Creates and returns an instance.
OpenAIMessage返回OpenAIMessage。Returns OpenAI message.
源码Source
io/agentscope/extensions/model/openai/dto/OpenAIMessage.java:265–269