类 ChatResponse
java.lang.Object
io.agentscope.core.model.ChatResponse
Represents a chat completion response from a language model.
This immutable data class contains the response content, usage information, and optional metadata returned by the model after processing a chat request.
-
嵌套类概要
嵌套类 -
构造器概要
构造器构造器说明ChatResponse(String id, List<ContentBlock> content, ChatUsage usage, Map<String, Object> metadata, String finishReason) Creates a new ChatResponse instance. -
方法概要
修饰符和类型方法说明static ChatResponse.Builderbuilder()Creates a new builder for ChatResponse.Gets the content blocks containing the response content.Gets the reason the model stopped generating tokens.getId()Gets the unique identifier for this response.Gets the metadata from the model provider.getUsage()Gets the token usage information for this response.Creates a new instance of ChatResponse with the specified ID, copying all other fields from this instance.
-
构造器详细资料
-
ChatResponse
public ChatResponse(String id, List<ContentBlock> content, ChatUsage usage, Map<String, Object> metadata, String finishReason) Creates a new ChatResponse instance.- 参数:
id- the unique identifier for this responsecontent- the list of content blocks containing the response contentusage- the token usage information for this responsemetadata- additional metadata from the model providerfinishReason- the reason for
-
-
方法详细资料
-
getId
Gets the unique identifier for this response.- 返回:
- the response identifier
-
getContent
Gets the content blocks containing the response content.- 返回:
- the list of content blocks
-
getUsage
Gets the token usage information for this response.- 返回:
- the usage information
-
getMetadata
Gets the metadata from the model provider.- 返回:
- the metadata map
-
getFinishReason
Gets the reason the model stopped generating tokens.- 返回:
- the finish reason
-
withId
Creates a new instance of ChatResponse with the specified ID, copying all other fields from this instance.- 参数:
newId- the new identifier- 返回:
- a new ChatResponse instance
-
builder
Creates a new builder for ChatResponse.- 返回:
- a new Builder instance
-