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
ConstructorsConstructorDescriptionChatCompletionResponse(String id, String type, AnthropicApi.Role role, List<AnthropicApi.ContentBlock> content, String model, String stopReason, String stopSequence, AnthropicApi.Usage usage) Creates an instance of aChatCompletionResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.model()Returns the value of themodelrecord component.role()Returns the value of therolerecord component.Returns the value of thestopReasonrecord component.Returns the value of thestopSequencerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.usage()Returns the value of theusagerecord 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 aChatCompletionResponserecord class.- Parameters:
id- the value for theidrecord componenttype- the value for thetyperecord componentrole- the value for therolerecord componentcontent- the value for thecontentrecord componentmodel- the value for themodelrecord componentstopReason- the value for thestopReasonrecord componentstopSequence- the value for thestopSequencerecord componentusage- the value for theusagerecord 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 theidrecord component.- Returns:
- the value of the
idrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
role
Returns the value of therolerecord component.- Returns:
- the value of the
rolerecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
stopReason
Returns the value of thestopReasonrecord component.- Returns:
- the value of the
stopReasonrecord component
-
stopSequence
Returns the value of thestopSequencerecord component.- Returns:
- the value of the
stopSequencerecord component
-
usage
Returns the value of theusagerecord component.- Returns:
- the value of the
usagerecord component
-