Package com.tnsai.intelligence.rag
Record Class RetrievedDocument
java.lang.Object
java.lang.Record
com.tnsai.intelligence.rag.RetrievedDocument
- Record Components:
content- the retrieved text contentsource- identifier for the document source (URI, file path, entry ID, etc.)score- relevance score (higher is more relevant); semantics depend on the strategymetadata- arbitrary key-value metadata (e.g., chunk index, tier, session ID)
public record RetrievedDocument(String content, String source, double score, Map<String,String> metadata)
extends Record
A document retrieved by a
RAGStrategy.
Holds the content, source identifier, relevance score, and arbitrary metadata. Instances are immutable and safe to share across threads.
- Since:
- 0.2.4
-
Constructor Summary
ConstructorsConstructorDescriptionRetrievedDocument(String content, String source, double score) Convenience constructor without metadata.Canonical constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.doublescore()Returns the value of thescorerecord component.source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RetrievedDocument
Canonical constructor with validation. -
RetrievedDocument
Convenience constructor without metadata.- Parameters:
content- the retrieved text contentsource- identifier for the document sourcescore- relevance score
-
-
Method Details
-
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. -
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. -
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
score
public double score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-