Package com.tnsai.intelligence.rag
Class VectorRAGStrategy
java.lang.Object
com.tnsai.intelligence.rag.VectorRAGStrategy
- All Implemented Interfaces:
RAGStrategy
RAG strategy that uses embedding-based semantic similarity search.
Delegates to VectorMemoryStore from tnsai-core's advanced
memory module. Results are converted to RetrievedDocument
instances and filtered by the RAGContext.minScore() threshold and
exact RAGContext.metadataFilters() matches.
- Since:
- 0.2.4
-
Constructor Summary
ConstructorsConstructorDescriptionVectorRAGStrategy(com.tnsai.memory.advanced.VectorMemoryStore vectorStore) Creates a vector RAG strategy backed by the given store. -
Method Summary
Modifier and TypeMethodDescriptionname()Returns the unique name of this strategy (e.g., "vector", "keyword", "hybrid").retrieve(String query, RAGContext context) Retrieves documents relevant to the given query.
-
Constructor Details
-
VectorRAGStrategy
public VectorRAGStrategy(com.tnsai.memory.advanced.VectorMemoryStore vectorStore) Creates a vector RAG strategy backed by the given store.- Parameters:
vectorStore- the vector memory store to search
-
-
Method Details
-
name
Description copied from interface:RAGStrategyReturns the unique name of this strategy (e.g., "vector", "keyword", "hybrid").Names are compared case-insensitively using
Locale.ROOT.- Specified by:
namein interfaceRAGStrategy- Returns:
- the strategy name, never null
-
retrieve
Description copied from interface:RAGStrategyRetrieves documents relevant to the given query.Every returned document must exactly match all metadata filters in the context. Implementations apply that constraint before limiting the result to
RAGContext.maxResults().- Specified by:
retrievein interfaceRAGStrategy- Parameters:
query- the search query (never null)context- retrieval parameters (max results, min score, exact metadata filters)- Returns:
- an unmodifiable list of retrieved documents, sorted by descending relevance
-