Class VectorRAGStrategy

java.lang.Object
com.tnsai.intelligence.rag.VectorRAGStrategy
All Implemented Interfaces:
RAGStrategy

public final class VectorRAGStrategy extends Object implements 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 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

      public String name()
      Description copied from interface: RAGStrategy
      Returns the unique name of this strategy (e.g., "vector", "keyword", "hybrid").

      Names are compared case-insensitively using Locale.ROOT.

      Specified by:
      name in interface RAGStrategy
      Returns:
      the strategy name, never null
    • retrieve

      public List<RetrievedDocument> retrieve(String query, RAGContext context)
      Description copied from interface: RAGStrategy
      Retrieves 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:
      retrieve in interface RAGStrategy
      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