@retrivora-ai/rag-engine 1.0.3 → 1.0.5

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 (40) hide show
  1. package/dist/DocumentChunker-Dh9TvmGG.d.mts +45 -0
  2. package/dist/DocumentChunker-Dh9TvmGG.d.ts +45 -0
  3. package/dist/{RagConfig-DRJO4hGU.d.mts → RagConfig-BEmz4hVP.d.mts} +58 -1
  4. package/dist/{RagConfig-DRJO4hGU.d.ts → RagConfig-BEmz4hVP.d.ts} +58 -1
  5. package/dist/{chunk-3JR3SAWX.mjs → chunk-MWL4AGQI.mjs} +216 -108
  6. package/dist/handlers/index.d.mts +2 -2
  7. package/dist/handlers/index.d.ts +2 -2
  8. package/dist/handlers/index.js +218 -110
  9. package/dist/handlers/index.mjs +11 -3
  10. package/dist/index-CSfaCeux.d.ts +206 -0
  11. package/dist/index-DFSy0CG6.d.mts +206 -0
  12. package/dist/index.d.mts +3 -4
  13. package/dist/index.d.ts +3 -4
  14. package/dist/index.js +103 -89
  15. package/dist/index.mjs +91 -95
  16. package/dist/server.d.mts +45 -97
  17. package/dist/server.d.ts +45 -97
  18. package/dist/server.js +298 -225
  19. package/dist/server.mjs +78 -167
  20. package/package.json +12 -10
  21. package/src/components/ChatWindow.tsx +2 -2
  22. package/src/components/ConfigProvider.tsx +2 -2
  23. package/src/components/MessageBubble.tsx +2 -2
  24. package/src/components/SourceCard.tsx +1 -1
  25. package/src/components/ThemeToggle.tsx +1 -1
  26. package/src/config/ConfigBuilder.ts +86 -211
  27. package/src/config/uiConstants.ts +23 -0
  28. package/src/core/ConfigResolver.ts +57 -29
  29. package/src/core/LangChainAgent.ts +73 -40
  30. package/src/core/Pipeline.ts +63 -7
  31. package/src/core/ProviderRegistry.ts +2 -2
  32. package/src/core/QueryProcessor.ts +9 -8
  33. package/src/handlers/index.ts +138 -49
  34. package/src/hooks/useRagChat.ts +71 -32
  35. package/src/rag/EntityExtractor.ts +40 -13
  36. package/src/server.ts +12 -2
  37. package/dist/DocumentChunker-C-sCZPhi.d.mts +0 -102
  38. package/dist/DocumentChunker-C-sCZPhi.d.ts +0 -102
  39. package/dist/index-B2mutkgp.d.ts +0 -116
  40. package/dist/index-Bjy0es5a.d.mts +0 -116
@@ -1,116 +0,0 @@
1
- import { c as RagConfig, C as ChatResponse } from './RagConfig-DRJO4hGU.mjs';
2
- import { NextRequest, NextResponse } from 'next/server';
3
-
4
- interface ValidationError {
5
- field: string;
6
- message: string;
7
- suggestion?: string;
8
- severity: 'error' | 'warning';
9
- }
10
- /**
11
- * ConfigValidator.ts — Comprehensive configuration validation.
12
- * Uses a pluggable architecture to delegate provider-specific checks.
13
- */
14
- declare class ConfigValidator {
15
- /**
16
- * Validates the entire RagConfig object.
17
- */
18
- static validate(config: RagConfig): Promise<ValidationError[]>;
19
- private static validateVectorDbConfig;
20
- private static validateLLMConfig;
21
- private static validateEmbeddingConfig;
22
- /**
23
- * Temporary fallbacks for providers not yet migrated to the pluggable architecture.
24
- */
25
- private static fallbackVectorValidation;
26
- private static fallbackLLMValidation;
27
- private static fallbackEmbeddingValidation;
28
- private static validateUIConfig;
29
- private static validateRAGConfig;
30
- private static isValidCSSColor;
31
- static validateAndThrow(config: RagConfig): Promise<void>;
32
- }
33
-
34
- /**
35
- * Interface for provider-specific configuration validation logic.
36
- */
37
- interface IProviderValidator {
38
- /**
39
- * Validates the configuration for a specific provider.
40
- * @param config - The configuration object to validate.
41
- * @returns An array of validation errors (empty if valid).
42
- */
43
- validate(config: Record<string, unknown>): ValidationError[];
44
- }
45
- /**
46
- * Result of a provider health check.
47
- */
48
- interface HealthCheckResult {
49
- healthy: boolean;
50
- provider: string;
51
- version?: string;
52
- capabilities?: Record<string, unknown>;
53
- error?: string;
54
- timestamp: number;
55
- }
56
- /**
57
- * Interface for provider-specific health checking logic.
58
- */
59
- interface IProviderHealthChecker {
60
- /**
61
- * Performs a health check for a specific provider.
62
- * @param config - The configuration object used to connect to the provider.
63
- * @returns A promise that resolves to the health check result.
64
- */
65
- check(config: Record<string, unknown>): Promise<HealthCheckResult>;
66
- }
67
-
68
- /**
69
- * createChatHandler — factory that returns a Next.js App Router POST handler
70
- */
71
- declare function createChatHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
72
- error: string;
73
- }> | NextResponse<ChatResponse>>;
74
- /**
75
- * createStreamHandler — factory that returns a streaming Next.js App Router POST handler
76
- */
77
- declare function createStreamHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<Response>;
78
- /**
79
- * createIngestHandler — factory for the document ingestion endpoint.
80
- */
81
- declare function createIngestHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
82
- error: string;
83
- }> | NextResponse<{
84
- results: {
85
- docId: string | number;
86
- chunksIngested: number;
87
- }[];
88
- }>>;
89
- /**
90
- * createHealthHandler — factory for the health-check endpoint.
91
- */
92
- declare function createHealthHandler(config?: Partial<RagConfig>): () => Promise<NextResponse<{
93
- timestamp: string;
94
- vectorDb: HealthCheckResult;
95
- llm: HealthCheckResult;
96
- embedding?: HealthCheckResult;
97
- allHealthy: boolean;
98
- status: string;
99
- }> | NextResponse<{
100
- status: string;
101
- error: string;
102
- }>>;
103
- /**
104
- * createUploadHandler — factory for the file upload ingestion endpoint.
105
- */
106
- declare function createUploadHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
107
- error: string;
108
- }> | NextResponse<{
109
- message: string;
110
- results: {
111
- docId: string | number;
112
- chunksIngested: number;
113
- }[];
114
- }>>;
115
-
116
- export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, createHealthHandler as b, createChatHandler as c, createIngestHandler as d, createUploadHandler as e, createStreamHandler as f };