import { a as GQPPlugin, l as GQPEngine, n as GQPNode, Q as QueryFilters, P as PluginContext } from '../../types-CqJN-Ev5.js'; /** * Vector Search Plugin for GQP * Enables semantic search on text fields */ /** * Vector provider configuration */ interface VectorProviderConfig { /** Pinecone configuration */ pinecone?: { apiKey: string; index: string; environment?: string; }; /** OpenAI embedding configuration */ openai?: { apiKey: string; model?: string; }; /** Custom embedding function */ customEmbed?: (text: string) => Promise; /** Custom search function */ customSearch?: (namespace: string, embedding: number[], limit: number) => Promise>; } /** * Auto-indexing configuration */ interface AutoIndexConfig { /** Enable auto-indexing */ enabled: boolean; /** Fields to index (e.g., ['Order.customerNotes', 'Product.description']) */ fields?: string[]; /** Batch size for indexing */ batchSize?: number; } /** * Vector plugin configuration */ interface VectorPluginConfig { /** Vector provider */ provider: "pinecone" | "custom"; /** Provider-specific configuration */ config: VectorProviderConfig; /** Similarity threshold (0-1) */ threshold?: number; /** Max results from vector search before SQL filtering */ maxResults?: number; /** Enable hybrid search (vector + SQL) */ hybrid?: boolean; /** Auto-indexing configuration */ autoIndex?: AutoIndexConfig; } /** * Vector Search Plugin * * @example * ```typescript * import { GQP } from '@mzhub/gqp'; * import { VectorPlugin } from '@mzhub/gqp/vector'; * * const graph = new GQP({ * sources: { db: fromPrisma(prisma) }, * plugins: [ * new VectorPlugin({ * provider: 'pinecone', * config: { * pinecone: { * apiKey: process.env.PINECONE_KEY, * index: 'products' * }, * openai: { * apiKey: process.env.OPENAI_KEY * } * } * }) * ] * }); * ``` */ declare class VectorPlugin implements GQPPlugin { name: string; private config; private _indexedFields; constructor(config: VectorPluginConfig); /** * Initialize plugin */ onInit(_engine: GQPEngine): Promise; /** * Pre-query hook - handle semantic search */ onPreQuery(node: GQPNode, filters: QueryFilters, context: PluginContext): Promise; /** * Perform vector search */ private vectorSearch; /** * Generate embedding for text */ private embed; /** * Search vector store */ private search; /** * Embed text using OpenAI */ private embedWithOpenAI; /** * Search using Pinecone */ private searchWithPinecone; /** * Index a field for vector search */ indexField(fieldPath: string, getData: () => Promise>, options?: { batchSize?: number; onProgress?: (percent: number) => void; }): Promise; /** * Upsert vectors to store */ private upsertVectors; /** * Check if a field is indexed */ isIndexed(fieldPath: string): boolean; } /** * Factory function */ declare function createVectorPlugin(config: VectorPluginConfig): VectorPlugin; export { type AutoIndexConfig, VectorPlugin, type VectorPluginConfig, type VectorProviderConfig, createVectorPlugin };