/** * Semantic Join Executor * * Performs joins based on vector similarity (semantic matching). * Uses embeddings to find similar items across data sources. */ import { VectorDatabaseService } from '../../../vector/vector-database.service'; import { IJoinClause, IJoinResult } from '../../types'; /** * Options for semantic join */ export interface ISemanticJoinOptions { /** Environment */ env: string; /** Product */ product: string; /** Embedding function for text fields */ embedFn?: (text: string) => Promise; } /** * Semantic match result */ export interface ISemanticMatch { /** Source row */ sourceRow: Record; /** Matched vector row */ matchedRow: Record; /** Similarity score */ score: number; } /** * Semantic Join Executor * * Joins data based on vector similarity rather than exact key matches. */ export declare class SemanticJoinExecutor { private readonly vectorService; constructor(vectorService: VectorDatabaseService); /** * Execute a semantic join * * For each row in the left dataset: * 1. Extract or compute embedding from the embed field * 2. Query vector store for similar items * 3. Join matching items based on similarity threshold */ execute>(left: Record[], join: IJoinClause, leftAlias: string, options: ISemanticJoinOptions): Promise>; /** * Find semantic matches for a single row */ private findSemanticMatches; /** * Execute batch semantic join (more efficient for large datasets) */ executeBatch>(left: Record[], join: IJoinClause, leftAlias: string, options: ISemanticJoinOptions, batchSize?: number): Promise>; /** * Get nested value from object using dot notation */ private getNestedValue; /** * Merge rows with similarity score */ private mergeRows; }