类 ChatResponse.Builder
java.lang.Object
io.agentscope.core.model.ChatResponse.Builder
- 封闭类:
ChatResponse
Builder for creating ChatResponse instances.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明build()Builds a new ChatResponse instance with the set values.content(List<ContentBlock> content) Sets the content blocks for the response.finishReason(String finishReason) Sets the finish reason for the response.Sets the response identifier.Sets the metadata for the response.Sets the usage information for the response.
-
构造器详细资料
-
Builder
public Builder()
-
-
方法详细资料
-
id
Sets the response identifier.- 参数:
id- the unique identifier for this response- 返回:
- this builder instance
-
content
Sets the content blocks for the response.- 参数:
content- the list of content blocks containing the response content- 返回:
- this builder instance
-
usage
Sets the usage information for the response.- 参数:
usage- the token usage information- 返回:
- this builder instance
-
metadata
Sets the metadata for the response.- 参数:
metadata- additional metadata from the model provider- 返回:
- this builder instance
-
finishReason
Sets the finish reason for the response.- 参数:
finishReason- the finish reason sent by the model provider- 返回:
- this builder instance
-
build
Builds a new ChatResponse instance with the set values.If no id was set (or is empty/blank), a random UUID will be generated automatically. This ensures compatibility with LLM providers (like Ollama) that don't return an id field in their API responses.
- 返回:
- a new ChatResponse instance
-