@retrivora-ai/rag-engine 1.9.7 → 1.9.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.
Files changed (58) hide show
  1. package/README.md +127 -135
  2. package/dist/{ILLMProvider-Bhk6zJOK.d.mts → ILLMProvider-B8ROITYK.d.mts} +57 -2
  3. package/dist/{ILLMProvider-Bhk6zJOK.d.ts → ILLMProvider-B8ROITYK.d.ts} +57 -2
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +2198 -457
  7. package/dist/handlers/index.mjs +2195 -457
  8. package/dist/{index-BJ4cd-t5.d.mts → index-B8PbEFSY.d.mts} +12 -2
  9. package/dist/{index-Bu7T6xgr.d.ts → index-BCPKUAVL.d.ts} +27 -52
  10. package/dist/{index-C3SVtPYg.d.mts → index-CrxCy36A.d.mts} +27 -52
  11. package/dist/{index-B9J_XEh0.d.ts → index-DNvoi-sV.d.ts} +12 -2
  12. package/dist/index.css +578 -273
  13. package/dist/index.d.mts +29 -7
  14. package/dist/index.d.ts +29 -7
  15. package/dist/index.js +1160 -282
  16. package/dist/index.mjs +1185 -292
  17. package/dist/server.d.mts +62 -6
  18. package/dist/server.d.ts +62 -6
  19. package/dist/server.js +2061 -306
  20. package/dist/server.mjs +2055 -306
  21. package/package.json +11 -7
  22. package/src/app/constants.tsx +37 -7
  23. package/src/components/AmbientBackground.tsx +10 -10
  24. package/src/components/ArchitectureCard.tsx +43 -7
  25. package/src/components/ArchitectureCardsSection.tsx +37 -4
  26. package/src/components/ChatWidget.tsx +2 -1
  27. package/src/components/ChatWindow.tsx +4 -1
  28. package/src/components/CodeViewer.tsx +19 -14
  29. package/src/components/DocViewer.tsx +43 -49
  30. package/src/components/Documentation.tsx +71 -51
  31. package/src/components/Hero.tsx +103 -20
  32. package/src/components/Lifecycle.tsx +65 -25
  33. package/src/components/MarkdownComponents.tsx +44 -1
  34. package/src/components/MessageBubble.tsx +162 -50
  35. package/src/components/constants.tsx +4 -0
  36. package/src/config/RagConfig.ts +46 -0
  37. package/src/config/constants.ts +4 -0
  38. package/src/config/serverConfig.ts +15 -0
  39. package/src/core/ConfigResolver.ts +6 -0
  40. package/src/core/DatabaseStorage.ts +469 -0
  41. package/src/core/LicenseVerifier.ts +154 -0
  42. package/src/core/MultiAgentCoordinator.ts +239 -0
  43. package/src/core/Pipeline.ts +146 -15
  44. package/src/core/Retrivora.ts +6 -0
  45. package/src/core/VectorPlugin.ts +12 -3
  46. package/src/core/mcp.ts +261 -0
  47. package/src/handlers/index.ts +449 -63
  48. package/src/hooks/useRagChat.ts +96 -42
  49. package/src/hooks/useStoredMessages.ts +15 -4
  50. package/src/index.ts +5 -0
  51. package/src/llm/LLMFactory.ts +9 -1
  52. package/src/llm/providers/GroqProvider.ts +176 -0
  53. package/src/llm/providers/QwenProvider.ts +191 -0
  54. package/src/server.ts +7 -0
  55. package/src/types/chat.ts +14 -0
  56. package/src/types/props.ts +12 -0
  57. package/.env.example +0 -80
  58. package/LICENSE.txt +0 -21
package/src/server.ts CHANGED
@@ -25,6 +25,7 @@ export type { ILLMProvider, EmbedOptions } from './llm/ILLMProvider';
25
25
  export type { Chunk, ChunkOptions } from './rag/DocumentChunker';
26
26
  export type { HealthCheckResult, IProviderValidator, IProviderHealthChecker } from './core/ProviderInterfaces';
27
27
  export type { ValidationError } from './core/ConfigValidator';
28
+ export type { LicensePayload } from './core/LicenseVerifier';
28
29
  export type { BatchOptions, BatchResult } from './core/BatchProcessor';
29
30
 
30
31
  // ── Core Orchestration ─────────────────────────────────────────
@@ -34,6 +35,7 @@ export { Pipeline } from './core/Pipeline';
34
35
  export { ConfigResolver } from './core/ConfigResolver';
35
36
  export { ProviderRegistry } from './core/ProviderRegistry';
36
37
  export { ConfigValidator } from './core/ConfigValidator';
38
+ export { LicenseVerifier } from './core/LicenseVerifier';
37
39
  export { ProviderHealthCheck } from './core/ProviderHealthCheck';
38
40
  export { BatchProcessor } from './core/BatchProcessor';
39
41
 
@@ -65,6 +67,8 @@ export { LLMFactory } from './llm/LLMFactory';
65
67
  export { OpenAIProvider } from './llm/providers/OpenAIProvider';
66
68
  export { AnthropicProvider } from './llm/providers/AnthropicProvider';
67
69
  export { OllamaProvider } from './llm/providers/OllamaProvider';
70
+ export { GroqProvider } from './llm/providers/GroqProvider';
71
+ export { QwenProvider } from './llm/providers/QwenProvider';
68
72
  export { UniversalLLMAdapter } from './llm/providers/UniversalLLMAdapter';
69
73
 
70
74
  // ── Next.js Route Handler Factories ───────────────────────────
@@ -74,6 +78,9 @@ export {
74
78
  createIngestHandler,
75
79
  createHealthHandler,
76
80
  createUploadHandler,
81
+ createHistoryHandler,
82
+ createFeedbackHandler,
83
+ createSessionsHandler,
77
84
  createRagHandler,
78
85
  sseFrame,
79
86
  sseTextFrame,
package/src/types/chat.ts CHANGED
@@ -41,6 +41,12 @@ export interface ChatOptions {
41
41
  export interface UseRagChatOptions {
42
42
  /** Override the chat API endpoint (default: /api/chat) */
43
43
  apiUrl?: string;
44
+ /**
45
+ * Base URL for the Retrivora SDK catch-all route used for history, feedback,
46
+ * and sessions endpoints. Defaults to '/api/retrivora'.
47
+ * e.g. if your catch-all is at /api/retrivora/[[...retrivora]], set this to '/api/retrivora'.
48
+ */
49
+ retrivoraApiBase?: string;
44
50
  /** Override project namespace */
45
51
  namespace?: string;
46
52
  /** Persist chat history to localStorage (default: true) */
@@ -51,6 +57,8 @@ export interface UseRagChatOptions {
51
57
  onError?: (error: string) => void;
52
58
  /** Optional custom headers to send with the chat request */
53
59
  headers?: Record<string, string>;
60
+ /** Session ID for history and feedback tracking (default: 'default') */
61
+ sessionId?: string;
54
62
  }
55
63
 
56
64
  export interface UseRagChatReturn {
@@ -70,4 +78,10 @@ export interface UseRagChatReturn {
70
78
  setMessages: React.Dispatch<React.SetStateAction<RagMessage[]>>;
71
79
  /** Abort the current active stream request */
72
80
  stop: () => void;
81
+ /** Load message history from database storage */
82
+ loadHistory: (sessionId: string) => Promise<void>;
83
+ /** Clear conversation history from database and locally */
84
+ clearHistory: (sessionId: string) => Promise<void>;
85
+ /** Submit rating and optional comment for a specific assistant message */
86
+ submitFeedback: (messageId: string, rating: 'thumbs_up' | 'thumbs_down', comment?: string) => Promise<void>;
73
87
  }
@@ -57,6 +57,11 @@ export interface ChatWindowProps {
57
57
  onAddToCart?: (product: Product) => void;
58
58
  /** Optional custom API URL to send chat messages to */
59
59
  apiUrl?: string;
60
+ /**
61
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
62
+ * Defaults to '/api/retrivora'. Set this to match your catch-all route location.
63
+ */
64
+ retrivoraApiBase?: string;
60
65
  /** Optional custom headers to send with the chat request */
61
66
  headers?: Record<string, string>;
62
67
  }
@@ -68,6 +73,11 @@ export interface ChatWidgetProps {
68
73
  onAddToCart?: (product: Product) => void;
69
74
  /** Optional custom API URL to send chat messages to */
70
75
  apiUrl?: string;
76
+ /**
77
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
78
+ * Defaults to '/api/retrivora'.
79
+ */
80
+ retrivoraApiBase?: string;
71
81
  /** Optional custom headers to send with the chat request */
72
82
  headers?: Record<string, string>;
73
83
  }
@@ -80,6 +90,8 @@ export interface MessageBubbleProps {
80
90
  accentColor: string;
81
91
  onAddToCart?: (product: Product) => void;
82
92
  viewportSize?: ChatViewportSize;
93
+ /** Called when the user clicks thumbs up or thumbs down on an assistant message */
94
+ onFeedback?: (messageId: string, rating: 'thumbs_up' | 'thumbs_down') => void;
83
95
  }
84
96
 
85
97
  export interface ProductCardProps {
package/.env.example DELETED
@@ -1,80 +0,0 @@
1
- # ─── Project ─────────────────────────────────────────────────
2
- RAG_PROJECT_ID=my-project
3
-
4
- # ─── Vector Database ──────────────────────────────────────────
5
- # Choose: pinecone | pgvector | rest | universal_rest
6
- VECTOR_DB_PROVIDER=pinecone
7
- VECTOR_DB_INDEX=rag-index
8
-
9
- # Pinecone (if provider=pinecone)
10
- PINECONE_API_KEY=your-pinecone-api-key
11
- PINECONE_ENVIRONMENT=us-east-1
12
-
13
- # pgVector (if provider=pgvector)
14
- PGVECTOR_CONNECTION_STRING=postgresql://user:password@localhost:5432/StagVectorDB
15
-
16
- # Generic REST (if provider=rest)
17
- VECTOR_DB_REST_URL=http://localhost:8080
18
- VECTOR_DB_REST_API_KEY=your-rest-api-key
19
- # VECTOR_DB_QUERY_PATH=/query
20
- # VECTOR_DB_UPSERT_PATH=/upsert
21
-
22
- # ─── LLM ──────────────────────────────────────────────────────
23
- # Choose: openai | anthropic | ollama | gemini | universal_rest
24
- LLM_PROVIDER=openai
25
- LLM_MODEL=gpt-4o
26
- LLM_MAX_TOKENS=1024
27
- LLM_TEMPERATURE=0.7
28
- LLM_SYSTEM_PROMPT=You are a helpful assistant. Use the provided context to answer questions accurately.
29
-
30
- # OpenAI (if provider=openai)
31
- OPENAI_API_KEY=sk-...
32
-
33
- # Anthropic (if provider=anthropic)
34
- ANTHROPIC_API_KEY=sk-ant-...
35
-
36
- # Gemini (if provider=gemini)
37
- GEMINI_API_KEY=AIza...
38
-
39
- # Ollama (if provider=ollama)
40
- LLM_BASE_URL=http://localhost:11434
41
-
42
- # ── Master Universal Provider (LiteLLM, Qdrant, etc.) ─────────
43
- # Use 'universal_rest' for ANY model or DB via pre-set profiles.
44
- LLM_PROVIDER=universal_rest
45
- LLM_MODEL=gpt-4o
46
- # Profile: litellm | ollama-standard | openai-compatible
47
- LLM_UNIVERSAL_PROFILE=litellm
48
- LLM_BASE_URL=https://proxy.example.com/api
49
- LLM_API_KEY=your-key
50
-
51
- VECTOR_DB_PROVIDER=universal_rest
52
- # Profile: qdrant | chromadb
53
- VECTOR_UNIVERSAL_PROFILE=qdrant
54
- VECTOR_BASE_URL=http://localhost:6333
55
- VECTOR_DB_INDEX=my-index
56
-
57
- # ─── Embedding ────────────────────────────────────────────────
58
- # Choose: openai | ollama | gemini | custom
59
- EMBEDDING_PROVIDER=openai
60
- EMBEDDING_MODEL=text-embedding-3-small
61
- EMBEDDING_DIMENSIONS=1536
62
- # EMBEDDING_BASE_URL=http://localhost:11434 # for ollama
63
- # EMBEDDING_API_KEY=your-embedding-key # for custom embedding endpoints
64
-
65
- # ─── RAG Pipeline Tuning ──────────────────────────────────────
66
- RAG_TOP_K=5
67
- RAG_SCORE_THRESHOLD=0.0
68
- RAG_CHUNK_SIZE=1000
69
- RAG_CHUNK_OVERLAP=200
70
-
71
- # ─── UI Branding (NEXT_PUBLIC_ = safe to expose to browser) ───
72
- NEXT_PUBLIC_PROJECT_ID=my-project
73
- NEXT_PUBLIC_UI_TITLE=AI Assistant
74
- NEXT_PUBLIC_UI_SUBTITLE=Powered by RAG
75
- NEXT_PUBLIC_PRIMARY_COLOR=#6366f1
76
- NEXT_PUBLIC_ACCENT_COLOR=#8b5cf6
77
- NEXT_PUBLIC_PLACEHOLDER=Ask me anything…
78
- NEXT_PUBLIC_SHOW_SOURCES=true
79
- NEXT_PUBLIC_WELCOME_MESSAGE=Hello! I'm your AI assistant. Ask me anything about your documents.
80
- # NEXT_PUBLIC_LOGO_URL=https://your-domain.com/logo.png
package/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [2026] [Abhinav Alkuchi]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.