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.
-
-
Constructor Summary
Constructors Constructor Description DefaultContent(TextSegment textSegment, Map<ContentMetadata, Object> metadata)
DefaultContent(String text)
DefaultContent(TextSegment textSegment)
-
Method Summary
-
-
Constructor Detail
-
DefaultContent
DefaultContent(TextSegment textSegment, Map<ContentMetadata, Object> metadata)
-
DefaultContent
DefaultContent(String text)
-
DefaultContent
DefaultContent(TextSegment textSegment)
-
-
Method Detail
-
equals
boolean equals(Object o)
Compares this
Content
with another object for equality. Themetadata
field is intentionally excluded from the equality check. Metadata is considered supplementary information and does not contribute to the core identity of theContent
.
-
hashCode
int hashCode()
Computes the hash code for this
Content
. Themetadata
field is excluded from the hash code calculation. This ensures that two logically identicalContent
objects with differing metadata produce the same hash code, maintaining consistent behavior in hash-based collections.
-
-
-
-