@retrivora-ai/rag-engine 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/{ChromaDBProvider-QNI7UCX4.mjs → ChromaDBProvider-2JZSBOQX.mjs} +1 -1
  2. package/dist/{MilvusProvider-OO6QGZDZ.mjs → MilvusProvider-CJDBCBVI.mjs} +1 -1
  3. package/dist/{PineconeProvider-ZRAFNFEC.mjs → PineconeProvider-E6L5Z2FO.mjs} +1 -1
  4. package/dist/{QdrantProvider-VAED5VA7.mjs → QdrantProvider-JITRNJQN.mjs} +1 -1
  5. package/dist/{RagConfig-hBGXJmSx.d.mts → RagConfig-D_rSf8ep.d.mts} +1 -1
  6. package/dist/{RagConfig-hBGXJmSx.d.ts → RagConfig-D_rSf8ep.d.ts} +1 -1
  7. package/dist/{RedisProvider-ASONNYBI.mjs → RedisProvider-3VKFQXXD.mjs} +1 -1
  8. package/dist/UniversalVectorProvider-E6L4U4OX.mjs +9 -0
  9. package/dist/{WeaviateProvider-PSDCUGC7.mjs → WeaviateProvider-MXIPP44J.mjs} +1 -1
  10. package/dist/{chunk-CWQQHAF6.mjs → chunk-26EMHLIN.mjs} +3 -5
  11. package/dist/{chunk-VPNRDXIA.mjs → chunk-7BQI4A5J.mjs} +17 -11
  12. package/dist/{chunk-ZM6TYIDH.mjs → chunk-MFWJZVF3.mjs} +3 -1
  13. package/dist/{chunk-V75V7BT2.mjs → chunk-TSX6DQXX.mjs} +2 -2
  14. package/dist/{chunk-HUGLYKD6.mjs → chunk-XZPVJS2B.mjs} +27 -9
  15. package/dist/chunk-Y6HQZDCJ.mjs +156 -0
  16. package/dist/{chunk-7YQWGERZ.mjs → chunk-YIYDJQJM.mjs} +736 -189
  17. package/dist/{chunk-7NXI6ZWX.mjs → chunk-YST6KYBJ.mjs} +8 -5
  18. package/dist/handlers/index.d.mts +2 -2
  19. package/dist/handlers/index.d.ts +2 -2
  20. package/dist/handlers/index.js +877 -625
  21. package/dist/handlers/index.mjs +1 -2
  22. package/dist/index-BJ8CUArE.d.mts +114 -0
  23. package/dist/index-DtNprGGj.d.ts +114 -0
  24. package/dist/index.d.mts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/server.d.mts +566 -17
  27. package/dist/server.d.ts +566 -17
  28. package/dist/server.js +1233 -642
  29. package/dist/server.mjs +314 -16
  30. package/package.json +11 -2
  31. package/src/config/ConfigBuilder.ts +373 -0
  32. package/src/config/EmbeddingStrategy.ts +147 -0
  33. package/src/config/serverConfig.ts +51 -18
  34. package/src/core/ConfigValidator.ts +67 -50
  35. package/src/core/Pipeline.ts +28 -26
  36. package/src/core/PluginManager.ts +277 -0
  37. package/src/core/ProviderHealthCheck.ts +75 -139
  38. package/src/core/ProviderRegistry.ts +38 -15
  39. package/src/providers/vectordb/ChromaDBProvider.ts +37 -12
  40. package/src/providers/vectordb/MilvusProvider.ts +25 -10
  41. package/src/providers/vectordb/PineconeProvider.ts +17 -2
  42. package/src/providers/vectordb/QdrantProvider.ts +3 -6
  43. package/src/providers/vectordb/RedisProvider.ts +34 -11
  44. package/src/providers/vectordb/UniversalVectorProvider.ts +220 -0
  45. package/src/providers/vectordb/WeaviateProvider.ts +17 -10
  46. package/src/server.ts +28 -10
  47. package/dist/LLMFactory-JFOY2V4X.mjs +0 -8
  48. package/dist/chunk-JI6VD5TJ.mjs +0 -387
  49. package/dist/index-Bx182KKn.d.ts +0 -64
  50. package/dist/index-Ck2pt7-8.d.mts +0 -64
  51. package/src/test-refactor.ts +0 -59
package/dist/server.d.mts CHANGED
@@ -1,11 +1,162 @@
1
- import { a as RagConfig, C as ChatResponse, I as IngestDocument, c as VectorDBConfig, b as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig } from './RagConfig-hBGXJmSx.mjs';
2
- export { R as RAGConfig, U as UIConfig } from './RagConfig-hBGXJmSx.mjs';
1
+ import { a as RagConfig, C as ChatResponse, I as IngestDocument, c as VectorDBConfig, b as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig, d as VectorDBProvider, e as LLMProvider, f as EmbeddingProvider } from './RagConfig-D_rSf8ep.mjs';
2
+ export { R as RAGConfig, U as UIConfig } from './RagConfig-D_rSf8ep.mjs';
3
3
  import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-BEyzadsv.mjs';
4
4
  export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-BEyzadsv.mjs';
5
- import { H as HealthCheckResult } from './index-Ck2pt7-8.mjs';
6
- export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-Ck2pt7-8.mjs';
5
+ import { H as HealthCheckResult } from './index-BJ8CUArE.mjs';
6
+ export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-BJ8CUArE.mjs';
7
7
  import 'next/server';
8
8
 
9
+ /**
10
+ * ConfigValidator.ts — Comprehensive configuration validation.
11
+ *
12
+ * Validates RagConfig against provider requirements and best practices.
13
+ * Returns detailed errors for misconfiguration.
14
+ *
15
+ * Key invariant: option keys validated here MUST match the keys each
16
+ * Provider constructor reads. See each provider's constructor for the
17
+ * canonical option names.
18
+ */
19
+
20
+ interface ValidationError {
21
+ field: string;
22
+ message: string;
23
+ suggestion?: string;
24
+ severity: 'error' | 'warning';
25
+ }
26
+ declare class ConfigValidator {
27
+ /**
28
+ * Validates the entire RagConfig object.
29
+ * Returns an array of validation errors. Empty array = valid config.
30
+ */
31
+ static validate(config: RagConfig): ValidationError[];
32
+ private static validateVectorDbConfig;
33
+ /**
34
+ * Pinecone — only needs apiKey (environment was removed in SDK v7+).
35
+ * Options key: { apiKey: string }
36
+ */
37
+ private static validatePineconeConfig;
38
+ /**
39
+ * PostgreSQL / pgvector — needs a connection string.
40
+ * Options key: { connectionString: string }
41
+ */
42
+ private static validatePostgresConfig;
43
+ /**
44
+ * MongoDB — needs uri, database, and collection.
45
+ * Options keys: { uri: string, database: string, collection: string }
46
+ */
47
+ private static validateMongoDBConfig;
48
+ /**
49
+ * Milvus — accepts baseUrl OR uri (preferred) OR host+port.
50
+ * MilvusProvider reads opts.baseUrl ?? opts.uri.
51
+ * Options keys: { baseUrl?: string, uri?: string, host?: string, port?: number }
52
+ */
53
+ private static validateMilvusConfig;
54
+ /**
55
+ * Qdrant — needs baseUrl (or url alias).
56
+ * Options keys: { baseUrl: string, apiKey?: string }
57
+ */
58
+ private static validateQdrantConfig;
59
+ /**
60
+ * ChromaDB — accepts baseUrl OR host.
61
+ * ChromaDBProvider reads opts.baseUrl.
62
+ * Options keys: { baseUrl?: string, host?: string, port?: number }
63
+ */
64
+ private static validateChromaDBConfig;
65
+ /**
66
+ * Redis — accepts baseUrl OR url OR host+port.
67
+ * RedisProvider reads opts.baseUrl.
68
+ * Options keys: { baseUrl?: string, url?: string, host?: string, port?: number, apiKey?: string }
69
+ */
70
+ private static validateRedisConfig;
71
+ /**
72
+ * Weaviate — accepts baseUrl OR url.
73
+ * WeaviateProvider reads opts.baseUrl.
74
+ * Options keys: { baseUrl?: string, url?: string, apiKey?: string }
75
+ */
76
+ private static validateWeaviateConfig;
77
+ /**
78
+ * Universal REST / custom REST adapter.
79
+ * Options key: { baseUrl: string }
80
+ */
81
+ private static validateRestConfig;
82
+ private static validateLLMConfig;
83
+ private static validateEmbeddingConfig;
84
+ private static validateUIConfig;
85
+ private static validateRAGConfig;
86
+ private static isValidCSSColor;
87
+ /**
88
+ * Throws if there are error-level validation issues.
89
+ * Logs warnings to console.
90
+ */
91
+ static validateAndThrow(config: RagConfig): void;
92
+ }
93
+
94
+ /**
95
+ * BatchProcessor.ts — Handles batch operations with retry logic.
96
+ *
97
+ * Provides exponential backoff, partial failure tracking, and
98
+ * configurable batch sizing for efficient bulk operations.
99
+ */
100
+ interface BatchOptions {
101
+ /** Maximum number of items per batch */
102
+ batchSize?: number;
103
+ /** Maximum number of retries for transient failures */
104
+ maxRetries?: number;
105
+ /** Initial delay before retry in milliseconds */
106
+ initialDelayMs?: number;
107
+ /** Maximum delay between retries in milliseconds */
108
+ maxDelayMs?: number;
109
+ /** Multiplier for exponential backoff */
110
+ backoffMultiplier?: number;
111
+ /** Whether to throw on any partial failure */
112
+ throwOnPartialFailure?: boolean;
113
+ }
114
+ interface BatchResult<T> {
115
+ results: T[];
116
+ errors: Array<{
117
+ index: number;
118
+ error: Error;
119
+ itemCount?: number;
120
+ }>;
121
+ totalProcessed: number;
122
+ totalFailed: number;
123
+ }
124
+ declare class BatchProcessor {
125
+ /**
126
+ * Processes an array of items in configurable batches with retry logic.
127
+ *
128
+ * @param items - Items to process
129
+ * @param processor - Async function that processes a batch of items
130
+ * @param options - Configuration for batch size, retries, etc.
131
+ * @returns Object with results, errors, and statistics
132
+ *
133
+ * @example
134
+ * const docs = [...];
135
+ * const result = await BatchProcessor.processBatch(
136
+ * docs,
137
+ * (batch) => vectorDB.batchUpsert(batch),
138
+ * { batchSize: 100, maxRetries: 3 }
139
+ * );
140
+ */
141
+ static processBatch<T, R>(items: T[], processor: (batch: T[]) => Promise<R>, options?: BatchOptions): Promise<BatchResult<R>>;
142
+ /**
143
+ * Processes items sequentially (one at a time) with retry logic.
144
+ * Useful for operations that don't support batching or when granular
145
+ * error tracking is needed.
146
+ */
147
+ static processSequential<T, R>(items: T[], processor: (item: T) => Promise<R>, options?: BatchOptions): Promise<BatchResult<R>>;
148
+ /**
149
+ * Maps over items with retry logic, returning results in order.
150
+ * Like Array.map() but with async processing and automatic retries.
151
+ */
152
+ static mapWithRetry<T, R>(items: T[], mapper: (item: T) => Promise<R>, options?: BatchOptions): Promise<R[]>;
153
+ /**
154
+ * Parallel processor with concurrency limit.
155
+ * Processes up to `concurrency` items at the same time.
156
+ */
157
+ static processConcurrent<T, R>(items: T[], processor: (item: T) => Promise<R>, concurrency?: number, options?: BatchOptions): Promise<BatchResult<R>>;
158
+ }
159
+
9
160
  /**
10
161
  * VectorPlugin — main orchestrator class.
11
162
  * This is the primary interface for host applications.
@@ -76,9 +227,9 @@ declare class VectorPlugin {
76
227
  * Features:
77
228
  * - Lazy initialization of providers
78
229
  * - Batch processing with retry logic
79
- * - Configurable embedding strategies
230
+ * - Smart embedding strategy (integrated / separate / external)
80
231
  * - Error recovery for transient failures
81
- * - Support for multi-tenancy via namespacing
232
+ * - Multi-tenancy support via namespacing
82
233
  */
83
234
  declare class Pipeline {
84
235
  private vectorDB;
@@ -90,7 +241,7 @@ declare class Pipeline {
90
241
  constructor(config: RagConfig);
91
242
  initialize(): Promise<void>;
92
243
  /**
93
- * Ingest documents with automatic chunking, embedding, and batch processing.
244
+ * Ingest documents with automatic chunking, embedding, and batch upsert.
94
245
  * Handles retries for transient failures.
95
246
  */
96
247
  ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
@@ -160,15 +311,24 @@ declare abstract class BaseVectorProvider {
160
311
 
161
312
  /**
162
313
  * ProviderRegistry — dynamic provider loader for Vector DBs and LLMs.
314
+ *
315
+ * Supports:
316
+ * - Built-in providers loaded on-demand via dynamic imports (tree-shaking friendly)
317
+ * - Custom provider registration via registerVectorProvider()
163
318
  */
164
319
  declare class ProviderRegistry {
165
320
  private static vectorProviders;
166
321
  /**
167
- * Register a custom vector provider.
322
+ * Register a custom vector provider class by name.
323
+ * The name must match the provider value used in VectorDBConfig.provider.
324
+ *
325
+ * @example
326
+ * ProviderRegistry.registerVectorProvider('my-db', MyCustomProvider);
168
327
  */
169
328
  static registerVectorProvider(name: string, providerClass: new (config: VectorDBConfig) => BaseVectorProvider): void;
170
329
  /**
171
330
  * Creates a vector database provider based on the configuration.
331
+ * Built-in providers are dynamically imported to avoid bundling all SDKs.
172
332
  */
173
333
  static createVectorProvider(config: VectorDBConfig): Promise<BaseVectorProvider>;
174
334
  /**
@@ -182,10 +342,323 @@ declare class ProviderRegistry {
182
342
  *
183
343
  * This keeps secrets server-side and never exposes them to the browser.
184
344
  * Consumer projects set these env vars in their .env.local file.
345
+ *
346
+ * Supported VECTOR_DB_PROVIDER values and their required env vars:
347
+ * pinecone → PINECONE_API_KEY, PINECONE_INDEX
348
+ * pgvector /
349
+ * postgresql → PGVECTOR_CONNECTION_STRING, VECTOR_DB_INDEX
350
+ * mongodb → MONGODB_URI, MONGODB_DB, MONGODB_COLLECTION
351
+ * qdrant → QDRANT_URL, QDRANT_API_KEY
352
+ * milvus → MILVUS_URL (e.g. http://localhost:19530)
353
+ * chromadb → CHROMADB_URL (e.g. http://localhost:8000)
354
+ * weaviate → WEAVIATE_URL, WEAVIATE_API_KEY
355
+ * redis → REDIS_URL, REDIS_API_KEY
356
+ * rest /
357
+ * universal_rest→ VECTOR_BASE_URL, VECTOR_DB_REST_API_KEY
185
358
  */
186
359
 
187
360
  declare function getRagConfig(env?: Record<string, string | undefined>): RagConfig;
188
361
 
362
+ /**
363
+ * ConfigBuilder — Fluent, type-safe configuration builder for RagConfig
364
+ *
365
+ * Simplifies host application setup with a builder pattern while maintaining
366
+ * type safety and validation.
367
+ *
368
+ * Features:
369
+ * - Fluent API for easy configuration
370
+ * - Type-safe provider selection
371
+ * - Automatic environment variable resolution
372
+ * - Built-in validation
373
+ * - Support for presets
374
+ *
375
+ * @example
376
+ * const config = new ConfigBuilder()
377
+ * .vectorDb('pinecone', { apiKey: process.env.PINECONE_API_KEY })
378
+ * .llm('openai', 'gpt-4o', process.env.OPENAI_API_KEY)
379
+ * .embedding('openai', 'text-embedding-3-small')
380
+ * .projectId('my-app')
381
+ * .build();
382
+ *
383
+ * const plugin = new VectorPlugin(config);
384
+ */
385
+
386
+ declare class ConfigBuilder {
387
+ private config;
388
+ /**
389
+ * Set the project/application ID for namespacing
390
+ */
391
+ projectId(id: string): this;
392
+ /**
393
+ * Configure the vector database provider
394
+ */
395
+ vectorDb(provider: VectorDBProvider | 'universal-rest' | 'auto', options?: Record<string, unknown>): this;
396
+ /**
397
+ * Configure the LLM provider for chat
398
+ */
399
+ llm(provider: LLMProvider | 'auto', model?: string, apiKey?: string, options?: Record<string, unknown>): this;
400
+ /**
401
+ * Configure the embedding provider
402
+ */
403
+ embedding(provider: EmbeddingProvider | 'auto', model?: string, apiKey?: string, options?: Record<string, unknown>): this;
404
+ /**
405
+ * Set RAG-specific parameters
406
+ */
407
+ rag(options: {
408
+ chunkSize?: number;
409
+ chunkOverlap?: number;
410
+ topK?: number;
411
+ }): this;
412
+ /**
413
+ * Set UI/UX parameters
414
+ */
415
+ ui(options: {
416
+ branding?: string;
417
+ primaryColor?: string;
418
+ darkMode?: boolean;
419
+ }): this;
420
+ /**
421
+ * Build and return the configuration
422
+ */
423
+ build(): RagConfig;
424
+ /**
425
+ * Build and return as JSON for serialization
426
+ */
427
+ toJSON(): string;
428
+ private autoDetectVectorDb;
429
+ private autoDetectLLM;
430
+ private autoDetectEmbedding;
431
+ }
432
+ /**
433
+ * Preset configurations for common provider combinations
434
+ */
435
+ declare const PRESETS: {
436
+ /**
437
+ * OpenAI + Pinecone: Production-ready cloud setup
438
+ */
439
+ readonly 'openai-pinecone': {
440
+ readonly vectorDb: "pinecone";
441
+ readonly llm: "openai";
442
+ readonly embedding: "openai";
443
+ };
444
+ /**
445
+ * Claude + Qdrant: Open-source vector DB + proprietary LLM
446
+ */
447
+ readonly 'claude-qdrant': {
448
+ readonly vectorDb: "qdrant";
449
+ readonly llm: "anthropic";
450
+ readonly embedding: "openai";
451
+ };
452
+ /**
453
+ * Local development: Ollama + local Qdrant
454
+ */
455
+ readonly 'local-dev': {
456
+ readonly vectorDb: "qdrant";
457
+ readonly llm: "ollama";
458
+ readonly embedding: "ollama";
459
+ };
460
+ /**
461
+ * Fully open-source: Ollama LLM + Qdrant vector DB + Ollama embeddings
462
+ */
463
+ readonly 'fully-open-source': {
464
+ readonly vectorDb: "qdrant";
465
+ readonly llm: "ollama";
466
+ readonly embedding: "ollama";
467
+ };
468
+ /**
469
+ * PostgreSQL stack: pgvector + OpenAI
470
+ */
471
+ readonly 'postgres-openai': {
472
+ readonly vectorDb: "postgresql";
473
+ readonly llm: "openai";
474
+ readonly embedding: "openai";
475
+ };
476
+ /**
477
+ * Enterprise MongoDB: MongoDB Atlas with OpenAI
478
+ */
479
+ readonly 'mongodb-openai': {
480
+ readonly vectorDb: "mongodb";
481
+ readonly llm: "openai";
482
+ readonly embedding: "openai";
483
+ };
484
+ /**
485
+ * Redis stack for caching + search
486
+ */
487
+ readonly 'redis-openai': {
488
+ readonly vectorDb: "redis";
489
+ readonly llm: "openai";
490
+ readonly embedding: "openai";
491
+ };
492
+ };
493
+ type PresetName = keyof typeof PRESETS;
494
+ /**
495
+ * Helper to create config from preset
496
+ */
497
+ declare function createFromPreset(presetName: PresetName): ConfigBuilder;
498
+
499
+ /**
500
+ * EmbeddingStrategy — Unified strategy for handling different embedding scenarios
501
+ *
502
+ * Automatically determines whether to:
503
+ * 1. Use the LLM provider's built-in embedding (integrated)
504
+ * 2. Use a separate embedding provider (fallback)
505
+ * 3. Use an external embedding service
506
+ *
507
+ * This removes special-case handling from Pipeline and consolidates embedding logic.
508
+ */
509
+
510
+ declare enum EmbeddingStrategy {
511
+ /**
512
+ * LLM provider handles both chat and embeddings
513
+ * Example: OpenAI for both GPT and embeddings
514
+ */
515
+ INTEGRATED = "integrated",
516
+ /**
517
+ * Use separate embedding provider different from LLM
518
+ * Example: Anthropic (chat) + OpenAI (embeddings)
519
+ */
520
+ SEPARATE = "separate",
521
+ /**
522
+ * Use standalone embedding service
523
+ * Example: Dedicated embedding API
524
+ */
525
+ EXTERNAL = "external"
526
+ }
527
+ interface EmbeddingStrategyResult {
528
+ strategy: EmbeddingStrategy;
529
+ embeddingProvider: ILLMProvider;
530
+ llmProvider: ILLMProvider;
531
+ }
532
+ /**
533
+ * Determines the optimal embedding strategy and initializes providers
534
+ */
535
+ declare class EmbeddingStrategyResolver {
536
+ /**
537
+ * Determine strategy based on LLM and embedding configs
538
+ */
539
+ static determineStrategy(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): EmbeddingStrategy;
540
+ /**
541
+ * Resolve and initialize providers according to the strategy
542
+ */
543
+ static resolve(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): Promise<EmbeddingStrategyResult>;
544
+ /**
545
+ * Check if an LLM provider natively supports embeddings
546
+ */
547
+ private static supportsEmbedding;
548
+ /**
549
+ * Get a human-readable description of the strategy
550
+ */
551
+ static getDescription(strategy: EmbeddingStrategy): string;
552
+ }
553
+
554
+ /**
555
+ * Pre-configured templates for popular AI and Vector services.
556
+ * Use these as defaults in the Universal Adapters.
557
+ */
558
+ declare const LLM_PROFILES: {
559
+ 'openai-compatible': {
560
+ chatPath: string;
561
+ embedPath: string;
562
+ responseExtractPath: string;
563
+ embedExtractPath: string;
564
+ chatPayloadTemplate: string;
565
+ };
566
+ litellm: {
567
+ chatPayloadTemplate: string;
568
+ chatPath: string;
569
+ embedPath: string;
570
+ responseExtractPath: string;
571
+ embedExtractPath: string;
572
+ };
573
+ 'anthropic-claude': {
574
+ chatPath: string;
575
+ responseExtractPath: string;
576
+ headers: {
577
+ 'anthropic-version': string;
578
+ };
579
+ chatPayloadTemplate: string;
580
+ };
581
+ 'google-gemini': {
582
+ chatPath: string;
583
+ responseExtractPath: string;
584
+ chatPayloadTemplate: string;
585
+ };
586
+ 'github-copilot': {
587
+ chatPayloadTemplate: string;
588
+ chatPath: string;
589
+ embedPath: string;
590
+ responseExtractPath: string;
591
+ embedExtractPath: string;
592
+ };
593
+ 'ollama-standard': {
594
+ chatPath: string;
595
+ embedPath: string;
596
+ responseExtractPath: string;
597
+ embedExtractPath: string;
598
+ chatPayloadTemplate: string;
599
+ embedPayloadTemplate: string;
600
+ };
601
+ };
602
+ declare const VECTOR_PROFILES: {
603
+ 'pinecone-rest': {
604
+ queryPath: string;
605
+ upsertPath: string;
606
+ responseExtractPath: string;
607
+ idPath: string;
608
+ scorePath: string;
609
+ contentPath: string;
610
+ metadataPath: string;
611
+ queryPayloadTemplate: string;
612
+ };
613
+ 'mongodb-atlas': {
614
+ queryPath: string;
615
+ responseExtractPath: string;
616
+ idPath: string;
617
+ scorePath: string;
618
+ contentPath: string;
619
+ metadataPath: string;
620
+ queryPayloadTemplate: string;
621
+ };
622
+ chromadb: {
623
+ queryPath: string;
624
+ upsertPath: string;
625
+ responseExtractPath: string;
626
+ idPath: string;
627
+ scorePath: string;
628
+ contentPath: string;
629
+ metadataPath: string;
630
+ };
631
+ qdrant: {
632
+ queryPath: string;
633
+ upsertPath: string;
634
+ responseExtractPath: string;
635
+ idPath: string;
636
+ scorePath: string;
637
+ contentPath: string;
638
+ metadataPath: string;
639
+ };
640
+ };
641
+
642
+ /**
643
+ * DocumentParser — handles text extraction from various file formats.
644
+ * Supported: .txt, .md, .json, .csv, .pdf (requires pdf-parse), .docx (requires mammoth)
645
+ */
646
+ declare class DocumentParser {
647
+ /**
648
+ * Extract text from a File or Buffer based on its type.
649
+ */
650
+ static parse(file: File | Buffer, fileName: string, mimeType: string): Promise<string>;
651
+ private static readAsText;
652
+ }
653
+
654
+ /**
655
+ * PineconeProvider — Pinecone vector database implementation.
656
+ *
657
+ * Compatible with @pinecone-database/pinecone v7.x SDK.
658
+ *
659
+ * Required options: { apiKey: string }
660
+ * The `environment` option is no longer needed (removed in SDK v5+).
661
+ */
189
662
  declare class PineconeProvider extends BaseVectorProvider {
190
663
  private client;
191
664
  private readonly apiKey;
@@ -244,7 +717,14 @@ declare class MongoDBProvider extends BaseVectorProvider {
244
717
  }
245
718
 
246
719
  /**
247
- * MilvusProvider — implementation for Milvus using its REST API.
720
+ * MilvusProvider — Milvus implementation using its REST API v1.
721
+ *
722
+ * Required options:
723
+ * { baseUrl: string } — e.g. "http://localhost:19530"
724
+ * OR { uri: string } — alias for baseUrl
725
+ * OR { host: string, port: number } — auto-constructs baseUrl
726
+ *
727
+ * Optional: { apiKey?: string, headers?: Record<string, string> }
248
728
  */
249
729
  declare class MilvusProvider extends BaseVectorProvider {
250
730
  private http;
@@ -254,7 +734,7 @@ declare class MilvusProvider extends BaseVectorProvider {
254
734
  batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
255
735
  query(vector: number[], topK: number, namespace?: string, _filter?: Record<string, unknown>): Promise<VectorMatch[]>;
256
736
  delete(id: string | number, _namespace?: string): Promise<void>;
257
- deleteNamespace(_namespace: string): Promise<void>;
737
+ deleteNamespace(namespace: string): Promise<void>;
258
738
  ping(): Promise<boolean>;
259
739
  disconnect(): Promise<void>;
260
740
  }
@@ -290,24 +770,41 @@ declare class QdrantProvider extends BaseVectorProvider {
290
770
  }
291
771
 
292
772
  /**
293
- * ChromaDBProvider — implementation for ChromaDB using its REST API.
773
+ * ChromaDBProvider — ChromaDB implementation using its REST API.
774
+ *
775
+ * Required options: { baseUrl: string } — e.g. "http://localhost:8000"
776
+ * Optional: { host?: string, port?: number } — used to construct baseUrl when baseUrl not set
294
777
  */
295
778
  declare class ChromaDBProvider extends BaseVectorProvider {
296
779
  private http;
297
780
  private collectionId;
298
781
  constructor(config: VectorDBConfig);
782
+ /**
783
+ * Get or create the ChromaDB collection.
784
+ */
299
785
  initialize(): Promise<void>;
300
786
  upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
301
787
  batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
302
788
  query(vector: number[], topK: number, namespace?: string, _filter?: Record<string, unknown>): Promise<VectorMatch[]>;
303
- delete(id: string, _namespace?: string): Promise<void>;
304
- deleteNamespace(_namespace: string): Promise<void>;
789
+ delete(id: string, namespace?: string): Promise<void>;
790
+ deleteNamespace(namespace: string): Promise<void>;
305
791
  ping(): Promise<boolean>;
306
792
  disconnect(): Promise<void>;
307
793
  }
308
794
 
309
795
  /**
310
- * RedisProvider — implementation for Redis (e.g. Upstash) using its REST API.
796
+ * RedisProvider — Redis Vector Search implementation using Upstash REST API.
797
+ *
798
+ * Required options:
799
+ * { baseUrl: string } — Upstash REST endpoint
800
+ * OR { url: string } — alias for baseUrl
801
+ * OR { host: string, port: number } — auto-constructs baseUrl
802
+ *
803
+ * Optional: { apiKey?: string } — bearer token (required for Upstash)
804
+ *
805
+ * Note: This provider targets the Upstash Vector REST API.
806
+ * For bare Redis with RediSearch, use a custom REST wrapper or the
807
+ * UniversalVectorProvider with custom templates.
311
808
  */
312
809
  declare class RedisProvider extends BaseVectorProvider {
313
810
  private http;
@@ -317,13 +814,23 @@ declare class RedisProvider extends BaseVectorProvider {
317
814
  batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
318
815
  query(vector: number[], topK: number, namespace?: string, _filter?: Record<string, unknown>): Promise<VectorMatch[]>;
319
816
  delete(id: string, namespace?: string): Promise<void>;
320
- deleteNamespace(_namespace: string): Promise<void>;
817
+ deleteNamespace(namespace: string): Promise<void>;
818
+ /**
819
+ * Redis is TCP-based and has no HTTP health endpoint.
820
+ * Returns true; actual connectivity is validated on the first operation.
821
+ */
321
822
  ping(): Promise<boolean>;
322
823
  disconnect(): Promise<void>;
323
824
  }
324
825
 
325
826
  /**
326
- * WeaviateProvider — implementation for Weaviate using its REST/GraphQL API.
827
+ * WeaviateProvider — Weaviate implementation using its REST/GraphQL API.
828
+ *
829
+ * Required options:
830
+ * { baseUrl: string } — e.g. "http://localhost:8080"
831
+ * OR { url: string } — alias accepted for backwards compatibility
832
+ *
833
+ * Optional: { apiKey?: string }
327
834
  */
328
835
  declare class WeaviateProvider extends BaseVectorProvider {
329
836
  private http;
@@ -338,6 +845,34 @@ declare class WeaviateProvider extends BaseVectorProvider {
338
845
  disconnect(): Promise<void>;
339
846
  }
340
847
 
848
+ /**
849
+ * UniversalVectorProvider — Template-based REST integration for any vector database
850
+ *
851
+ * Enables connecting to any REST-based vector database with minimal configuration
852
+ * through request/response mapping templates.
853
+ *
854
+ * Features:
855
+ * - Template-based request/response mapping
856
+ * - Automatic JSON path extraction
857
+ * - Retry logic with exponential backoff
858
+ * - Request batching
859
+ * - Custom header support
860
+ */
861
+
862
+ declare class UniversalVectorProvider extends BaseVectorProvider {
863
+ private http;
864
+ private readonly opts;
865
+ constructor(config: VectorDBConfig);
866
+ initialize(): Promise<void>;
867
+ upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
868
+ batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
869
+ query(vector: number[], topK: number, namespace?: string, filter?: Record<string, unknown>): Promise<VectorMatch[]>;
870
+ delete(id: string | number, namespace?: string): Promise<void>;
871
+ deleteNamespace(namespace: string): Promise<void>;
872
+ ping(): Promise<boolean>;
873
+ disconnect(): Promise<void>;
874
+ }
875
+
341
876
  /**
342
877
  * LLMFactory — instantiates the correct ILLMProvider based on llmConfig.provider.
343
878
  *
@@ -431,4 +966,18 @@ declare class OllamaProvider implements ILLMProvider {
431
966
  ping(): Promise<boolean>;
432
967
  }
433
968
 
434
- export { AnthropicProvider, BaseVectorProvider, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigResolver, EmbedOptions, EmbeddingConfig, ILLMProvider, IngestDocument, LLMConfig, LLMFactory, MilvusProvider, MongoDBProvider, OllamaProvider, OpenAIProvider, PineconeProvider, Pipeline, PostgreSQLProvider, ProviderRegistry, QdrantProvider, RagConfig, RedisProvider, UpsertDocument, VectorDBConfig, VectorMatch, VectorPlugin, WeaviateProvider, getRagConfig };
969
+ declare class UniversalLLMAdapter implements ILLMProvider {
970
+ private readonly http;
971
+ private readonly model;
972
+ private readonly opts;
973
+ private readonly systemPrompt;
974
+ private readonly maxTokens;
975
+ private readonly temperature;
976
+ constructor(config: LLMConfig | EmbeddingConfig);
977
+ chat(messages: ChatMessage[], context?: string): Promise<string>;
978
+ embed(text: string): Promise<number[]>;
979
+ batchEmbed(texts: string[]): Promise<number[][]>;
980
+ ping(): Promise<boolean>;
981
+ }
982
+
983
+ export { AnthropicProvider, BaseVectorProvider, type BatchOptions, BatchProcessor, type BatchResult, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, ConfigValidator, DocumentParser, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, HealthCheckResult, ILLMProvider, IngestDocument, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, MilvusProvider, MongoDBProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, Pipeline, PostgreSQLProvider, ProviderRegistry, QdrantProvider, RagConfig, RedisProvider, UniversalLLMAdapter, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, type ValidationError, VectorDBConfig, VectorDBProvider, VectorMatch, VectorPlugin, WeaviateProvider, createFromPreset, getRagConfig };