UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

106 lines (105 loc) 2.96 kB
/** * RAG Pipeline Orchestrator * * Provides a complete end-to-end RAG pipeline that orchestrates: * - Document loading and preprocessing * - Chunking with configurable strategies * - Embedding generation * - Vector storage and retrieval * - Context assembly for LLM queries * - Response generation with citations * * @example * ```typescript * const pipeline = new RAGPipeline({ * vectorStore: myVectorStore, * embeddingModel: { provider: 'openai', modelName: 'text-embedding-3-small' }, * generationModel: { provider: 'openai', modelName: 'gpt-4o-mini' } * }); * * // Ingest documents * await pipeline.ingest(['/path/to/doc1.md', '/path/to/doc2.pdf']); * * // Query with RAG * const response = await pipeline.query('What are the key features?'); * console.log(response.answer, response.sources); * ``` */ import type { RAGPipelineConfig, IngestOptions, QueryOptions, RAGResponse, PipelineStats } from "../../types/index.js"; import { MDocument } from "../document/MDocument.js"; export declare class RAGPipeline { private id; private config; private vectorStore; private bm25Index; private graphRAG; private embeddingProvider?; private generationProvider?; private hybridSearch?; private documents; private allChunks; constructor(config: RAGPipelineConfig); /** * Initialize the pipeline (lazy loading of providers) */ initialize(): Promise<void>; /** * Ingest documents into the pipeline * * @param sources - Array of file paths, URLs, or MDocument instances * @param options - Ingestion options */ ingest(sources: Array<string | MDocument>, options?: IngestOptions): Promise<{ documentsProcessed: number; chunksCreated: number; }>; /** * Query the pipeline * * @param query - Search query * @param options - Query options * @returns RAG response with retrieved context and optional generated answer */ query(query: string, options?: QueryOptions): Promise<RAGResponse>; /** * Get pipeline statistics */ getStats(): PipelineStats; /** * Get pipeline ID */ getId(): string; /** * Clear all indexed data */ clear(): Promise<void>; /** * Ensure pipeline is initialized */ private ensureInitialized; /** * Generate embedding for text */ private generateEmbedding; /** * Assemble context from results */ private assembleContext; /** * Generate answer using LLM */ private generateAnswer; } /** * Create a simple RAG pipeline with sensible defaults * * @param options - Basic configuration options * @returns Configured RAGPipeline instance */ export declare function createRAGPipeline(options: { provider?: string; embeddingModel?: string; generationModel?: string; enableHybrid?: boolean; enableGraph?: boolean; }): RAGPipeline;