Table of Contents

Interface IRetrievalStrategy

Namespace
Mythosia.AI.Rag
Assembly
Mythosia.AI.Rag.Abstractions.dll

Defines a retrieval strategy for the RAG pipeline. Implementations decide how to fetch relevant documents (pure vector, hybrid BM25+vector, etc.). This is an orchestration-layer abstraction โ€” it uses IVectorStore internally but is not part of the storage contract.

public interface IRetrievalStrategy

Methods

RetrieveAsync(float[], string?, int, VectorFilter?, CancellationToken)

Retrieves the most relevant documents for the given query.

Task<IReadOnlyList<VectorSearchResult>> RetrieveAsync(float[] denseVector, string? query, int topK, VectorFilter? filter = null, CancellationToken cancellationToken = default)

Parameters

denseVector float[]

The dense embedding vector for the query.

query string

The text query for keyword-based retrieval. When null, keyword search is skipped and only dense vector search is performed.

topK int

Maximum number of results to return.

filter VectorFilter

Optional filter criteria.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<VectorSearchResult>>

Results ordered by relevance score (descending).