Record Class AnthropicApi.CitationResponse

java.lang.Object
java.lang.Record
org.springframework.ai.anthropic.api.AnthropicApi.CitationResponse
Record Components:
type - The citation location type ("char_location", "page_location", or "content_block_location")
citedText - The text that was cited from the document
documentIndex - The index of the document that was cited (0-based)
documentTitle - The title of the document that was cited
startCharIndex - The starting character index for "char_location" type (0-based, inclusive)
endCharIndex - The ending character index for "char_location" type (exclusive)
startPageNumber - The starting page number for "page_location" type (1-based, inclusive)
endPageNumber - The ending page number for "page_location" type (exclusive)
startBlockIndex - The starting content block index for "content_block_location" type (0-based, inclusive)
endBlockIndex - The ending content block index for "content_block_location" type (exclusive)
Enclosing class:
AnthropicApi

public static record AnthropicApi.CitationResponse(String type, String citedText, Integer documentIndex, String documentTitle, Integer startCharIndex, Integer endCharIndex, Integer startPageNumber, Integer endPageNumber, Integer startBlockIndex, Integer endBlockIndex) extends Record
Citation response structure from Anthropic API. Maps to the actual API response format for citations. Contains location information that varies by document type: character indices for plain text, page numbers for PDFs, or content block indices for custom content.
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 Details

    • CitationResponse

      public CitationResponse(String type, String citedText, Integer documentIndex, String documentTitle, Integer startCharIndex, Integer endCharIndex, Integer startPageNumber, Integer endPageNumber, Integer startBlockIndex, Integer endBlockIndex)
      Creates an instance of a CitationResponse record class.
      Parameters:
      type - the value for the type record component
      citedText - the value for the citedText record component
      documentIndex - the value for the documentIndex record component
      documentTitle - the value for the documentTitle record component
      startCharIndex - the value for the startCharIndex record component
      endCharIndex - the value for the endCharIndex record component
      startPageNumber - the value for the startPageNumber record component
      endPageNumber - the value for the endPageNumber record component
      startBlockIndex - the value for the startBlockIndex record component
      endBlockIndex - the value for the endBlockIndex 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.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • citedText

      public String citedText()
      Returns the value of the citedText record component.
      Returns:
      the value of the citedText record component
    • documentIndex

      public Integer documentIndex()
      Returns the value of the documentIndex record component.
      Returns:
      the value of the documentIndex record component
    • documentTitle

      public String documentTitle()
      Returns the value of the documentTitle record component.
      Returns:
      the value of the documentTitle record component
    • startCharIndex

      public Integer startCharIndex()
      Returns the value of the startCharIndex record component.
      Returns:
      the value of the startCharIndex record component
    • endCharIndex

      public Integer endCharIndex()
      Returns the value of the endCharIndex record component.
      Returns:
      the value of the endCharIndex record component
    • startPageNumber

      public Integer startPageNumber()
      Returns the value of the startPageNumber record component.
      Returns:
      the value of the startPageNumber record component
    • endPageNumber

      public Integer endPageNumber()
      Returns the value of the endPageNumber record component.
      Returns:
      the value of the endPageNumber record component
    • startBlockIndex

      public Integer startBlockIndex()
      Returns the value of the startBlockIndex record component.
      Returns:
      the value of the startBlockIndex record component
    • endBlockIndex

      public Integer endBlockIndex()
      Returns the value of the endBlockIndex record component.
      Returns:
      the value of the endBlockIndex record component