Record Class UnknownPart
java.lang.Object
java.lang.Record
org.springframework.ai.chat.messages.part.UnknownPart
- Record Components:
provider- who produced the partkind- the producer's own discriminator, for exampleserver_tool_userawJson- the part exactly as receivedpayload- provider data to replay with this part, ornullattributes- free-form attributes, copied and unmodifiable
- All Implemented Interfaces:
MessagePart
public record UnknownPart(String provider, String kind, String rawJson, @Nullable OpaquePayload payload, Map<String,String> attributes)
extends Record
implements MessagePart
A part that neither an adapter nor this version of Spring AI recognizes, kept verbatim
so nothing is silently dropped.
Two things produce an unknown part: a provider adapter that meets a response block it
does not model (a citation, a server tool result, a future block type), and
deserialization of a part whose type was written by a newer Spring AI version.
In the second case provider is SPRING_AI_PROVIDER, so no adapter
mistakes it for one of its own blocks. An unknown part is only ever replayed to the
provider named in provider.
- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTheproviderof an unknown part produced by deserializing atypethis version does not know. -
Constructor Summary
ConstructorsConstructorDescriptionUnknownPart(String provider, String kind, String rawJson, @Nullable OpaquePayload payload, Map<String, String> attributes) Creates an instance of aUnknownPartrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.@Nullable OpaquePayloadpayload()Returns the value of thepayloadrecord component.provider()Returns the value of theproviderrecord component.rawJson()Returns the value of therawJsonrecord component.final StringtoString()Returns a string representation of this record class.withAttributes(Map<String, String> attributes) Returns a copy of this part with the given attributes replacing the current ones.
-
Field Details
-
SPRING_AI_PROVIDER
Theproviderof an unknown part produced by deserializing atypethis version does not know.- See Also:
-
-
Constructor Details
-
UnknownPart
public UnknownPart(String provider, String kind, String rawJson, @Nullable OpaquePayload payload, Map<String, String> attributes) Creates an instance of aUnknownPartrecord class.- Parameters:
provider- the value for theproviderrecord componentkind- the value for thekindrecord componentrawJson- the value for therawJsonrecord componentpayload- the value for thepayloadrecord componentattributes- the value for theattributesrecord component
-
-
Method Details
-
withAttributes
Description copied from interface:MessagePartReturns a copy of this part with the given attributes replacing the current ones. All other components are unchanged.- Specified by:
withAttributesin interfaceMessagePart- Parameters:
attributes- the new attributes, copied- Returns:
- the copy
-
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). -
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
rawJson
Returns the value of therawJsonrecord component.- Returns:
- the value of the
rawJsonrecord component
-
payload
Returns the value of thepayloadrecord component.- Specified by:
payloadin interfaceMessagePart- Returns:
- the value of the
payloadrecord component
-
attributes
Returns the value of theattributesrecord component.- Specified by:
attributesin interfaceMessagePart- Returns:
- the value of the
attributesrecord component
-