@retrivora-ai/rag-engine 0.4.5 → 1.0.0
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-APQVJ5F7.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-35US67MS.mjs} +2 -2
- package/dist/{MongoDBProvider-RE3Q5S5B.mjs → MongoDBProvider-COVYZDP6.mjs} +2 -2
- package/dist/{PineconeProvider-BE2JWSPD.mjs → PineconeProvider-AWFJQDZL.mjs} +2 -2
- package/dist/{PostgreSQLProvider-5HHTK4SU.mjs → PostgreSQLProvider-IEYRJ7XJ.mjs} +2 -2
- package/dist/{QdrantProvider-XVDVBNIG.mjs → QdrantProvider-M6TQYZRO.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-3G5PBLZ4.mjs} +2 -2
- package/dist/{SimpleGraphProvider-M6T7SE7D.mjs → SimpleGraphProvider-UK7DJW37.mjs} +1 -1
- package/dist/{UniversalVectorProvider-YIDRX6VT.mjs → UniversalVectorProvider-FYQ3B2PW.mjs} +3 -3
- package/dist/{WeaviateProvider-4CAPQ7UY.mjs → WeaviateProvider-ITHO36IL.mjs} +2 -2
- package/dist/{chunk-5KNBWQM6.mjs → chunk-4A47RCG2.mjs} +5 -1
- package/dist/{chunk-EDLTMSNY.mjs → chunk-67AJ6SMD.mjs} +1 -1
- package/dist/{chunk-PQKTC73Y.mjs → chunk-7SOSCZGS.mjs} +67 -6
- package/dist/{chunk-LJWWPTWE.mjs → chunk-FLOSGE6A.mjs} +76 -14
- package/dist/{chunk-H6RKMU7W.mjs → chunk-NXUCKY5L.mjs} +1 -1
- package/dist/{chunk-KTS3LLHY.mjs → chunk-OOQXNLXD.mjs} +5 -5
- package/dist/{chunk-PRC5CZIZ.mjs → chunk-P4HAQ7KB.mjs} +1184 -1359
- package/dist/chunk-QMIKLALV.mjs +57 -0
- package/dist/{chunk-3QWAK3RZ.mjs → chunk-TYHTZIDP.mjs} +6 -2
- package/dist/{chunk-GQT5LF4G.mjs → chunk-U6KHVZLF.mjs} +2 -2
- package/dist/{chunk-RK2UDJA2.mjs → chunk-WGSZNY3X.mjs} +1 -1
- package/dist/{chunk-XCNXPECE.mjs → chunk-ZNBKHNJ4.mjs} +55 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1415 -1391
- package/dist/handlers/index.mjs +3 -3
- package/dist/index-CrGMwXfO.d.ts +112 -0
- package/dist/index-v669iV-k.d.mts +112 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/server.d.mts +104 -158
- package/dist/server.d.ts +104 -158
- package/dist/server.js +1414 -1390
- 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/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/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.ts
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.js';
|
|
2
|
+
export { R as RAGConfig, U as UIConfig } from './RagConfig-DRJO4hGU.js';
|
|
3
|
+
import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-C-sCZPhi.js';
|
|
4
|
+
export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-C-sCZPhi.js';
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-CrGMwXfO.js';
|
|
6
|
+
export { C as ConfigValidator, V as ValidationError, c as createChatHandler, b as createHealthHandler, d as createIngestHandler, e as createUploadHandler } from './index-CrGMwXfO.js';
|
|
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.
|
|
@@ -232,13 +172,17 @@ declare class VectorPlugin {
|
|
|
232
172
|
* - Multi-tenancy support via namespacing
|
|
233
173
|
*/
|
|
234
174
|
declare class Pipeline {
|
|
175
|
+
private config;
|
|
235
176
|
private vectorDB;
|
|
236
177
|
private graphDB?;
|
|
237
178
|
private llmProvider;
|
|
238
179
|
private embeddingProvider;
|
|
239
180
|
private chunker;
|
|
181
|
+
private llamaIngestor?;
|
|
240
182
|
private entityExtractor?;
|
|
241
|
-
private
|
|
183
|
+
private reranker;
|
|
184
|
+
private agent?;
|
|
185
|
+
private embeddingCache;
|
|
242
186
|
private initialised;
|
|
243
187
|
constructor(config: RagConfig);
|
|
244
188
|
initialize(): Promise<void>;
|
|
@@ -250,7 +194,36 @@ declare class Pipeline {
|
|
|
250
194
|
docId: string | number;
|
|
251
195
|
chunksIngested: number;
|
|
252
196
|
}>>;
|
|
197
|
+
/**
|
|
198
|
+
* Step 1: Chunk the document content.
|
|
199
|
+
*/
|
|
200
|
+
private prepareChunks;
|
|
201
|
+
/**
|
|
202
|
+
* Step 2: Generate embeddings for chunks with retry logic.
|
|
203
|
+
*/
|
|
204
|
+
private processEmbeddings;
|
|
205
|
+
/**
|
|
206
|
+
* Step 3: Upsert chunks to vector database with retry logic.
|
|
207
|
+
*/
|
|
208
|
+
private processUpserts;
|
|
209
|
+
/**
|
|
210
|
+
* Step 4: Optional graph-based entity extraction and ingestion.
|
|
211
|
+
*/
|
|
212
|
+
private processGraphIngestion;
|
|
253
213
|
ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* High-performance streaming RAG flow.
|
|
216
|
+
* Yields text chunks first, then the retrieval metadata at the end.
|
|
217
|
+
*/
|
|
218
|
+
askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
|
|
219
|
+
/**
|
|
220
|
+
* Universal retrieval method combining all enabled providers.
|
|
221
|
+
*/
|
|
222
|
+
retrieve(query: string, options: {
|
|
223
|
+
namespace?: string;
|
|
224
|
+
topK?: number;
|
|
225
|
+
filter?: Record<string, unknown>;
|
|
226
|
+
}): Promise<RetrievalResult>;
|
|
254
227
|
/**
|
|
255
228
|
* Rewrite the user query for better retrieval performance.
|
|
256
229
|
*/
|
|
@@ -313,6 +286,14 @@ declare abstract class BaseVectorProvider {
|
|
|
313
286
|
* Gracefully close the connection.
|
|
314
287
|
*/
|
|
315
288
|
abstract disconnect(): Promise<void>;
|
|
289
|
+
/**
|
|
290
|
+
* Returns a validator for this provider's configuration.
|
|
291
|
+
*/
|
|
292
|
+
static getValidator?(): IProviderValidator;
|
|
293
|
+
/**
|
|
294
|
+
* Returns a health checker for this provider.
|
|
295
|
+
*/
|
|
296
|
+
static getHealthChecker?(): IProviderHealthChecker;
|
|
316
297
|
/**
|
|
317
298
|
* Remove internal keys (starting with __) and queryText from a filter object
|
|
318
299
|
* before passing it to an external provider that might not support them.
|
|
@@ -354,31 +335,25 @@ declare abstract class BaseGraphProvider {
|
|
|
354
335
|
|
|
355
336
|
/**
|
|
356
337
|
* 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
338
|
*/
|
|
339
|
+
type VectorProviderClass = {
|
|
340
|
+
new (config: VectorDBConfig): BaseVectorProvider;
|
|
341
|
+
getValidator?: () => IProviderValidator;
|
|
342
|
+
getHealthChecker?: () => IProviderHealthChecker;
|
|
343
|
+
};
|
|
362
344
|
declare class ProviderRegistry {
|
|
363
345
|
private static vectorProviders;
|
|
364
346
|
private static graphProviders;
|
|
365
|
-
static
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
static
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*/
|
|
347
|
+
private static vectorValidators;
|
|
348
|
+
private static vectorHealthCheckers;
|
|
349
|
+
private static llmValidators;
|
|
350
|
+
private static llmHealthCheckers;
|
|
351
|
+
static registerVectorProvider(name: string, providerClass: VectorProviderClass): void;
|
|
352
|
+
static getVectorValidator(provider: string): Promise<IProviderValidator | null>;
|
|
353
|
+
static getVectorHealthChecker(provider: string): Promise<IProviderHealthChecker | null>;
|
|
354
|
+
private static loadVectorProviderClass;
|
|
374
355
|
static createVectorProvider(config: VectorDBConfig): Promise<BaseVectorProvider>;
|
|
375
|
-
/**
|
|
376
|
-
* Creates a graph database provider based on the configuration.
|
|
377
|
-
*/
|
|
378
356
|
static createGraphProvider(config: GraphDBConfig): Promise<BaseGraphProvider>;
|
|
379
|
-
/**
|
|
380
|
-
* Creates an LLM provider based on the configuration.
|
|
381
|
-
*/
|
|
382
357
|
static createLLMProvider(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): ILLMProvider;
|
|
383
358
|
}
|
|
384
359
|
|
|
@@ -698,16 +673,13 @@ declare class DocumentParser {
|
|
|
698
673
|
|
|
699
674
|
/**
|
|
700
675
|
* 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
676
|
*/
|
|
707
677
|
declare class PineconeProvider extends BaseVectorProvider {
|
|
708
678
|
private client;
|
|
709
679
|
private readonly apiKey;
|
|
710
680
|
constructor(config: VectorDBConfig);
|
|
681
|
+
static getValidator(): IProviderValidator;
|
|
682
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
711
683
|
initialize(): Promise<void>;
|
|
712
684
|
private index;
|
|
713
685
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
@@ -728,6 +700,8 @@ declare class PostgreSQLProvider extends BaseVectorProvider {
|
|
|
728
700
|
private readonly connectionString;
|
|
729
701
|
private readonly tableName;
|
|
730
702
|
constructor(config: VectorDBConfig);
|
|
703
|
+
static getValidator(): IProviderValidator;
|
|
704
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
731
705
|
initialize(): Promise<void>;
|
|
732
706
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
733
707
|
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
@@ -786,16 +760,14 @@ declare class MongoDBProvider extends BaseVectorProvider {
|
|
|
786
760
|
private contentKey;
|
|
787
761
|
private metadataKey;
|
|
788
762
|
constructor(config: VectorDBConfig);
|
|
763
|
+
static getValidator(): IProviderValidator;
|
|
764
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
789
765
|
initialize(): Promise<void>;
|
|
790
766
|
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
791
767
|
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
792
768
|
query(vector: number[], topK: number, namespace?: string, filter?: Record<string, unknown>): Promise<VectorMatch[]>;
|
|
793
769
|
delete(id: string | number, namespace?: string): Promise<void>;
|
|
794
770
|
deleteNamespace(namespace: string): Promise<void>;
|
|
795
|
-
/**
|
|
796
|
-
* Sanitise and flatten filter for MongoDB.
|
|
797
|
-
* Strips internal engine fields and keywords.
|
|
798
|
-
*/
|
|
799
771
|
protected sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown>;
|
|
800
772
|
ping(): Promise<boolean>;
|
|
801
773
|
disconnect(): Promise<void>;
|
|
@@ -960,33 +932,20 @@ declare class UniversalVectorProvider extends BaseVectorProvider {
|
|
|
960
932
|
|
|
961
933
|
/**
|
|
962
934
|
* 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
935
|
*/
|
|
967
|
-
|
|
968
936
|
declare class LLMFactory {
|
|
969
937
|
static create(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): ILLMProvider;
|
|
938
|
+
static getValidator(provider: LLMProvider): IProviderValidator | null;
|
|
939
|
+
static getHealthChecker(provider: LLMProvider): IProviderHealthChecker | null;
|
|
940
|
+
private static getProviderClass;
|
|
970
941
|
/**
|
|
971
942
|
* Creates a dedicated embedding-only provider.
|
|
972
|
-
* Useful when the LLM provider (e.g. Anthropic) doesn't support embeddings.
|
|
973
943
|
*/
|
|
974
944
|
static createEmbeddingProvider(embeddingConfig: EmbeddingConfig): ILLMProvider;
|
|
975
945
|
}
|
|
976
946
|
|
|
977
947
|
/**
|
|
978
948
|
* 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
949
|
*/
|
|
991
950
|
|
|
992
951
|
declare class OpenAIProvider implements ILLMProvider {
|
|
@@ -994,6 +953,8 @@ declare class OpenAIProvider implements ILLMProvider {
|
|
|
994
953
|
private readonly llmConfig;
|
|
995
954
|
private readonly embeddingConfig?;
|
|
996
955
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
956
|
+
static getValidator(): IProviderValidator;
|
|
957
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
997
958
|
chat(messages: ChatMessage[], context: string, options?: ChatOptions): Promise<string>;
|
|
998
959
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
999
960
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
@@ -1002,14 +963,6 @@ declare class OpenAIProvider implements ILLMProvider {
|
|
|
1002
963
|
|
|
1003
964
|
/**
|
|
1004
965
|
* 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
966
|
*/
|
|
1014
967
|
|
|
1015
968
|
declare class AnthropicProvider implements ILLMProvider {
|
|
@@ -1017,12 +970,9 @@ declare class AnthropicProvider implements ILLMProvider {
|
|
|
1017
970
|
private readonly llmConfig;
|
|
1018
971
|
private readonly embeddingConfig?;
|
|
1019
972
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
973
|
+
static getValidator(): IProviderValidator;
|
|
974
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
1020
975
|
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
976
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
1027
977
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
1028
978
|
ping(): Promise<boolean>;
|
|
@@ -1030,14 +980,6 @@ declare class AnthropicProvider implements ILLMProvider {
|
|
|
1030
980
|
|
|
1031
981
|
/**
|
|
1032
982
|
* 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
983
|
*/
|
|
1042
984
|
|
|
1043
985
|
declare class OllamaProvider implements ILLMProvider {
|
|
@@ -1045,7 +987,11 @@ declare class OllamaProvider implements ILLMProvider {
|
|
|
1045
987
|
private readonly llmConfig;
|
|
1046
988
|
private readonly embeddingConfig?;
|
|
1047
989
|
constructor(llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig);
|
|
990
|
+
static getValidator(): IProviderValidator;
|
|
991
|
+
static getHealthChecker(): IProviderHealthChecker;
|
|
1048
992
|
chat(messages: ChatMessage[], context: string, options?: ChatOptions): Promise<string>;
|
|
993
|
+
chatStream(messages: ChatMessage[], context: string, options?: ChatOptions): AsyncIterable<string>;
|
|
994
|
+
private buildSystemPrompt;
|
|
1049
995
|
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
1050
996
|
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
1051
997
|
ping(): Promise<boolean>;
|
|
@@ -1065,4 +1011,4 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1065
1011
|
ping(): Promise<boolean>;
|
|
1066
1012
|
}
|
|
1067
1013
|
|
|
1068
|
-
export { AnthropicProvider, BaseVectorProvider, type BatchOptions, BatchProcessor, type BatchResult, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver,
|
|
1014
|
+
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 };
|