Package com.tnsai.intelligence.rag
Record Class RAGContext
java.lang.Object
java.lang.Record
com.tnsai.intelligence.rag.RAGContext
- Record Components:
maxResults- maximum number of documents to retrieve (must be positive)minScore- minimum relevance score threshold; documents below this are discardedmetadataFilters- exact key-value constraints on retrieved-document metadata (empty = no filtering)
public record RAGContext(int maxResults, double minScore, Map<String,String> metadataFilters)
extends Record
Configuration context for a RAG retrieval request.
Provides the maximum number of results, minimum relevance score
threshold, and optional metadata filters that strategies use to
narrow the result set. A document matches when its metadata contains an
exactly equal value for every filter entry. Missing keys do not match, and
filtering is applied before maxResults.
- Since:
- 0.2.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum results when not specified.static final doubleDefault minimum score (no threshold). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a context with defaults (10 results, no score threshold, no filters).RAGContext(int maxResults) Creates a context with a specific max results count.RAGContext(int maxResults, double minScore, Map<String, String> metadataFilters) Canonical constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxResultsrecord component.Returns the value of themetadataFiltersrecord component.doubleminScore()Returns the value of theminScorerecord component.final StringtoString()Returns a string representation of this record class.withMaxResults(int maxResults) Returns a new context with an updated max results value.withMetadataFilters(Map<String, String> filters) Returns a new context with the given metadata filters.withMinScore(double minScore) Returns a new context with an updated minimum score threshold.
-
Field Details
-
DEFAULT_MAX_RESULTS
public static final int DEFAULT_MAX_RESULTSDefault maximum results when not specified.- See Also:
-
DEFAULT_MIN_SCORE
public static final double DEFAULT_MIN_SCOREDefault minimum score (no threshold).- See Also:
-
-
Constructor Details
-
RAGContext
Canonical constructor with validation. -
RAGContext
public RAGContext()Creates a context with defaults (10 results, no score threshold, no filters). -
RAGContext
public RAGContext(int maxResults) Creates a context with a specific max results count.- Parameters:
maxResults- maximum number of documents to retrieve
-
-
Method Details
-
withMaxResults
Returns a new context with an updated max results value.- Parameters:
maxResults- the new maximum results count- Returns:
- a new RAGContext with the updated value
-
withMinScore
Returns a new context with an updated minimum score threshold.- Parameters:
minScore- the new minimum score- Returns:
- a new RAGContext with the updated value
-
withMetadataFilters
Returns a new context with the given metadata filters.- Parameters:
filters- the metadata filters- Returns:
- a new RAGContext with the updated filters
-
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 '=='. -
maxResults
public int maxResults()Returns the value of themaxResultsrecord component.- Returns:
- the value of the
maxResultsrecord component
-
minScore
public double minScore()Returns the value of theminScorerecord component.- Returns:
- the value of the
minScorerecord component
-
metadataFilters
Returns the value of themetadataFiltersrecord component.- Returns:
- the value of the
metadataFiltersrecord component
-