@retrivora-ai/rag-engine 0.4.5 → 1.0.1
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.
- package/README.md +32 -57
- package/dist/{ChromaDBProvider-GI7TB7GJ.mjs → ChromaDBProvider-MIDOR4FW.mjs} +2 -2
- package/dist/{DocumentChunker-3yElxTO3.d.mts → DocumentChunker-C-sCZPhi.d.mts} +6 -6
- package/dist/{DocumentChunker-3yElxTO3.d.ts → DocumentChunker-C-sCZPhi.d.ts} +6 -6
- package/dist/{MilvusProvider-WDVTFB7D.mjs → MilvusProvider-U7SKC27V.mjs} +2 -2
- package/dist/{MongoDBProvider-RE3Q5S5B.mjs → MongoDBProvider-Z6ALOVDN.mjs} +2 -2
- package/dist/{PineconeProvider-BE2JWSPD.mjs → PineconeProvider-QZNRKTN2.mjs} +2 -2
- package/dist/{PostgreSQLProvider-5HHTK4SU.mjs → PostgreSQLProvider-BMOETDZA.mjs} +2 -2
- package/dist/{QdrantProvider-XVDVBNIG.mjs → QdrantProvider-YNUNEOZH.mjs} +2 -2
- package/dist/{RagConfig-BgRDL9Vy.d.mts → RagConfig-DRJO4hGU.d.mts} +12 -1
- package/dist/{RagConfig-BgRDL9Vy.d.ts → RagConfig-DRJO4hGU.d.ts} +12 -1
- package/dist/{RedisProvider-EK2R2PQH.mjs → RedisProvider-SR65SCKV.mjs} +2 -2
- package/dist/{SimpleGraphProvider-M6T7SE7D.mjs → SimpleGraphProvider-SLOXO4M7.mjs} +1 -1
- package/dist/{UniversalVectorProvider-YIDRX6VT.mjs → UniversalVectorProvider-IN67OS56.mjs} +3 -3
- package/dist/{WeaviateProvider-4CAPQ7UY.mjs → WeaviateProvider-5FWDFITI.mjs} +2 -2
- package/dist/{chunk-5KNBWQM6.mjs → chunk-3DSHW676.mjs} +5 -1
- package/dist/{chunk-PRC5CZIZ.mjs → chunk-5W2YWFT3.mjs} +1248 -1361
- package/dist/{chunk-H6RKMU7W.mjs → chunk-5YGUXK7Z.mjs} +1 -1
- package/dist/{chunk-PQKTC73Y.mjs → chunk-CD6TSNL4.mjs} +67 -6
- package/dist/{chunk-RK2UDJA2.mjs → chunk-CFVEZTBJ.mjs} +1 -1
- package/dist/{chunk-LJWWPTWE.mjs → chunk-FLOSGE6A.mjs} +76 -14
- package/dist/{chunk-GQT5LF4G.mjs → chunk-LR3VMDVK.mjs} +2 -2
- package/dist/{chunk-KTS3LLHY.mjs → chunk-M6JSPGAR.mjs} +5 -5
- package/dist/{chunk-3QWAK3RZ.mjs → chunk-U55XRW3U.mjs} +6 -2
- package/dist/{chunk-XCNXPECE.mjs → chunk-VUQJVIJT.mjs} +55 -1
- package/dist/chunk-X4TOT24V.mjs +89 -0
- package/dist/{chunk-EDLTMSNY.mjs → chunk-YLTMFW4M.mjs} +1 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1488 -1371
- package/dist/handlers/index.mjs +5 -3
- package/dist/index-B2mutkgp.d.ts +116 -0
- package/dist/index-Bjy0es5a.d.mts +116 -0
- package/dist/index.d.mts +17 -11
- package/dist/index.d.ts +17 -11
- package/dist/index.js +253 -363
- package/dist/index.mjs +243 -353
- package/dist/server.d.mts +108 -158
- package/dist/server.d.ts +108 -158
- package/dist/server.js +1452 -1386
- package/dist/server.mjs +12 -12
- package/package.json +5 -1
- package/src/config/RagConfig.ts +7 -0
- package/src/core/ConfigValidator.ts +66 -492
- package/src/core/LangChainAgent.ts +78 -0
- package/src/core/Pipeline.ts +210 -240
- package/src/core/ProviderHealthCheck.ts +35 -406
- package/src/core/ProviderInterfaces.ts +37 -0
- package/src/core/ProviderRegistry.ts +70 -55
- package/src/core/QueryProcessor.ts +173 -0
- package/src/core/VectorPlugin.ts +7 -0
- package/src/handlers/index.ts +45 -0
- package/src/llm/ILLMProvider.ts +10 -0
- package/src/llm/LLMFactory.ts +33 -13
- package/src/llm/providers/AnthropicProvider.ts +55 -15
- package/src/llm/providers/GeminiProvider.ts +51 -0
- package/src/llm/providers/OllamaProvider.ts +100 -15
- package/src/llm/providers/OpenAIProvider.ts +60 -11
- package/src/providers/vectordb/BaseVectorProvider.ts +11 -0
- package/src/providers/vectordb/MilvusProvider.ts +4 -0
- package/src/providers/vectordb/MongoDBProvider.ts +72 -8
- package/src/providers/vectordb/PineconeProvider.ts +60 -5
- package/src/providers/vectordb/PostgreSQLProvider.ts +84 -14
- package/src/providers/vectordb/QdrantProvider.ts +4 -0
- package/src/providers/vectordb/WeaviateProvider.ts +8 -4
- package/src/rag/DocumentChunker.ts +15 -19
- package/src/rag/EntityExtractor.ts +3 -0
- package/src/rag/LlamaIndexIngestor.ts +61 -0
- package/src/rag/Reranker.ts +20 -0
- package/src/server.ts +1 -1
- package/src/types/index.ts +9 -0
- package/dist/chunk-FWCSY2DS.mjs +0 -37
- package/dist/index-7qeLTPBL.d.mts +0 -114
- package/dist/index-DowY4_K0.d.ts +0 -114
package/dist/server.d.mts
CHANGED
|
@@ -1,96 +1,11 @@
|
|
|
1
|
-
import { c as RagConfig, C as ChatResponse, I as IngestDocument,
|
|
2
|
-
export { R as RAGConfig, U as UIConfig } from './RagConfig-
|
|
3
|
-
import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-
|
|
4
|
-
export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-
|
|
5
|
-
import { H as HealthCheckResult } from './index-
|
|
6
|
-
export {
|
|
1
|
+
import { e as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, c as RagConfig, C as ChatResponse, I as IngestDocument, g as RetrievalResult, d as UpsertDocument, V as VectorMatch, G as GraphDBConfig, h as GraphNode, i as Edge, j as GraphSearchResult, f as VectorDBProvider, b as LLMProvider, a as EmbeddingProvider } from './RagConfig-DRJO4hGU.mjs';
|
|
2
|
+
export { R as RAGConfig, U as UIConfig } from './RagConfig-DRJO4hGU.mjs';
|
|
3
|
+
import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-C-sCZPhi.mjs';
|
|
4
|
+
export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-C-sCZPhi.mjs';
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-Bjy0es5a.mjs';
|
|
6
|
+
export { C as ConfigValidator, V as ValidationError, c as createChatHandler, b as createHealthHandler, d as createIngestHandler, e as createUploadHandler } from './index-Bjy0es5a.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
9
|
/**
|
|
95
10
|
* BatchProcessor.ts — Handles batch operations with retry logic.
|
|
96
11
|
*
|
|
@@ -157,6 +72,31 @@ declare class BatchProcessor {
|
|
|
157
72
|
static processConcurrent<T, R>(items: T[], processor: (item: T) => Promise<R>, concurrency?: number, options?: BatchOptions): Promise<BatchResult<R>>;
|
|
158
73
|
}
|
|
159
74
|
|
|
75
|
+
/**
|
|
76
|
+
* ProviderHealthCheck.ts — Pre-flight validation for vector DB and LLM providers.
|
|
77
|
+
* Performs connectivity tests, credential validation, and capability checks.
|
|
78
|
+
*/
|
|
79
|
+
declare class ProviderHealthCheck {
|
|
80
|
+
/**
|
|
81
|
+
* Validates vector database configuration before initialization.
|
|
82
|
+
*/
|
|
83
|
+
static checkVectorProvider(config: VectorDBConfig): Promise<HealthCheckResult>;
|
|
84
|
+
private static fallbackVectorHealthCheck;
|
|
85
|
+
/**
|
|
86
|
+
* Validates LLM provider configuration.
|
|
87
|
+
*/
|
|
88
|
+
static checkLLMProvider(config: LLMConfig): Promise<HealthCheckResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Runs comprehensive health checks on all configured providers in parallel.
|
|
91
|
+
*/
|
|
92
|
+
static checkAll(vectorDbConfig: VectorDBConfig, llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): Promise<{
|
|
93
|
+
vectorDb: HealthCheckResult;
|
|
94
|
+
llm: HealthCheckResult;
|
|
95
|
+
embedding?: HealthCheckResult;
|
|
96
|
+
allHealthy: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
}
|
|
99
|
+
|
|
160
100
|
/**
|
|
161
101
|
* VectorPlugin — main orchestrator class.
|
|
162
102
|
* This is the primary interface for host applications.
|
|
@@ -212,6 +152,10 @@ declare class VectorPlugin {
|
|
|
212
152
|
* Run a chat query.
|
|
213
153
|
*/
|
|
214
154
|
chat(message: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Run a streaming chat query.
|
|
157
|
+
*/
|
|
158
|
+
chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, any>;
|
|
215
159
|
/**
|
|
216
160
|
* Ingest documents into the vector database.
|
|
217
161
|
*/
|
|
@@ -232,13 +176,17 @@ declare class VectorPlugin {
|
|
|
232
176
|
* - Multi-tenancy support via namespacing
|
|
233
177
|
*/
|
|
234
178
|
declare class Pipeline {
|
|
179
|
+
private config;
|
|
235
180
|
private vectorDB;
|
|
236
181
|
private graphDB?;
|
|
237
182
|
private llmProvider;
|
|
238
183
|
private embeddingProvider;
|
|
239
184
|
private chunker;
|
|
185
|
+
private llamaIngestor?;
|
|
240
186
|
private entityExtractor?;
|
|
241
|
-
private
|
|
187
|
+
private reranker;
|
|
188
|
+
private agent?;
|
|
189
|
+
private embeddingCache;
|
|
242
190
|
private initialised;
|
|
243
191
|
constructor(config: RagConfig);
|
|
244
192
|
initialize(): Promise<void>;
|
|
@@ -250,7 +198,36 @@ declare class Pipeline {
|
|
|
250
198
|
docId: string | number;
|
|
251
199
|
chunksIngested: number;
|
|
252
200
|
}>>;
|
|
201
|
+
/**
|
|
202
|
+
* Step 1: Chunk the document content.
|
|
203
|
+
*/
|
|
204
|
+
private prepareChunks;
|
|
205
|
+
/**
|
|
206
|
+
* Step 2: Generate embeddings for chunks with retry logic.
|
|
207
|
+
*/
|
|
208
|
+
private processEmbeddings;
|
|
209
|
+
/**
|
|
210
|
+
* Step 3: Upsert chunks to vector database with retry logic.
|
|
211
|
+
*/
|
|
212
|
+
private processUpserts;
|
|
213
|
+
/**
|
|
214
|
+
* Step 4: Optional graph-based entity extraction and ingestion.
|
|
215
|
+
*/
|
|
216
|
+
private processGraphIngestion;
|
|
253
217
|
ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
|
|
218
|
+
/**
|
|
219
|
+
* High-performance streaming RAG flow.
|
|
220
|
+
* Yields text chunks first, then the retrieval metadata at the end.
|
|
221
|
+
*/
|
|
222
|
+
askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Universal retrieval method combining all enabled providers.
|
|
225
|
+
*/
|
|
226
|
+
retrieve(query: string, options: {
|
|
227
|
+
namespace?: string;
|
|
228
|
+
topK?: number;
|
|
229
|
+
filter?: Record<string, unknown>;
|
|
230
|
+
}): Promise<RetrievalResult>;
|
|
254
231
|
/**
|
|
255
232
|
* Rewrite the user query for better retrieval performance.
|
|
256
233
|
*/
|
|
@@ -313,6 +290,14 @@ declare abstract class BaseVectorProvider {
|
|
|
313
290
|
* Gracefully close the connection.
|
|
314
291
|
*/
|
|
315
292
|
abstract disconnect(): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Returns a validator for this provider's configuration.
|
|
295
|
+
*/
|
|
296
|
+
static getValidator?(): IProviderValidator;
|
|
297
|
+
/**
|
|
298
|
+
* Returns a health checker for this provider.
|
|
299
|
+
*/
|
|
300
|
+
static getHealthChecker?(): IProviderHealthChecker;
|
|
316
301
|
/**
|
|
317
302
|
* Remove internal keys (starting with __) and queryText from a filter object
|
|
318
303
|
* before passing it to an external provider that might not support them.
|
|
@@ -354,31 +339,25 @@ declare abstract class BaseGraphProvider {
|
|
|
354
339
|
|
|
355
340
|
/**
|
|
356
341
|
* ProviderRegistry — dynamic provider loader for Vector DBs and LLMs.
|
|
357
|
-
*
|
|
358
|
-
* Supports:
|
|
359
|
-
* - Built-in providers loaded on-demand via dynamic imports (tree-shaking friendly)
|
|
360
|
-
* - Custom provider registration via registerVectorProvider()
|
|
361
342
|
*/
|
|
343
|
+
type VectorProviderClass = {
|
|
344
|
+
new (config: VectorDBConfig): BaseVectorProvider;
|
|
345
|
+
getValidator?: () => IProviderValidator;
|
|
346
|
+
getHealthChecker?: () => IProviderHealthChecker;
|
|
347
|
+
};
|
|
362
348
|
declare class ProviderRegistry {
|
|
363
349
|
private static vectorProviders;
|
|
364
350
|
private static graphProviders;
|
|
365
|
-
static
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
static
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*/
|
|
351
|
+
private static vectorValidators;
|
|
352
|
+
private static vectorHealthCheckers;
|
|
353
|
+
private static llmValidators;
|
|
354
|
+
private static llmHealthCheckers;
|
|
355
|
+
static registerVectorProvider(name: string, providerClass: VectorProviderClass): void;
|
|
356
|
+
static getVectorValidator(provider: string): Promise<IProviderValidator | null>;
|
|
357
|
+
static getVectorHealthChecker(provider: string): Promise<IProviderHealthChecker | null>;
|
|
358
|
+
private static loadVectorProviderClass;
|
|
374
359
|
static createVectorProvider(config: VectorDBConfig): Promise<BaseVectorProvider>;
|
|
375
|
-
/**
|
|
376
|
-
* Creates a graph database provider based on the configuration.
|
|
377
|
-
*/
|
|
378
360
|
static createGraphProvider(config: GraphDBConfig): Promise<BaseGraphProvider>;
|
|
379
|
-
/**
|
|
380
|
-
* Creates an LLM provider based on the configuration.
|
|
381
|
-
*/
|
|
382
361
|
static createLLMProvider(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): ILLMProvider;
|
|
383
362
|
}
|
|
384
363
|
|
|
@@ -698,16 +677,13 @@ declare class DocumentParser {
|
|
|
698
677
|
|
|
699
678
|
/**
|
|
700
679
|
* PineconeProvider — Pinecone vector database implementation.
|
|
701
|
-
*
|
|
702
|
-
* Compatible with @pinecone-database/pinecone v7.x SDK.
|
|
703
|
-
*
|
|
704
|
-
* Required options: { apiKey: string }
|
|
705
|
-
* The `environment` option is no longer needed (removed in SDK v5+).
|
|
706
680
|
*/
|
|
707
681
|
declare class PineconeProvider extends BaseVectorProvider {
|
|
708
682
|
private client;
|
|
709
683
|
private readonly apiKey;
|
|
710
684
|
constructor(config: VectorDBConfig);
|
|
685
|
+
static getValidator(): IProviderValidator;
|
|
686
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
711
687
|
initialize(): Promise<void>;
|
|
712
688
|
private index;
|
|
713
689
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
@@ -728,6 +704,8 @@ declare class PostgreSQLProvider extends BaseVectorProvider {
|
|
|
728
704
|
private readonly connectionString;
|
|
729
705
|
private readonly tableName;
|
|
730
706
|
constructor(config: VectorDBConfig);
|
|
707
|
+
static getValidator(): IProviderValidator;
|
|
708
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
731
709
|
initialize(): Promise<void>;
|
|
732
710
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
733
711
|
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
@@ -786,16 +764,14 @@ declare class MongoDBProvider extends BaseVectorProvider {
|
|
|
786
764
|
private contentKey;
|
|
787
765
|
private metadataKey;
|
|
788
766
|
constructor(config: VectorDBConfig);
|
|
767
|
+
static getValidator(): IProviderValidator;
|
|
768
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
789
769
|
initialize(): Promise<void>;
|
|
790
770
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
791
771
|
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
792
772
|
query(vector: number[], topK: number, namespace?: string, filter?: Record<string, unknown>): Promise<VectorMatch[]>;
|
|
793
773
|
delete(id: string | number, namespace?: string): Promise<void>;
|
|
794
774
|
deleteNamespace(namespace: string): Promise<void>;
|
|
795
|
-
/**
|
|
796
|
-
* Sanitise and flatten filter for MongoDB.
|
|
797
|
-
* Strips internal engine fields and keywords.
|
|
798
|
-
*/
|
|
799
775
|
protected sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown>;
|
|
800
776
|
ping(): Promise<boolean>;
|
|
801
777
|
disconnect(): Promise<void>;
|
|
@@ -960,33 +936,20 @@ declare class UniversalVectorProvider extends BaseVectorProvider {
|
|
|
960
936
|
|
|
961
937
|
/**
|
|
962
938
|
* LLMFactory — instantiates the correct ILLMProvider based on llmConfig.provider.
|
|
963
|
-
*
|
|
964
|
-
* Also accepts an optional EmbeddingConfig so providers that support embedding
|
|
965
|
-
* can be initialised with separate embedding credentials.
|
|
966
939
|
*/
|
|
967
|
-
|
|
968
940
|
declare class LLMFactory {
|
|
969
941
|
static create(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): ILLMProvider;
|
|
942
|
+
static getValidator(provider: LLMProvider): IProviderValidator | null;
|
|
943
|
+
static getHealthChecker(provider: LLMProvider): IProviderHealthChecker | null;
|
|
944
|
+
private static getProviderClass;
|
|
970
945
|
/**
|
|
971
946
|
* Creates a dedicated embedding-only provider.
|
|
972
|
-
* Useful when the LLM provider (e.g. Anthropic) doesn't support embeddings.
|
|
973
947
|
*/
|
|
974
948
|
static createEmbeddingProvider(embeddingConfig: EmbeddingConfig): ILLMProvider;
|
|
975
949
|
}
|
|
976
950
|
|
|
977
951
|
/**
|
|
978
952
|
* OpenAI LLM Provider
|
|
979
|
-
*
|
|
980
|
-
* Handles both chat completion (GPT-4o, GPT-4-turbo, etc.) and
|
|
981
|
-
* embedding (text-embedding-ada-002, text-embedding-3-small/large).
|
|
982
|
-
*
|
|
983
|
-
* Required LLMConfig fields:
|
|
984
|
-
* - apiKey: string – OpenAI API key
|
|
985
|
-
* - model: string – e.g. "gpt-4o"
|
|
986
|
-
*
|
|
987
|
-
* Required EmbeddingConfig fields (when used for embedding):
|
|
988
|
-
* - apiKey: string – same or separate key
|
|
989
|
-
* - model: string – e.g. "text-embedding-3-small"
|
|
990
953
|
*/
|
|
991
954
|
|
|
992
955
|
declare class OpenAIProvider implements ILLMProvider {
|
|
@@ -994,6 +957,8 @@ declare class OpenAIProvider implements ILLMProvider {
|
|
|
994
957
|
private readonly llmConfig;
|
|
995
958
|
private readonly embeddingConfig?;
|
|
996
959
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
960
|
+
static getValidator(): IProviderValidator;
|
|
961
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
997
962
|
chat(messages: ChatMessage[], context: string, options?: ChatOptions): Promise<string>;
|
|
998
963
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
999
964
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
@@ -1002,14 +967,6 @@ declare class OpenAIProvider implements ILLMProvider {
|
|
|
1002
967
|
|
|
1003
968
|
/**
|
|
1004
969
|
* Anthropic (Claude) LLM Provider
|
|
1005
|
-
*
|
|
1006
|
-
* Handles chat completion via Anthropic's Messages API.
|
|
1007
|
-
* Note: Anthropic does NOT provide embedding models — use OpenAIProvider
|
|
1008
|
-
* or OllamaProvider for embedding when pairing with this provider.
|
|
1009
|
-
*
|
|
1010
|
-
* Required LLMConfig fields:
|
|
1011
|
-
* - apiKey: string – Anthropic API key
|
|
1012
|
-
* - model: string – e.g. "claude-3-5-sonnet-20241022"
|
|
1013
970
|
*/
|
|
1014
971
|
|
|
1015
972
|
declare class AnthropicProvider implements ILLMProvider {
|
|
@@ -1017,12 +974,9 @@ declare class AnthropicProvider implements ILLMProvider {
|
|
|
1017
974
|
private readonly llmConfig;
|
|
1018
975
|
private readonly embeddingConfig?;
|
|
1019
976
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
977
|
+
static getValidator(): IProviderValidator;
|
|
978
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
1020
979
|
chat(messages: ChatMessage[], context: string, options?: ChatOptions): Promise<string>;
|
|
1021
|
-
/**
|
|
1022
|
-
* Anthropic does not offer an embedding API.
|
|
1023
|
-
* This method throws with a clear error so developers know to configure
|
|
1024
|
-
* a separate embedding provider (OpenAI or Ollama).
|
|
1025
|
-
*/
|
|
1026
980
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
1027
981
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
1028
982
|
ping(): Promise<boolean>;
|
|
@@ -1030,14 +984,6 @@ declare class AnthropicProvider implements ILLMProvider {
|
|
|
1030
984
|
|
|
1031
985
|
/**
|
|
1032
986
|
* Ollama LLM Provider (local / self-hosted)
|
|
1033
|
-
*
|
|
1034
|
-
* Communicates with an Ollama server via its REST API.
|
|
1035
|
-
* Supports both chat completion and embedding (requires a model with embed support,
|
|
1036
|
-
* e.g. "nomic-embed-text", "mxbai-embed-large").
|
|
1037
|
-
*
|
|
1038
|
-
* Required LLMConfig fields:
|
|
1039
|
-
* - model: string – e.g. "llama3", "mistral", "gemma2"
|
|
1040
|
-
* - baseUrl?: string – Ollama server URL (default "http://localhost:11434")
|
|
1041
987
|
*/
|
|
1042
988
|
|
|
1043
989
|
declare class OllamaProvider implements ILLMProvider {
|
|
@@ -1045,7 +991,11 @@ declare class OllamaProvider implements ILLMProvider {
|
|
|
1045
991
|
private readonly llmConfig;
|
|
1046
992
|
private readonly embeddingConfig?;
|
|
1047
993
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
994
|
+
static getValidator(): IProviderValidator;
|
|
995
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
1048
996
|
chat(messages: ChatMessage[], context: string, options?: ChatOptions): Promise<string>;
|
|
997
|
+
chatStream(messages: ChatMessage[], context: string, options?: ChatOptions): AsyncIterable<string>;
|
|
998
|
+
private buildSystemPrompt;
|
|
1049
999
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
1050
1000
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
1051
1001
|
ping(): Promise<boolean>;
|
|
@@ -1065,4 +1015,4 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1065
1015
|
ping(): Promise<boolean>;
|
|
1066
1016
|
}
|
|
1067
1017
|
|
|
1068
|
-
export { AnthropicProvider, BaseVectorProvider, type BatchOptions, BatchProcessor, type BatchResult, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver,
|
|
1018
|
+
export { AnthropicProvider, BaseVectorProvider, type BatchOptions, BatchProcessor, type BatchResult, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, DocumentParser, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IngestDocument, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, MilvusProvider, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, Pipeline, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, RagConfig, RedisProvider, UniversalLLMAdapter, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VectorPlugin, WeaviateProvider, createFromPreset, getRagConfig };
|