Record Class AnthropicApi.ChatCompletionResponse
java.lang.Object
java.lang.Record
org.springframework.ai.anthropic.api.AnthropicApi.ChatCompletionResponse
- Record Components:
id
- Unique object identifier. The format and length of IDs may change over time.type
- Object type. For Messages, this is always "message".role
- Conversational role of the generated message. This will always be "assistant".content
- Content generated by the model. This is an array of content blocks.model
- The model that handled the request.stopReason
- The reason the model stopped generating tokens. This will be one of "end_turn", "max_tokens", "stop_sequence", "tool_use", or "timeout".stopSequence
- Which custom stop sequence was generated, if any.usage
- Input and output token usage.
- Enclosing class:
- AnthropicApi
public static record AnthropicApi.ChatCompletionResponse(String id, String type, AnthropicApi.Role role, List<AnthropicApi.ContentBlock> content, String model, String stopReason, String stopSequence, AnthropicApi.Usage usage)
extends Record
Chat completion response object.
-
Constructor Summary
ConstructorDescriptionChatCompletionResponse
(String id, String type, AnthropicApi.Role role, List<AnthropicApi.ContentBlock> content, String model, String stopReason, String stopSequence, AnthropicApi.Usage usage) Creates an instance of aChatCompletionResponse
record class. -
Method Summary
Modifier and TypeMethodDescriptioncontent()
Returns the value of thecontent
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.model()
Returns the value of themodel
record component.role()
Returns the value of therole
record component.Returns the value of thestopReason
record component.Returns the value of thestopSequence
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.usage()
Returns the value of theusage
record component.
-
Constructor Details
-
ChatCompletionResponse
public ChatCompletionResponse(String id, String type, AnthropicApi.Role role, List<AnthropicApi.ContentBlock> content, String model, String stopReason, String stopSequence, AnthropicApi.Usage usage) Creates an instance of aChatCompletionResponse
record class.- Parameters:
id
- the value for theid
record componenttype
- the value for thetype
record componentrole
- the value for therole
record componentcontent
- the value for thecontent
record componentmodel
- the value for themodel
record componentstopReason
- the value for thestopReason
record componentstopSequence
- the value for thestopSequence
record componentusage
- the value for theusage
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
id
Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
role
Returns the value of therole
record component.- Returns:
- the value of the
role
record component
-
content
Returns the value of thecontent
record component.- Returns:
- the value of the
content
record component
-
model
Returns the value of themodel
record component.- Returns:
- the value of the
model
record component
-
stopReason
Returns the value of thestopReason
record component.- Returns:
- the value of the
stopReason
record component
-
stopSequence
Returns the value of thestopSequence
record component.- Returns:
- the value of the
stopSequence
record component
-
usage
Returns the value of theusage
record component.- Returns:
- the value of the
usage
record component
-