Class DefaultContent

  • All Implemented Interfaces:
    dev.langchain4j.rag.content.Content

    
    public final class DefaultContent
    extends Record implements Content
                        

    A default implementation of a Content. The class includes optional metadata which can store additional information about the content. This metadata is supplementary and is intentionally excluded from equality and hash calculations. See equals and hashCode for details.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      boolean equals(Object o) Compares this Content with another object for equality.
      int hashCode() Computes the hash code for this Content.
      • Methods inherited from class java.lang.Record

        toString
      • Methods inherited from class dev.langchain4j.rag.content.Content

        from, from, from, metadata, textSegment
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • equals

         boolean equals(Object o)

        Compares this Content with another object for equality. The metadata field is intentionally excluded from the equality check. Metadata is considered supplementary information and does not contribute to the core identity of the Content.

      • hashCode

         int hashCode()

        Computes the hash code for this Content. The metadata field is excluded from the hash code calculation. This ensures that two logically identical Content objects with differing metadata produce the same hash code, maintaining consistent behavior in hash-based collections.