Class DefaultContent
java.lang.Object
dev.langchain4j.rag.content.DefaultContent
- All Implemented Interfaces:
Content
A default implementation of a
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
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(Object) and hashCode() for details.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultContent(TextSegment textSegment) DefaultContent(TextSegment textSegment, Map<ContentMetadata, Object> metadata) DefaultContent(String text) -
Method Summary
-
Constructor Details
-
DefaultContent
-
DefaultContent
-
DefaultContent
-
-
Method Details
-
textSegment
- Specified by:
textSegmentin interfaceContent
-
metadata
-
equals
Compares thisContentwith another object for equality.
Themetadatafield is intentionally excluded from the equality check. Metadata is considered supplementary information and does not contribute to the core identity of theContent. -
hashCode
public int hashCode()Computes the hash code for thisContent.
Themetadatafield is excluded from the hash code calculation. This ensures that two logically identicalContentobjects with differing metadata produce the same hash code, maintaining consistent behavior in hash-based collections. -
toString
-