Record Class OpaquePayload

java.lang.Object
java.lang.Record
org.springframework.ai.chat.messages.part.OpaquePayload
Record Components:
provider - the provider that produced the payload, for example anthropic, openai, google, bedrock
kind - the provider's own name for the payload, for example signature, encrypted_content, thought_signature, redacted_thinking
data - the payload, always a string

public record OpaquePayload(String provider, String kind, String data) extends Record
Provider-owned data attached to a MessagePart (or to a ReasoningPart) that Spring AI never interprets and that must be sent back unchanged to the provider that produced it.

Examples: an Anthropic thinking signature, an OpenAI Responses encrypted_content, a Gemini thought_signature carried on a function call. Binary payloads are base64-encoded by the adapter that produced them so that data is always a plain string.

Since:
2.1.0
Author:
Christian Tzolov
  • Constructor Details

    • OpaquePayload

      public OpaquePayload(String provider, String kind, String data)
      Creates an instance of a OpaquePayload record class.
      Parameters:
      provider - the value for the provider record component
      kind - the value for the kind record component
      data - the value for the data record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • provider

      public String provider()
      Returns the value of the provider record component.
      Returns:
      the value of the provider record component
    • kind

      public String kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • data

      public String data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component