Builder
public static class Builder
源码Source
io/agentscope/core/model/ChatResponse.java:127–206构建器,用于构建并配置目标实例。位于 io.agentscope.core.model 包。核心成员包括 id、content、usage、metadata、finishReason、build。
Builder for creating ChatResponse instances.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder id(String id) | 设置标识。 Sets the response identifier. |
public Builder content(List<ContentBlock> content) | 设置内容。 Sets the content blocks for the response. |
public Builder usage(ChatUsage usage) | 设置用量。 Sets the usage information for the response. |
public Builder metadata(Map<String, Object> metadata) | 设置元数据用于响应。 Sets the metadata for the response. |
public Builder finishReason(String finishReason) | 设置该配置项。 Sets the finish reason for the response. |
public ChatResponse build() | 构建新的ChatResponse 实例使用设置值。 Builds a new ChatResponse instance with the set values. |
方法详情Method Detail
id
public Builder id(String id)
设置标识。
Sets the response identifier.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。the unique identifier for this response |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ChatResponse.java:140–143content
public Builder content(List<ContentBlock> content)
设置内容。
Sets the content blocks for the response.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
content | List<ContentBlock> | 内容(类型 `List`)。the list of content blocks containing the response content |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ChatResponse.java:151–154usage
public Builder usage(ChatUsage usage)
设置用量。
Sets the usage information for the response.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
usage | ChatUsage | 用量(类型 `ChatUsage`)。the token usage information |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ChatResponse.java:162–165metadata
public Builder metadata(Map<String, Object> metadata)
设置元数据用于响应。
Sets the metadata for the response.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadata | Map<String, Object> | 元数据(类型 `Map`)。additional metadata from the model provider |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ChatResponse.java:173–176finishReason
public Builder finishReason(String finishReason)
设置该配置项。
Sets the finish reason for the response.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
finishReason | String | finish 推理(类型 `String`)。the finish reason sent by the model provider |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ChatResponse.java:184–187build
public ChatResponse build()
构建新的ChatResponse 实例使用设置值。
Builds a new ChatResponse instance with the set values.
ChatResponse一种新的ChatResponse 实例。a new ChatResponse instance
源码Source
io/agentscope/core/model/ChatResponse.java:198–205