RetrievalManager class
Enhanced Retrieval manager with improved RAG capabilities
Constructors
- RetrievalManager({required LlmInterface llmProvider, DocumentStore? documentStore, VectorStore? vectorStore, String? defaultNamespace})
-
Constructor alias for convenience
factory
- RetrievalManager.withDocumentStore({required LlmInterface llmProvider, required DocumentStore documentStore})
- Create a retrieval manager with a document store (legacy mode)
- RetrievalManager.withVectorStore({required LlmInterface llmProvider, required VectorStore vectorStore, String? defaultNamespace})
- Create a retrieval manager with an external vector store
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- llmProvider → LlmInterface
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- usesVectorStore → bool
-
Check if the manager is using an external vector store
no setter
Methods
-
addDocument(
Document document) → Future< String> - Add a document to the store with embeddings
-
addDocuments(
List< Document> documents) → Future<List< String> > - Add multiple documents in batch with parallel processing
-
clearCache(
) → void - Clear the retrieval cache
-
close(
) → Future< void> - Close and clean up resources
-
contextAwareSearch(
String currentQuery, List< String> previousQueries, {int topK = 5, double? minimumScore, String? namespace, Map<String, dynamic> filters = const {}}) → Future<List< Document> > - Context-aware search utilizing conversation history
-
deleteDocument(
String id, {String? namespace}) → Future< bool> - Delete a document
-
deleteDocuments(
List< String> ids, {String? namespace}) → Future<int> - Delete multiple documents
-
hybridSearch(
String query, {int semanticResults = 5, int keywordResults = 5, int finalResults = 5, double? minimumScore, double keywordBoost = 0.3, String? namespace, Map< String, dynamic> filters = const {}}) → Future<List< Document> > - Hybrid search combining semantic and keyword search
-
multiChunkAnswer(
String query, List< Document> chunks, {Map<String, dynamic> generationParams = const {}, bool useDynamicChunkSelection = true}) → Future<String> - Create focused answer from multiple chunks
-
multiCollectionSearch(
String query, List< String> collectionIds, {int resultsPerCollection = 3, int finalResults = 5, double? minimumScore, bool rerankResults = true}) → Future<List< Document> > - Search across multiple collections
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rerankResults(
String query, List< Document> candidates, {int topK = 5, bool useLightweightRanker = false}) → Future<List< Document> > - Rerank documents based on relevance to query
-
retrieveAndGenerate(
String query, {int topK = 5, double? minimumScore, String? namespace, Map< String, dynamic> filters = const {}, Map<String, dynamic> generationParams = const {}, List<String> ? previousQueries, bool useHybridSearch = true}) → Future<String> - Retrieve and generate a response in one call with improved context handling
-
retrieveAndRerank(
String query, {int retrievalTopK = 10, int rerankTopK = 5, double? minimumScore, String? namespace, Map< String, dynamic> filters = const {}, bool useLightweightRanker = false}) → Future<List< Document> > - Retrieve and rerank in one operation
-
retrieveRelevant(
String query, {int topK = 5, double? minimumScore, String? namespace, Map< String, dynamic> filters = const {}, bool useCache = true}) → Future<List< Document> > - Retrieve relevant documents for a query with caching
-
timeWeightedRetrieval(
String query, {int topK = 5, double? minimumScore, String? namespace, Map< String, dynamic> filters = const {}, double recencyWeight = 0.3, Duration freshnessWindow = const Duration(days: 30)}) → Future<List< Document> > - Retrieve documents with time-based weighting
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited