@retrivora-ai/rag-engine 0.1.6 → 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.
- package/dist/{ChromaDBProvider-QNI7UCX4.mjs → ChromaDBProvider-2JZSBOQX.mjs} +1 -1
- package/dist/{MilvusProvider-OO6QGZDZ.mjs → MilvusProvider-CJDBCBVI.mjs} +1 -1
- package/dist/{PineconeProvider-ZRAFNFEC.mjs → PineconeProvider-E6L5Z2FO.mjs} +1 -1
- package/dist/{QdrantProvider-NYGHAA7C.mjs → QdrantProvider-JITRNJQN.mjs} +1 -1
- package/dist/{RagConfig-hBGXJmSx.d.mts → RagConfig-D_rSf8ep.d.mts} +1 -1
- package/dist/{RagConfig-hBGXJmSx.d.ts → RagConfig-D_rSf8ep.d.ts} +1 -1
- package/dist/{RedisProvider-ASONNYBI.mjs → RedisProvider-3VKFQXXD.mjs} +1 -1
- package/dist/UniversalVectorProvider-E6L4U4OX.mjs +9 -0
- package/dist/{WeaviateProvider-PSDCUGC7.mjs → WeaviateProvider-MXIPP44J.mjs} +1 -1
- package/dist/{chunk-5K23H7JL.mjs → chunk-26EMHLIN.mjs} +40 -2
- package/dist/{chunk-VPNRDXIA.mjs → chunk-7BQI4A5J.mjs} +17 -11
- package/dist/{chunk-ZM6TYIDH.mjs → chunk-MFWJZVF3.mjs} +3 -1
- package/dist/{chunk-V75V7BT2.mjs → chunk-TSX6DQXX.mjs} +2 -2
- package/dist/{chunk-HUGLYKD6.mjs → chunk-XZPVJS2B.mjs} +27 -9
- package/dist/chunk-Y6HQZDCJ.mjs +156 -0
- package/dist/{chunk-HSBXE2WV.mjs → chunk-YIYDJQJM.mjs} +745 -192
- package/dist/{chunk-7NXI6ZWX.mjs → chunk-YST6KYBJ.mjs} +8 -5
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +924 -626
- package/dist/handlers/index.mjs +1 -2
- package/dist/index-BJ8CUArE.d.mts +114 -0
- package/dist/index-DtNprGGj.d.ts +114 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/server.d.mts +575 -17
- package/dist/server.d.ts +575 -17
- package/dist/server.js +1280 -643
- package/dist/server.mjs +314 -16
- package/package.json +11 -2
- package/src/config/ConfigBuilder.ts +373 -0
- package/src/config/EmbeddingStrategy.ts +147 -0
- package/src/config/serverConfig.ts +51 -17
- package/src/core/ConfigValidator.ts +77 -52
- package/src/core/Pipeline.ts +28 -26
- package/src/core/PluginManager.ts +277 -0
- package/src/core/ProviderHealthCheck.ts +79 -140
- package/src/core/ProviderRegistry.ts +38 -15
- package/src/providers/vectordb/ChromaDBProvider.ts +37 -12
- package/src/providers/vectordb/MilvusProvider.ts +25 -10
- package/src/providers/vectordb/PineconeProvider.ts +17 -2
- package/src/providers/vectordb/QdrantProvider.ts +46 -2
- package/src/providers/vectordb/RedisProvider.ts +34 -11
- package/src/providers/vectordb/UniversalVectorProvider.ts +220 -0
- package/src/providers/vectordb/WeaviateProvider.ts +17 -10
- package/src/server.ts +28 -10
- package/dist/LLMFactory-JFOY2V4X.mjs +0 -8
- package/dist/chunk-JI6VD5TJ.mjs +0 -387
- package/dist/index-Bx182KKn.d.ts +0 -64
- package/dist/index-Ck2pt7-8.d.mts +0 -64
- package/src/test-refactor.ts +0 -59
package/dist/handlers/index.mjs
CHANGED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { c as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, a as RagConfig, C as ChatResponse } from './RagConfig-D_rSf8ep.mjs';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ProviderHealthCheck.ts — Pre-flight validation for vector DB and LLM providers.
|
|
6
|
+
*
|
|
7
|
+
* Performs connectivity tests, credential validation, and capability checks
|
|
8
|
+
* before initializing providers.
|
|
9
|
+
*
|
|
10
|
+
* Note: Option keys used here mirror each Provider constructor's expected keys.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface HealthCheckResult {
|
|
14
|
+
healthy: boolean;
|
|
15
|
+
provider: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
capabilities?: Record<string, unknown>;
|
|
18
|
+
error?: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
}
|
|
21
|
+
declare class ProviderHealthCheck {
|
|
22
|
+
/**
|
|
23
|
+
* Validates vector database configuration before initialization.
|
|
24
|
+
*/
|
|
25
|
+
static checkVectorProvider(config: VectorDBConfig): Promise<HealthCheckResult>;
|
|
26
|
+
private static checkPinecone;
|
|
27
|
+
private static checkPostgres;
|
|
28
|
+
private static checkMongoDB;
|
|
29
|
+
/**
|
|
30
|
+
* Milvus health check — uses baseUrl/uri (matching MilvusProvider constructor).
|
|
31
|
+
*/
|
|
32
|
+
private static checkMilvus;
|
|
33
|
+
/**
|
|
34
|
+
* Qdrant health check — uses baseUrl (matching QdrantProvider constructor).
|
|
35
|
+
*/
|
|
36
|
+
private static checkQdrant;
|
|
37
|
+
/**
|
|
38
|
+
* ChromaDB health check — uses baseUrl/host (matching ChromaDBProvider constructor).
|
|
39
|
+
*/
|
|
40
|
+
private static checkChromaDB;
|
|
41
|
+
/**
|
|
42
|
+
* Redis health check — Redis is TCP-only (no HTTP endpoint).
|
|
43
|
+
* We report healthy=true with a note; actual connectivity is validated at first operation.
|
|
44
|
+
*/
|
|
45
|
+
private static checkRedis;
|
|
46
|
+
/**
|
|
47
|
+
* Weaviate health check — uses baseUrl/url (matching WeaviateProvider constructor).
|
|
48
|
+
*/
|
|
49
|
+
private static checkWeaviate;
|
|
50
|
+
private static checkRestAPI;
|
|
51
|
+
/**
|
|
52
|
+
* Validates LLM provider configuration.
|
|
53
|
+
*/
|
|
54
|
+
static checkLLMProvider(config: LLMConfig): Promise<HealthCheckResult>;
|
|
55
|
+
private static checkOpenAI;
|
|
56
|
+
private static checkAnthropic;
|
|
57
|
+
private static checkOllama;
|
|
58
|
+
private static checkLLMRestAPI;
|
|
59
|
+
/**
|
|
60
|
+
* Runs comprehensive health checks on all configured providers in parallel.
|
|
61
|
+
*/
|
|
62
|
+
static checkAll(vectorDbConfig: VectorDBConfig, llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): Promise<{
|
|
63
|
+
vectorDb: HealthCheckResult;
|
|
64
|
+
llm: HealthCheckResult;
|
|
65
|
+
embedding?: HealthCheckResult;
|
|
66
|
+
allHealthy: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* createChatHandler — factory that returns a Next.js App Router POST handler
|
|
72
|
+
*/
|
|
73
|
+
declare function createChatHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
74
|
+
error: string;
|
|
75
|
+
}> | NextResponse<ChatResponse>>;
|
|
76
|
+
/**
|
|
77
|
+
* createIngestHandler — factory for the document ingestion endpoint.
|
|
78
|
+
*/
|
|
79
|
+
declare function createIngestHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
80
|
+
error: string;
|
|
81
|
+
}> | NextResponse<{
|
|
82
|
+
results: {
|
|
83
|
+
docId: string | number;
|
|
84
|
+
chunksIngested: number;
|
|
85
|
+
}[];
|
|
86
|
+
}>>;
|
|
87
|
+
/**
|
|
88
|
+
* createHealthHandler — factory for the health-check endpoint.
|
|
89
|
+
*/
|
|
90
|
+
declare function createHealthHandler(config?: Partial<RagConfig>): () => Promise<NextResponse<{
|
|
91
|
+
timestamp: string;
|
|
92
|
+
vectorDb: HealthCheckResult;
|
|
93
|
+
llm: HealthCheckResult;
|
|
94
|
+
embedding?: HealthCheckResult;
|
|
95
|
+
allHealthy: boolean;
|
|
96
|
+
status: string;
|
|
97
|
+
}> | NextResponse<{
|
|
98
|
+
status: string;
|
|
99
|
+
error: string;
|
|
100
|
+
}>>;
|
|
101
|
+
/**
|
|
102
|
+
* createUploadHandler — factory for the file upload ingestion endpoint.
|
|
103
|
+
*/
|
|
104
|
+
declare function createUploadHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
105
|
+
error: string;
|
|
106
|
+
}> | NextResponse<{
|
|
107
|
+
message: string;
|
|
108
|
+
results: {
|
|
109
|
+
docId: string | number;
|
|
110
|
+
chunksIngested: number;
|
|
111
|
+
}[];
|
|
112
|
+
}>>;
|
|
113
|
+
|
|
114
|
+
export { type HealthCheckResult as H, ProviderHealthCheck as P, createHealthHandler as a, createIngestHandler as b, createChatHandler as c, createUploadHandler as d };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { c as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, a as RagConfig, C as ChatResponse } from './RagConfig-D_rSf8ep.js';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ProviderHealthCheck.ts — Pre-flight validation for vector DB and LLM providers.
|
|
6
|
+
*
|
|
7
|
+
* Performs connectivity tests, credential validation, and capability checks
|
|
8
|
+
* before initializing providers.
|
|
9
|
+
*
|
|
10
|
+
* Note: Option keys used here mirror each Provider constructor's expected keys.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface HealthCheckResult {
|
|
14
|
+
healthy: boolean;
|
|
15
|
+
provider: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
capabilities?: Record<string, unknown>;
|
|
18
|
+
error?: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
}
|
|
21
|
+
declare class ProviderHealthCheck {
|
|
22
|
+
/**
|
|
23
|
+
* Validates vector database configuration before initialization.
|
|
24
|
+
*/
|
|
25
|
+
static checkVectorProvider(config: VectorDBConfig): Promise<HealthCheckResult>;
|
|
26
|
+
private static checkPinecone;
|
|
27
|
+
private static checkPostgres;
|
|
28
|
+
private static checkMongoDB;
|
|
29
|
+
/**
|
|
30
|
+
* Milvus health check — uses baseUrl/uri (matching MilvusProvider constructor).
|
|
31
|
+
*/
|
|
32
|
+
private static checkMilvus;
|
|
33
|
+
/**
|
|
34
|
+
* Qdrant health check — uses baseUrl (matching QdrantProvider constructor).
|
|
35
|
+
*/
|
|
36
|
+
private static checkQdrant;
|
|
37
|
+
/**
|
|
38
|
+
* ChromaDB health check — uses baseUrl/host (matching ChromaDBProvider constructor).
|
|
39
|
+
*/
|
|
40
|
+
private static checkChromaDB;
|
|
41
|
+
/**
|
|
42
|
+
* Redis health check — Redis is TCP-only (no HTTP endpoint).
|
|
43
|
+
* We report healthy=true with a note; actual connectivity is validated at first operation.
|
|
44
|
+
*/
|
|
45
|
+
private static checkRedis;
|
|
46
|
+
/**
|
|
47
|
+
* Weaviate health check — uses baseUrl/url (matching WeaviateProvider constructor).
|
|
48
|
+
*/
|
|
49
|
+
private static checkWeaviate;
|
|
50
|
+
private static checkRestAPI;
|
|
51
|
+
/**
|
|
52
|
+
* Validates LLM provider configuration.
|
|
53
|
+
*/
|
|
54
|
+
static checkLLMProvider(config: LLMConfig): Promise<HealthCheckResult>;
|
|
55
|
+
private static checkOpenAI;
|
|
56
|
+
private static checkAnthropic;
|
|
57
|
+
private static checkOllama;
|
|
58
|
+
private static checkLLMRestAPI;
|
|
59
|
+
/**
|
|
60
|
+
* Runs comprehensive health checks on all configured providers in parallel.
|
|
61
|
+
*/
|
|
62
|
+
static checkAll(vectorDbConfig: VectorDBConfig, llmConfig: LLMConfig, embeddingConfig?: EmbeddingConfig): Promise<{
|
|
63
|
+
vectorDb: HealthCheckResult;
|
|
64
|
+
llm: HealthCheckResult;
|
|
65
|
+
embedding?: HealthCheckResult;
|
|
66
|
+
allHealthy: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* createChatHandler — factory that returns a Next.js App Router POST handler
|
|
72
|
+
*/
|
|
73
|
+
declare function createChatHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
74
|
+
error: string;
|
|
75
|
+
}> | NextResponse<ChatResponse>>;
|
|
76
|
+
/**
|
|
77
|
+
* createIngestHandler — factory for the document ingestion endpoint.
|
|
78
|
+
*/
|
|
79
|
+
declare function createIngestHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
80
|
+
error: string;
|
|
81
|
+
}> | NextResponse<{
|
|
82
|
+
results: {
|
|
83
|
+
docId: string | number;
|
|
84
|
+
chunksIngested: number;
|
|
85
|
+
}[];
|
|
86
|
+
}>>;
|
|
87
|
+
/**
|
|
88
|
+
* createHealthHandler — factory for the health-check endpoint.
|
|
89
|
+
*/
|
|
90
|
+
declare function createHealthHandler(config?: Partial<RagConfig>): () => Promise<NextResponse<{
|
|
91
|
+
timestamp: string;
|
|
92
|
+
vectorDb: HealthCheckResult;
|
|
93
|
+
llm: HealthCheckResult;
|
|
94
|
+
embedding?: HealthCheckResult;
|
|
95
|
+
allHealthy: boolean;
|
|
96
|
+
status: string;
|
|
97
|
+
}> | NextResponse<{
|
|
98
|
+
status: string;
|
|
99
|
+
error: string;
|
|
100
|
+
}>>;
|
|
101
|
+
/**
|
|
102
|
+
* createUploadHandler — factory for the file upload ingestion endpoint.
|
|
103
|
+
*/
|
|
104
|
+
declare function createUploadHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
105
|
+
error: string;
|
|
106
|
+
}> | NextResponse<{
|
|
107
|
+
message: string;
|
|
108
|
+
results: {
|
|
109
|
+
docId: string | number;
|
|
110
|
+
chunksIngested: number;
|
|
111
|
+
}[];
|
|
112
|
+
}>>;
|
|
113
|
+
|
|
114
|
+
export { type HealthCheckResult as H, ProviderHealthCheck as P, createHealthHandler as a, createIngestHandler as b, createChatHandler as c, createUploadHandler as d };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode } from 'react';
|
|
3
3
|
import { C as ChatMessage } from './DocumentChunker-BEyzadsv.mjs';
|
|
4
4
|
export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-BEyzadsv.mjs';
|
|
5
|
-
import { V as VectorMatch, U as UIConfig } from './RagConfig-
|
|
6
|
-
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-
|
|
5
|
+
import { V as VectorMatch, U as UIConfig } from './RagConfig-D_rSf8ep.mjs';
|
|
6
|
+
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-D_rSf8ep.mjs';
|
|
7
7
|
|
|
8
8
|
interface ChatWidgetProps {
|
|
9
9
|
/** Position of the floating button. Defaults to bottom-right. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React$1, { ReactNode } from 'react';
|
|
3
3
|
import { C as ChatMessage } from './DocumentChunker-BEyzadsv.js';
|
|
4
4
|
export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-BEyzadsv.js';
|
|
5
|
-
import { V as VectorMatch, U as UIConfig } from './RagConfig-
|
|
6
|
-
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-
|
|
5
|
+
import { V as VectorMatch, U as UIConfig } from './RagConfig-D_rSf8ep.js';
|
|
6
|
+
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-D_rSf8ep.js';
|
|
7
7
|
|
|
8
8
|
interface ChatWidgetProps {
|
|
9
9
|
/** Position of the floating button. Defaults to bottom-right. */
|