Record Class AnthropicApi.AnthropicMessage
java.lang.Object
java.lang.Record
org.springframework.ai.anthropic.api.AnthropicApi.AnthropicMessage
- Record Components:
content- The contents of the message. Can be of one of String or MultiModalContent.role- The role of the messages author. Could be one of theAnthropicApi.Roletypes.
- Enclosing class:
AnthropicApi
public static record AnthropicApi.AnthropicMessage(List<AnthropicApi.ContentBlock> content, AnthropicApi.Role role)
extends Record
Input messages.
Our models are trained to operate on alternating user and assistant conversational
turns. When creating a new Message, you specify the prior conversational turns with
the messages parameter, and the model then generates the next Message in the
conversation. Each input message must be an object with a role and content. You can
specify a single user-role message, or you can include multiple user and assistant
messages. The first message must always use the user role. If the final message
uses the assistant role, the response content will continue immediately from the
content in that message. This can be used to constrain part of the model's
response.
- 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
-
Constructor Summary
ConstructorsConstructorDescriptionAnthropicMessage(List<AnthropicApi.ContentBlock> content, AnthropicApi.Role role) Creates an instance of aAnthropicMessagerecord 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.role()Returns the value of therolerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
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). -
content
-
role
-