/** * QR Video RAG - Encoder * * Encodes text documents into QR-encoded video format */ import { QRVideoStoreConfig, Chunk, VectorDatabase, Embedder, VideoBuildOptions, QRVideoStoreStats } from './types'; /** * QR Video Store Encoder * * Converts text documents into QR-encoded MP4 videos with semantic indexing */ export declare class QRVideoStoreEncoder { private config; private database; private embedder; /** * Create a new QR Video Store Encoder * * @param database Vector database for storing chunk embeddings * @param embedder Embedding generator for semantic search * @param config Configuration options * * @example * ```typescript * const encoder = new QRVideoStoreEncoder( * createInMemoryAdapter(), * createGeminiEmbedder(apiKey), * { chunkSize: 500, videoFps: 1 } * ); * ``` */ constructor(database: VectorDatabase, embedder: Embedder, config?: QRVideoStoreConfig); /** * Chunk text into smaller pieces with overlap * * @param text Input text to chunk * @returns Array of text chunks with indices * * @example * ```typescript * const chunks = encoder.chunkText("Long document text..."); * console.log(chunks.length); // Number of chunks created * ``` */ chunkText(text: string): Chunk[]; /** * Generate QR code image buffer from text * * @param text Text to encode as QR code * @returns Buffer containing PNG image data * * @example * ```typescript * const qrBuffer = await encoder.generateQrCode("Hello World"); * fs.writeFileSync("qr.png", qrBuffer); * ``` */ generateQrCode(text: string): Promise; /** * Build MP4 video from QR code images * * @param qrCodeBuffers Array of QR code image buffers * @param outputVideoPath Path where video will be saved * @returns Promise that resolves when video is created * * @example * ```typescript * const qrBuffers = await Promise.all( * chunks.map(c => encoder.generateQrCode(c.text)) * ); * await encoder.buildVideo(qrBuffers, "./output.mp4"); * ``` */ buildVideo(qrCodeBuffers: Buffer[], outputVideoPath: string, options?: Partial): Promise; /** * Internal method to encode video using FFmpeg */ private encodeVideo; /** * Add a document to the QR Video Store * * This is the main method that orchestrates the entire encoding process: * 1. Chunks the document text * 2. Generates QR codes for each chunk * 3. Creates embeddings for semantic search * 4. Builds the MP4 video * 5. Stores the index in the vector database * * @param documentId Unique identifier for the document * @param documentText Full text content of the document * @param outputVideoPath Path where the video will be saved * @param metadata Optional metadata to attach to chunks * @returns Promise that resolves when document is fully processed * * @example * ```typescript * await encoder.addDocument( * "user-guide-v1", * fileContent, * "./videos/user-guide.mp4", * { author: "John Doe", version: "1.0" } * ); * ``` */ addDocument(documentId: string, documentText: string, outputVideoPath: string, metadata?: Record): Promise; /** * Add multiple documents in batch * * @param documents Array of documents to add * @returns Promise that resolves when all documents are processed * * @example * ```typescript * await encoder.addDocumentsBatch([ * { id: "doc1", text: "...", output: "./videos/doc1.mp4" }, * { id: "doc2", text: "...", output: "./videos/doc2.mp4" } * ]); * ``` */ addDocumentsBatch(documents: Array<{ documentId: string; documentText: string; outputVideoPath: string; metadata?: Record; }>): Promise; /** * Get statistics about a video file * * @param videoPath Path to the video file * @param originalText Original text content (for compression ratio) * @returns Statistics about the video store */ getStats(videoPath: string, originalText: string): Promise; /** * Get video metadata using FFmpeg */ private getVideoInfo; } //# sourceMappingURL=encoder.d.ts.map