@retrivora-ai/rag-engine 1.9.0 → 1.9.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/dist/{ILLMProvider-BOJFz3Na.d.mts → ILLMProvider-BQyKZLnd.d.mts} +10 -0
- package/dist/{ILLMProvider-BOJFz3Na.d.ts → ILLMProvider-BQyKZLnd.d.ts} +10 -0
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1719 -467
- package/dist/handlers/index.mjs +1718 -466
- package/dist/{index-BwpcaziY.d.ts → index-A0GqPsaG.d.ts} +1 -1
- package/dist/{index-D3V9Et2M.d.mts → index-CDftK3qs.d.mts} +1 -1
- package/dist/index.css +26 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +246 -76
- package/dist/index.mjs +248 -76
- package/dist/server.d.mts +32 -5
- package/dist/server.d.ts +32 -5
- package/dist/server.js +1726 -671
- package/dist/server.mjs +1724 -669
- package/package.json +1 -1
- package/src/components/MarkdownComponents.tsx +3 -3
- package/src/components/MessageBubble.tsx +49 -2
- package/src/components/ProductCard.tsx +33 -6
- package/src/components/UIDispatcher.tsx +1 -0
- package/src/components/VisualizationRenderer.tsx +143 -11
- package/src/config/EmbeddingStrategy.ts +5 -4
- package/src/config/RagConfig.ts +10 -0
- package/src/config/serverConfig.ts +16 -1
- package/src/core/LLMRouter.ts +79 -0
- package/src/core/Pipeline.ts +262 -45
- package/src/core/ProviderRegistry.ts +6 -0
- package/src/core/QueryProcessor.ts +98 -0
- package/src/handlers/index.ts +8 -5
- package/src/hooks/useRagChat.ts +53 -17
- package/src/llm/providers/UniversalLLMAdapter.ts +110 -13
- package/src/providers/vectordb/ChromaDBProvider.ts +13 -2
- package/src/providers/vectordb/MilvusProvider.ts +18 -2
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +12 -12
- package/src/providers/vectordb/PostgreSQLProvider.ts +1 -1
- package/src/providers/vectordb/QdrantProvider.ts +1 -1
- package/src/providers/vectordb/RedisProvider.ts +3 -4
- package/src/providers/vectordb/WeaviateProvider.ts +41 -3
- package/src/types/index.ts +26 -0
- package/src/utils/ProductExtractor.ts +5 -3
- package/src/utils/UITransformer.ts +1348 -489
- package/src/utils/synonyms.ts +2 -0
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as VectorDBConfig, L as LLMConfig, e as EmbeddingConfig, k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, p as RetrievalResult, m as UpsertDocument, V as VectorMatch, G as GraphDBConfig, q as GraphNode, r as Edge, s as GraphSearchResult, o as VectorDBProvider, h as LLMProvider, f as EmbeddingProvider, j as RAGConfig, U as UIConfig, c as ChatOptions, E as EmbedOptions } from './ILLMProvider-
|
|
1
|
+
import { n as VectorDBConfig, L as LLMConfig, e as EmbeddingConfig, k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, p as RetrievalResult, m as UpsertDocument, V as VectorMatch, G as GraphDBConfig, q as GraphNode, r as Edge, s as GraphSearchResult, o as VectorDBProvider, h as LLMProvider, f as EmbeddingProvider, j as RAGConfig, U as UIConfig, c as ChatOptions, E as EmbedOptions } from './ILLMProvider-BQyKZLnd.js';
|
|
2
2
|
export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-Dh9TvmGG.js';
|
|
3
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
4
|
-
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-
|
|
3
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-A0GqPsaG.js';
|
|
4
|
+
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-A0GqPsaG.js';
|
|
5
5
|
import 'next/server';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -113,6 +113,7 @@ declare class Pipeline {
|
|
|
113
113
|
private graphDB?;
|
|
114
114
|
private llmProvider;
|
|
115
115
|
private embeddingProvider;
|
|
116
|
+
private llmRouter;
|
|
116
117
|
private chunker;
|
|
117
118
|
private llamaIngestor?;
|
|
118
119
|
private entityExtractor?;
|
|
@@ -150,6 +151,12 @@ declare class Pipeline {
|
|
|
150
151
|
/**
|
|
151
152
|
* High-performance streaming RAG flow.
|
|
152
153
|
* Yields text chunks first, then the retrieval metadata + observability trace at the end.
|
|
154
|
+
*
|
|
155
|
+
* Latency optimizations:
|
|
156
|
+
* - Strategy classification runs in parallel with query embedding (saves ~400ms)
|
|
157
|
+
* - Hallucination scoring is fire-and-forget (doesn't block metadata yield)
|
|
158
|
+
* - UITransformation is computed after text streaming and emitted with metadata
|
|
159
|
+
* - SchemaMapper.train runs while answer generation streams
|
|
153
160
|
*/
|
|
154
161
|
askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
|
|
155
162
|
/**
|
|
@@ -157,6 +164,14 @@ declare class Pipeline {
|
|
|
157
164
|
* Uses an LRU-bounded embedding cache to avoid re-embedding the same query.
|
|
158
165
|
*/
|
|
159
166
|
private generateUiTransformation;
|
|
167
|
+
private applyStructuredFilters;
|
|
168
|
+
private resolveNumericPredicateValue;
|
|
169
|
+
private extractNumericValueFromContent;
|
|
170
|
+
private matchesNumericPredicate;
|
|
171
|
+
private normalizeComparableField;
|
|
172
|
+
private fieldSimilarityScore;
|
|
173
|
+
private fieldTokens;
|
|
174
|
+
private toFiniteNumber;
|
|
160
175
|
retrieve(query: string, options: {
|
|
161
176
|
namespace?: string;
|
|
162
177
|
topK?: number;
|
|
@@ -811,8 +826,8 @@ declare class RedisProvider extends BaseVectorProvider {
|
|
|
811
826
|
delete(id: string, namespace?: string): Promise<void>;
|
|
812
827
|
deleteNamespace(namespace: string): Promise<void>;
|
|
813
828
|
/**
|
|
814
|
-
*
|
|
815
|
-
* Returns
|
|
829
|
+
* Check reachability via a PING command.
|
|
830
|
+
* Returns false on connection failure so health checks surface real problems.
|
|
816
831
|
*/
|
|
817
832
|
ping(): Promise<boolean>;
|
|
818
833
|
disconnect(): Promise<void>;
|
|
@@ -838,6 +853,9 @@ declare class WeaviateProvider extends BaseVectorProvider {
|
|
|
838
853
|
deleteNamespace(namespace: string): Promise<void>;
|
|
839
854
|
ping(): Promise<boolean>;
|
|
840
855
|
disconnect(): Promise<void>;
|
|
856
|
+
private extractPrimitiveMetadata;
|
|
857
|
+
private buildWhereFilter;
|
|
858
|
+
private weaviateOperand;
|
|
841
859
|
}
|
|
842
860
|
|
|
843
861
|
/**
|
|
@@ -969,8 +987,17 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
969
987
|
private readonly systemPrompt;
|
|
970
988
|
private readonly maxTokens;
|
|
971
989
|
private readonly temperature;
|
|
990
|
+
private readonly baseUrl;
|
|
991
|
+
private readonly apiKey?;
|
|
992
|
+
private readonly resolvedHeaders;
|
|
972
993
|
constructor(config: LLMConfig | EmbeddingConfig);
|
|
973
994
|
chat(messages: ChatMessage[], context?: string): Promise<string>;
|
|
995
|
+
/**
|
|
996
|
+
* Streaming chat using native fetch + ReadableStream.
|
|
997
|
+
* Parses OpenAI-compatible SSE frames: `data: {...}\n\n`
|
|
998
|
+
* Works with vLLM, LMStudio, Together AI, Fireworks, and any OpenAI-compatible API.
|
|
999
|
+
*/
|
|
1000
|
+
chatStream(messages: ChatMessage[], context?: string): AsyncIterable<string>;
|
|
974
1001
|
embed(text: string): Promise<number[]>;
|
|
975
1002
|
batchEmbed(texts: string[]): Promise<number[][]>;
|
|
976
1003
|
ping(): Promise<boolean>;
|