/** * Result Aggregator * Combines chunk search results back to message level */ import type { ChunkSearchResult } from "../embeddings/VectorStore.js"; /** * Match info from a single chunk */ export interface ChunkMatch { chunkId: string; chunkIndex: number; totalChunks: number; content: string; startOffset: number; endOffset: number; similarity: number; } /** * Aggregated result combining multiple chunks from the same message */ export interface AggregatedResult { messageId: number; similarity: number; matchedChunks: ChunkMatch[]; bestSnippet: string; totalChunks: number; } /** * Configuration for result aggregation */ export interface AggregationConfig { /** Minimum similarity threshold */ minSimilarity: number; /** Maximum results to return after aggregation */ limit: number; /** Whether to deduplicate similar content within conversation */ deduplicate: boolean; /** Jaccard similarity threshold for deduplication (0-1) */ deduplicationThreshold: number; } export declare const DEFAULT_AGGREGATION_CONFIG: AggregationConfig; /** * Result Aggregator class */ export declare class ResultAggregator { private config; constructor(config?: Partial); /** * Aggregate chunk search results by parent message */ aggregate(chunkResults: ChunkSearchResult[]): AggregatedResult[]; /** * Deduplicate similar results using Jaccard similarity */ private deduplicateResults; /** * Merge results from multiple search sources (e.g., chunk + message embeddings) * Uses max similarity for duplicate message IDs */ mergeResults(chunkResults: AggregatedResult[], messageResults: Array<{ messageId: number; content: string; similarity: number; }>): AggregatedResult[]; } /** * Get or create a result aggregator with given config */ export declare function getResultAggregator(config?: Partial): ResultAggregator; //# sourceMappingURL=ResultAggregator.d.ts.map