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, AnthropicApi.ChatCompletionResponse.Container container)
extends Record
Chat completion response object.
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Mariusz Bernacki, Thomas Vitale, Jihoon Kim, Alexandros Pappas, Jonghoon Park, Claudio Silva Junior, Filip Hrisafov, Soby Chacko, Austin Dase
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordContainer information for Skills execution context. -
Constructor Summary
ConstructorsConstructorDescriptionChatCompletionResponse(String id, String type, AnthropicApi.Role role, List<AnthropicApi.ContentBlock> content, String model, String stopReason, String stopSequence, AnthropicApi.Usage usage, AnthropicApi.ChatCompletionResponse.Container container) Creates an instance of aChatCompletionResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontainerrecord component.content()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, AnthropicApi.ChatCompletionResponse.Container container) 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 componentcontainer- the value for thecontainerrecord component
-
-
Method Details
-
toString
-
hashCode
-
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
-
type
-
role
-
content
-
model
-
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
-
container
Returns the value of thecontainerrecord component.- Returns:
- the value of the
containerrecord component
-