CollectionRag class

Collection-scoped facade for Multi-Collection workflows.

Properties

collectionId → String
no setter
hashCode → int
The hash code for this object.
no setterinherited
isIndexReady → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
warmupFuture → Future<void>
no setter

Methods

addDocument(String content, {String? metadata, String? name, String? filePath, ChunkingStrategy? strategy, Duration? chunkDelay, void onProgress(int done, int total)?}) → Future<SourceAddResult>
addDocumentFromFile(String filePath, {String? metadata, String? name, ChunkingStrategy? strategy, Duration? chunkDelay, void onProgress(int done, int total)?}) → Future<SourceAddResult>
addDocumentUtf8(Uint8List bytes, {String? metadata, String? name, ChunkingStrategy? strategy, Duration? chunkDelay, void onProgress(int done, int total)?}) → Future<SourceAddResult>
ask(String question, {required RagGenerate generate, int topK = 5, int tokenBudget = 1500, RagPromptBuilder buildPrompt = defaultAskPrompt}) → Future<RagAnswer>
Answers question from the stored documents with your LLM.
assembleContext({required SearchHandle searchHandle, int tokenBudget = 2000, ContextStrategy strategy = ContextStrategy.relevanceFirst, String separator = '\n\n---\n\n', bool singleSourceMode = false}) → Future<AssembledContextV2>
deriveContextBudgetForPromptV2({required int fullPromptBudget, required String query, String? systemInstruction, bool useStrictMode = true, int safetyMarginTokens = 0, int? fixedPromptOverheadTokens}) → Future<int>
formatPrompt(String query, RagSearchResult result) → String
getChunkExcerpts({required SearchHandle searchHandle, required List<int> chunkIds, required int maxBytes}) → Future<List<ChunkExcerptResult>>
getStats() → Future<SourceStats>
hydrateChunks({required SearchHandle searchHandle, required List<int> chunkIds}) → Future<List<ChunkSearchResult>>
listSources() → Future<List<SourceEntry>>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prepareAsk(String question, {int topK = 5, int tokenBudget = 1500, RagPromptBuilder buildPrompt = defaultAskPrompt}) → Future<RagAskPrompt>
Searches for question and builds the prompt for an LLM, without calling one. Use it to stream the answer with your own SDK, then pass the complete answer to RagAskPrompt.answer.
rebuildIndex({bool force = false}) → Future<void>
removeSource(int sourceId) → Future<void>
searchHybrid(String query, {int topK = 10, double vectorWeight = kDefaultVectorWeight, double bm25Weight = kDefaultBm25Weight, List<int>? sourceIds}) → Future<List<HybridSearchResult>>
searchHybridWithContext(String query, {int topK = 10, int tokenBudget = 2000, ContextStrategy strategy = ContextStrategy.relevanceFirst, int adjacentChunks = 0, double vectorWeight = kDefaultVectorWeight, double bm25Weight = kDefaultBm25Weight, bool singleSourceMode = false, List<int>? sourceIds, SearchHydrationMode hydrationMode = SearchHydrationMode.full, int previewMaxBytes = 512}) → Future<RagSearchResult>
searchMeta(String query, {int topK = 10, double vectorWeight = kDefaultVectorWeight, double bm25Weight = kDefaultBm25Weight, List<int>? sourceIds, int adjacentChunks = 0}) → Future<SearchMetaResult>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited