Package dev.langchain4j.rag.content
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:
textSegment
in interfaceContent
-
metadata
-
equals
Compares thisContent
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
public int hashCode()Computes the hash code for thisContent
.
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. -
toString
-