@retrivora-ai/rag-engine 2.5.2 → 2.5.4
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/FREE_TIER_ARCHITECTURE.md +232 -232
- package/README.md +206 -206
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +271 -202
- package/dist/handlers/index.mjs +271 -202
- package/dist/{BatchProcessor-B8OLSahY.d.ts → index--RhMcXrt.d.ts} +380 -379
- package/dist/{index-BC635WW-.d.ts → index-DE8qPWpI.d.mts} +3 -17
- package/dist/{BatchProcessor-OVOIlNfK.d.mts → index-Dex_gQ3P.d.mts} +380 -379
- package/dist/{index-D2mY1CrY.d.mts → index-DkOhRqEc.d.ts} +3 -17
- package/dist/index.css +869 -1302
- package/dist/index.d.mts +37 -18
- package/dist/index.d.ts +37 -18
- package/dist/index.js +421 -225
- package/dist/index.min.css +2 -2
- package/dist/index.mjs +445 -249
- package/dist/server.d.mts +36 -31
- package/dist/server.d.ts +36 -31
- package/dist/server.js +271 -202
- package/dist/server.mjs +271 -202
- package/package.json +156 -148
- package/dist/{ILLMProvider-BynaFBpy.d.mts → ILLMProvider-DO5gj-e5.d.mts} +83 -83
- package/dist/{ILLMProvider-BynaFBpy.d.ts → ILLMProvider-DO5gj-e5.d.ts} +83 -83
package/package.json
CHANGED
|
@@ -1,149 +1,157 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "2.5.
|
|
4
|
-
"description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
|
|
5
|
-
"author": "Abhinav Alkuchi",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"rag",
|
|
9
|
-
"retrieval-augmented-generation",
|
|
10
|
-
"chatbot",
|
|
11
|
-
"vector-database",
|
|
12
|
-
"pinecone",
|
|
13
|
-
"pgvector",
|
|
14
|
-
"postgresql",
|
|
15
|
-
"milvus",
|
|
16
|
-
"qdrant",
|
|
17
|
-
"chromadb",
|
|
18
|
-
"redis",
|
|
19
|
-
"weaviate",
|
|
20
|
-
"mongodb",
|
|
21
|
-
"openai",
|
|
22
|
-
"anthropic",
|
|
23
|
-
"ollama",
|
|
24
|
-
"nextjs",
|
|
25
|
-
"react",
|
|
26
|
-
"ai",
|
|
27
|
-
"llm",
|
|
28
|
-
"embeddings"
|
|
29
|
-
],
|
|
30
|
-
"main": "dist/index.js",
|
|
31
|
-
"module": "dist/index.mjs",
|
|
32
|
-
"types": "dist/index.d.ts",
|
|
33
|
-
"exports": {
|
|
34
|
-
".": {
|
|
35
|
-
"types": "./dist/index.d.ts",
|
|
36
|
-
"require": "./dist/index.js",
|
|
37
|
-
"import": "./dist/index.mjs"
|
|
38
|
-
},
|
|
39
|
-
"./style.css": "./dist/index.css",
|
|
40
|
-
"./style.min.css": "./dist/index.min.css",
|
|
41
|
-
"./index.css": "./dist/index.css",
|
|
42
|
-
"./index.min.css": "./dist/index.min.css",
|
|
43
|
-
"./styles.css": "./dist/index.css",
|
|
44
|
-
"./styles.min.css": "./dist/index.min.css",
|
|
45
|
-
"./handlers": {
|
|
46
|
-
"types": "./dist/handlers/index.d.ts",
|
|
47
|
-
"require": "./dist/handlers/index.js",
|
|
48
|
-
"import": "./dist/handlers/index.mjs"
|
|
49
|
-
},
|
|
50
|
-
"./server": {
|
|
51
|
-
"types": "./dist/server.d.ts",
|
|
52
|
-
"require": "./dist/server.js",
|
|
53
|
-
"import": "./dist/server.mjs"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"browser": {
|
|
57
|
-
"child_process": false,
|
|
58
|
-
"fs": false,
|
|
59
|
-
"net": false,
|
|
60
|
-
"tls": false,
|
|
61
|
-
"crypto": false,
|
|
62
|
-
"os": false,
|
|
63
|
-
"path": false,
|
|
64
|
-
"stream": false,
|
|
65
|
-
"http": false,
|
|
66
|
-
"https": false,
|
|
67
|
-
"zlib": false,
|
|
68
|
-
"mongodb": false,
|
|
69
|
-
"pg": false,
|
|
70
|
-
"pdf-parse": false,
|
|
71
|
-
"mammoth": false
|
|
72
|
-
},
|
|
73
|
-
"files": [
|
|
74
|
-
"dist",
|
|
75
|
-
"README.md",
|
|
76
|
-
"FREE_TIER_ARCHITECTURE.md"
|
|
77
|
-
],
|
|
78
|
-
"scripts": {
|
|
79
|
-
"dev": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --watch --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style",
|
|
80
|
-
"build": "npm run build:pkg",
|
|
81
|
-
"build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.min.css --minify",
|
|
82
|
-
"lint": "eslint",
|
|
83
|
-
"typecheck": "tsc --noEmit -p tsconfig.build.json",
|
|
84
|
-
"test": "jest",
|
|
85
|
-
"clean": "
|
|
86
|
-
},
|
|
87
|
-
"peerDependencies": {
|
|
88
|
-
"axios": ">=1.0.0",
|
|
89
|
-
"next": ">=15.0.0",
|
|
90
|
-
"react": ">=18.0.0",
|
|
91
|
-
"react-dom": ">=18.0.0"
|
|
92
|
-
},
|
|
93
|
-
"peerDependenciesMeta": {
|
|
94
|
-
"axios": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
97
|
-
"next": {
|
|
98
|
-
"optional": true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"dependencies": {
|
|
102
|
-
"@anthropic-ai/sdk": "^0.95.1",
|
|
103
|
-
"@google/genai": "^0.8.0",
|
|
104
|
-
"@google/generative-ai": "^0.24.1",
|
|
105
|
-
"@
|
|
106
|
-
"@
|
|
107
|
-
"@types/papaparse": "^5.5.2",
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"@
|
|
136
|
-
"@
|
|
137
|
-
"@types/
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@retrivora-ai/rag-engine",
|
|
3
|
+
"version": "2.5.4",
|
|
4
|
+
"description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
|
|
5
|
+
"author": "Abhinav Alkuchi",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"rag",
|
|
9
|
+
"retrieval-augmented-generation",
|
|
10
|
+
"chatbot",
|
|
11
|
+
"vector-database",
|
|
12
|
+
"pinecone",
|
|
13
|
+
"pgvector",
|
|
14
|
+
"postgresql",
|
|
15
|
+
"milvus",
|
|
16
|
+
"qdrant",
|
|
17
|
+
"chromadb",
|
|
18
|
+
"redis",
|
|
19
|
+
"weaviate",
|
|
20
|
+
"mongodb",
|
|
21
|
+
"openai",
|
|
22
|
+
"anthropic",
|
|
23
|
+
"ollama",
|
|
24
|
+
"nextjs",
|
|
25
|
+
"react",
|
|
26
|
+
"ai",
|
|
27
|
+
"llm",
|
|
28
|
+
"embeddings"
|
|
29
|
+
],
|
|
30
|
+
"main": "dist/index.js",
|
|
31
|
+
"module": "dist/index.mjs",
|
|
32
|
+
"types": "dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"require": "./dist/index.js",
|
|
37
|
+
"import": "./dist/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./style.css": "./dist/index.css",
|
|
40
|
+
"./style.min.css": "./dist/index.min.css",
|
|
41
|
+
"./index.css": "./dist/index.css",
|
|
42
|
+
"./index.min.css": "./dist/index.min.css",
|
|
43
|
+
"./styles.css": "./dist/index.css",
|
|
44
|
+
"./styles.min.css": "./dist/index.min.css",
|
|
45
|
+
"./handlers": {
|
|
46
|
+
"types": "./dist/handlers/index.d.ts",
|
|
47
|
+
"require": "./dist/handlers/index.js",
|
|
48
|
+
"import": "./dist/handlers/index.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./server": {
|
|
51
|
+
"types": "./dist/server.d.ts",
|
|
52
|
+
"require": "./dist/server.js",
|
|
53
|
+
"import": "./dist/server.mjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"browser": {
|
|
57
|
+
"child_process": false,
|
|
58
|
+
"fs": false,
|
|
59
|
+
"net": false,
|
|
60
|
+
"tls": false,
|
|
61
|
+
"crypto": false,
|
|
62
|
+
"os": false,
|
|
63
|
+
"path": false,
|
|
64
|
+
"stream": false,
|
|
65
|
+
"http": false,
|
|
66
|
+
"https": false,
|
|
67
|
+
"zlib": false,
|
|
68
|
+
"mongodb": false,
|
|
69
|
+
"pg": false,
|
|
70
|
+
"pdf-parse": false,
|
|
71
|
+
"mammoth": false
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"dist",
|
|
75
|
+
"README.md",
|
|
76
|
+
"FREE_TIER_ARCHITECTURE.md"
|
|
77
|
+
],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"dev": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --watch --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style",
|
|
80
|
+
"build": "npm run build:pkg",
|
|
81
|
+
"build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.min.css --minify",
|
|
82
|
+
"lint": "eslint",
|
|
83
|
+
"typecheck": "tsc --noEmit -p tsconfig.build.json",
|
|
84
|
+
"test": "jest",
|
|
85
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\""
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"axios": ">=1.0.0",
|
|
89
|
+
"next": ">=15.0.0",
|
|
90
|
+
"react": ">=18.0.0",
|
|
91
|
+
"react-dom": ">=18.0.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"axios": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"next": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@anthropic-ai/sdk": "^0.95.1",
|
|
103
|
+
"@google/genai": "^0.8.0",
|
|
104
|
+
"@google/generative-ai": "^0.24.1",
|
|
105
|
+
"@pinecone-database/pinecone": "^7.2.0",
|
|
106
|
+
"@retrivora-ai/billing-guards": "*",
|
|
107
|
+
"@types/papaparse": "^5.5.2",
|
|
108
|
+
"framer-motion": "^13.1.0",
|
|
109
|
+
"katex": "^0.18.4",
|
|
110
|
+
"lucide-react": "^1.8.0",
|
|
111
|
+
"next-themes": "^0.4.6",
|
|
112
|
+
"openai": "^6.34.0",
|
|
113
|
+
"papaparse": "^5.5.3",
|
|
114
|
+
"react-is": "^18.3.1",
|
|
115
|
+
"react-markdown": "^10.1.0",
|
|
116
|
+
"react-syntax-highlighter": "^16.1.1",
|
|
117
|
+
"recharts": "^3.8.1",
|
|
118
|
+
"rehype-katex": "^7.0.1",
|
|
119
|
+
"remark-gfm": "^4.0.1",
|
|
120
|
+
"remark-math": "^6.0.0",
|
|
121
|
+
"exceljs": "^4.4.0",
|
|
122
|
+
"zod": "^4.4.3"
|
|
123
|
+
},
|
|
124
|
+
"optionalDependencies": {
|
|
125
|
+
"@langchain/core": "^1.1.42",
|
|
126
|
+
"@langchain/openai": "^1.4.5",
|
|
127
|
+
"langchain": "^1.3.5",
|
|
128
|
+
"llamaindex": "^0.11.9",
|
|
129
|
+
"mammoth": "^1.8.0",
|
|
130
|
+
"mongodb": "^7.1.1",
|
|
131
|
+
"pdf-parse": "^1.1.1",
|
|
132
|
+
"pg": "^8.20.0"
|
|
133
|
+
},
|
|
134
|
+
"devDependencies": {
|
|
135
|
+
"@tailwindcss/cli": "^4",
|
|
136
|
+
"@tailwindcss/postcss": "^4",
|
|
137
|
+
"@types/estree": "^1.0.9",
|
|
138
|
+
"@types/jest": "^30.0.0",
|
|
139
|
+
"@types/katex": "^0.16.8",
|
|
140
|
+
"@types/node": "^20",
|
|
141
|
+
"@types/pdf-parse": "^1.1.5",
|
|
142
|
+
"@types/pg": "^8.20.0",
|
|
143
|
+
"@types/react": "^19.2.14",
|
|
144
|
+
"@types/react-dom": "^19.2.3",
|
|
145
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
|
146
|
+
"axios": "^1.15.0",
|
|
147
|
+
"dotenv": "^17.4.2",
|
|
148
|
+
"eslint": "^9",
|
|
149
|
+
"eslint-config-next": "16.3.2",
|
|
150
|
+
"jest": "^30.4.2",
|
|
151
|
+
"next": "^16.3.2",
|
|
152
|
+
"tailwindcss": "^4",
|
|
153
|
+
"ts-jest": "^29.4.12",
|
|
154
|
+
"tsup": "^8.5.1",
|
|
155
|
+
"typescript": "^5"
|
|
156
|
+
}
|
|
149
157
|
}
|
|
@@ -1,86 +1,3 @@
|
|
|
1
|
-
type MessageRole = 'user' | 'assistant' | 'system';
|
|
2
|
-
interface ChatMessage {
|
|
3
|
-
role: MessageRole;
|
|
4
|
-
content: string;
|
|
5
|
-
}
|
|
6
|
-
interface RagMessage extends ChatMessage {
|
|
7
|
-
id: string;
|
|
8
|
-
sources?: VectorMatch[];
|
|
9
|
-
uiTransformation?: unknown;
|
|
10
|
-
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
11
|
-
trace?: ObservabilityTrace;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
/**
|
|
14
|
-
* Chain-of-thought reasoning from the LLM.
|
|
15
|
-
* Populated by native Anthropic extended thinking or simulated <think> tag stripping.
|
|
16
|
-
*/
|
|
17
|
-
thinking?: string;
|
|
18
|
-
/** Wall-clock ms the model spent in the thinking phase. */
|
|
19
|
-
thinkingMs?: number;
|
|
20
|
-
}
|
|
21
|
-
interface ChatOptions {
|
|
22
|
-
/** Override max tokens for this specific call */
|
|
23
|
-
maxTokens?: number;
|
|
24
|
-
/** Override temperature for this specific call */
|
|
25
|
-
temperature?: number;
|
|
26
|
-
/** Stop sequences */
|
|
27
|
-
stop?: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Per-call system prompt override. When provided, providers should use this
|
|
30
|
-
* instead of (or in addition to) their configured llmConfig.systemPrompt.
|
|
31
|
-
* Useful for one-off analytical calls (e.g. UITransformer.analyzeAndDecide).
|
|
32
|
-
*/
|
|
33
|
-
systemPrompt?: string;
|
|
34
|
-
}
|
|
35
|
-
interface UseRagChatOptions {
|
|
36
|
-
/** Override the chat API endpoint (default: /api/chat) */
|
|
37
|
-
apiUrl?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Base URL for the Retrivora SDK catch-all route used for history, feedback,
|
|
40
|
-
* and sessions endpoints. Defaults to '/api/retrivora'.
|
|
41
|
-
* e.g. if your catch-all is at /api/retrivora/[[...retrivora]], set this to '/api/retrivora'.
|
|
42
|
-
*/
|
|
43
|
-
retrivoraApiBase?: string;
|
|
44
|
-
/** Override project namespace */
|
|
45
|
-
namespace?: string;
|
|
46
|
-
/** Persist chat history to localStorage (default: true) */
|
|
47
|
-
persist?: boolean;
|
|
48
|
-
/** Called after each successful assistant reply */
|
|
49
|
-
onReply?: (message: RagMessage) => void;
|
|
50
|
-
/** Called on error */
|
|
51
|
-
onError?: (error: string) => void;
|
|
52
|
-
/** Optional custom headers to send with the chat request */
|
|
53
|
-
headers?: Record<string, string>;
|
|
54
|
-
/** Optional Retrivora license key override */
|
|
55
|
-
licenseKey?: string;
|
|
56
|
-
/** Session ID for history and feedback tracking (default: 'default') */
|
|
57
|
-
sessionId?: string;
|
|
58
|
-
}
|
|
59
|
-
interface UseRagChatReturn {
|
|
60
|
-
/** All messages in the current conversation */
|
|
61
|
-
messages: RagMessage[];
|
|
62
|
-
/** Whether a response is in flight */
|
|
63
|
-
isLoading: boolean;
|
|
64
|
-
/** Current error message, or null */
|
|
65
|
-
error: string | null;
|
|
66
|
-
/** Send a user message */
|
|
67
|
-
send: (text: string) => Promise<void>;
|
|
68
|
-
/** Clear the conversation (and localStorage if persist=true) */
|
|
69
|
-
clear: () => void;
|
|
70
|
-
/** Retry the last failed send */
|
|
71
|
-
retry: () => Promise<void>;
|
|
72
|
-
/** Programmatically set the conversation (e.g. to restore from a DB) */
|
|
73
|
-
setMessages: React.Dispatch<React.SetStateAction<RagMessage[]>>;
|
|
74
|
-
/** Abort the current active stream request */
|
|
75
|
-
stop: () => void;
|
|
76
|
-
/** Load message history from database storage */
|
|
77
|
-
loadHistory: (sessionId: string) => Promise<void>;
|
|
78
|
-
/** Clear conversation history from database and locally */
|
|
79
|
-
clearHistory: (sessionId: string) => Promise<void>;
|
|
80
|
-
/** Submit rating and optional comment for a specific assistant message */
|
|
81
|
-
submitFeedback: (messageId: string, rating: 'thumbs_up' | 'thumbs_down', comment?: string) => Promise<void>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
1
|
declare const VECTOR_DB_PROVIDERS: readonly ["pinecone", "pgvector", "postgresql", "mongodb", "qdrant", "milvus", "chromadb", "redis", "weaviate", "rest", "universal_rest", "custom"];
|
|
85
2
|
declare const LLM_PROVIDERS: readonly ["openai", "anthropic", "ollama", "gemini", "groq", "qwen", "rest", "universal_rest", "custom"];
|
|
86
3
|
declare const EMBEDDING_PROVIDERS: readonly ["openai", "ollama", "gemini", "qwen", "rest", "universal_rest", "custom"];
|
|
@@ -409,6 +326,89 @@ type UniversalRagConfig = Partial<Omit<RagConfig, 'vectorDb' | 'rag' | 'llm' | '
|
|
|
409
326
|
workflow?: WorkflowConfig;
|
|
410
327
|
};
|
|
411
328
|
|
|
329
|
+
type MessageRole = 'user' | 'assistant' | 'system';
|
|
330
|
+
interface ChatMessage {
|
|
331
|
+
role: MessageRole;
|
|
332
|
+
content: string;
|
|
333
|
+
}
|
|
334
|
+
interface RagMessage extends ChatMessage {
|
|
335
|
+
id: string;
|
|
336
|
+
sources?: VectorMatch[];
|
|
337
|
+
uiTransformation?: unknown;
|
|
338
|
+
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
339
|
+
trace?: ObservabilityTrace;
|
|
340
|
+
createdAt: string;
|
|
341
|
+
/**
|
|
342
|
+
* Chain-of-thought reasoning from the LLM.
|
|
343
|
+
* Populated by native Anthropic extended thinking or simulated <think> tag stripping.
|
|
344
|
+
*/
|
|
345
|
+
thinking?: string;
|
|
346
|
+
/** Wall-clock ms the model spent in the thinking phase. */
|
|
347
|
+
thinkingMs?: number;
|
|
348
|
+
}
|
|
349
|
+
interface ChatOptions {
|
|
350
|
+
/** Override max tokens for this specific call */
|
|
351
|
+
maxTokens?: number;
|
|
352
|
+
/** Override temperature for this specific call */
|
|
353
|
+
temperature?: number;
|
|
354
|
+
/** Stop sequences */
|
|
355
|
+
stop?: string[];
|
|
356
|
+
/**
|
|
357
|
+
* Per-call system prompt override. When provided, providers should use this
|
|
358
|
+
* instead of (or in addition to) their configured llmConfig.systemPrompt.
|
|
359
|
+
* Useful for one-off analytical calls (e.g. UITransformer.analyzeAndDecide).
|
|
360
|
+
*/
|
|
361
|
+
systemPrompt?: string;
|
|
362
|
+
}
|
|
363
|
+
interface UseRagChatOptions {
|
|
364
|
+
/** Override the chat API endpoint (default: /api/chat) */
|
|
365
|
+
apiUrl?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Base URL for the Retrivora SDK catch-all route used for history, feedback,
|
|
368
|
+
* and sessions endpoints. Defaults to '/api/retrivora'.
|
|
369
|
+
* e.g. if your catch-all is at /api/retrivora/[[...retrivora]], set this to '/api/retrivora'.
|
|
370
|
+
*/
|
|
371
|
+
retrivoraApiBase?: string;
|
|
372
|
+
/** Override project namespace */
|
|
373
|
+
namespace?: string;
|
|
374
|
+
/** Persist chat history to localStorage (default: true) */
|
|
375
|
+
persist?: boolean;
|
|
376
|
+
/** Called after each successful assistant reply */
|
|
377
|
+
onReply?: (message: RagMessage) => void;
|
|
378
|
+
/** Called on error */
|
|
379
|
+
onError?: (error: string) => void;
|
|
380
|
+
/** Optional custom headers to send with the chat request */
|
|
381
|
+
headers?: Record<string, string>;
|
|
382
|
+
/** Optional Retrivora license key override */
|
|
383
|
+
licenseKey?: string;
|
|
384
|
+
/** Session ID for history and feedback tracking (default: 'default') */
|
|
385
|
+
sessionId?: string;
|
|
386
|
+
}
|
|
387
|
+
interface UseRagChatReturn {
|
|
388
|
+
/** All messages in the current conversation */
|
|
389
|
+
messages: RagMessage[];
|
|
390
|
+
/** Whether a response is in flight */
|
|
391
|
+
isLoading: boolean;
|
|
392
|
+
/** Current error message, or null */
|
|
393
|
+
error: string | null;
|
|
394
|
+
/** Send a user message */
|
|
395
|
+
send: (text: string) => Promise<void>;
|
|
396
|
+
/** Clear the conversation (and localStorage if persist=true) */
|
|
397
|
+
clear: () => void;
|
|
398
|
+
/** Retry the last failed send */
|
|
399
|
+
retry: () => Promise<void>;
|
|
400
|
+
/** Programmatically set the conversation (e.g. to restore from a DB) */
|
|
401
|
+
setMessages: React.Dispatch<React.SetStateAction<RagMessage[]>>;
|
|
402
|
+
/** Abort the current active stream request */
|
|
403
|
+
stop: () => void;
|
|
404
|
+
/** Load message history from database storage */
|
|
405
|
+
loadHistory: (sessionId: string) => Promise<void>;
|
|
406
|
+
/** Clear conversation history from database and locally */
|
|
407
|
+
clearHistory: (sessionId: string) => Promise<void>;
|
|
408
|
+
/** Submit rating and optional comment for a specific assistant message */
|
|
409
|
+
submitFeedback: (messageId: string, rating: 'thumbs_up' | 'thumbs_down', comment?: string) => Promise<void>;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
412
|
/** Per-stage latency breakdown for a single RAG request. */
|
|
413
413
|
interface LatencyBreakdown {
|
|
414
414
|
embedMs: number;
|
|
@@ -1,86 +1,3 @@
|
|
|
1
|
-
type MessageRole = 'user' | 'assistant' | 'system';
|
|
2
|
-
interface ChatMessage {
|
|
3
|
-
role: MessageRole;
|
|
4
|
-
content: string;
|
|
5
|
-
}
|
|
6
|
-
interface RagMessage extends ChatMessage {
|
|
7
|
-
id: string;
|
|
8
|
-
sources?: VectorMatch[];
|
|
9
|
-
uiTransformation?: unknown;
|
|
10
|
-
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
11
|
-
trace?: ObservabilityTrace;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
/**
|
|
14
|
-
* Chain-of-thought reasoning from the LLM.
|
|
15
|
-
* Populated by native Anthropic extended thinking or simulated <think> tag stripping.
|
|
16
|
-
*/
|
|
17
|
-
thinking?: string;
|
|
18
|
-
/** Wall-clock ms the model spent in the thinking phase. */
|
|
19
|
-
thinkingMs?: number;
|
|
20
|
-
}
|
|
21
|
-
interface ChatOptions {
|
|
22
|
-
/** Override max tokens for this specific call */
|
|
23
|
-
maxTokens?: number;
|
|
24
|
-
/** Override temperature for this specific call */
|
|
25
|
-
temperature?: number;
|
|
26
|
-
/** Stop sequences */
|
|
27
|
-
stop?: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Per-call system prompt override. When provided, providers should use this
|
|
30
|
-
* instead of (or in addition to) their configured llmConfig.systemPrompt.
|
|
31
|
-
* Useful for one-off analytical calls (e.g. UITransformer.analyzeAndDecide).
|
|
32
|
-
*/
|
|
33
|
-
systemPrompt?: string;
|
|
34
|
-
}
|
|
35
|
-
interface UseRagChatOptions {
|
|
36
|
-
/** Override the chat API endpoint (default: /api/chat) */
|
|
37
|
-
apiUrl?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Base URL for the Retrivora SDK catch-all route used for history, feedback,
|
|
40
|
-
* and sessions endpoints. Defaults to '/api/retrivora'.
|
|
41
|
-
* e.g. if your catch-all is at /api/retrivora/[[...retrivora]], set this to '/api/retrivora'.
|
|
42
|
-
*/
|
|
43
|
-
retrivoraApiBase?: string;
|
|
44
|
-
/** Override project namespace */
|
|
45
|
-
namespace?: string;
|
|
46
|
-
/** Persist chat history to localStorage (default: true) */
|
|
47
|
-
persist?: boolean;
|
|
48
|
-
/** Called after each successful assistant reply */
|
|
49
|
-
onReply?: (message: RagMessage) => void;
|
|
50
|
-
/** Called on error */
|
|
51
|
-
onError?: (error: string) => void;
|
|
52
|
-
/** Optional custom headers to send with the chat request */
|
|
53
|
-
headers?: Record<string, string>;
|
|
54
|
-
/** Optional Retrivora license key override */
|
|
55
|
-
licenseKey?: string;
|
|
56
|
-
/** Session ID for history and feedback tracking (default: 'default') */
|
|
57
|
-
sessionId?: string;
|
|
58
|
-
}
|
|
59
|
-
interface UseRagChatReturn {
|
|
60
|
-
/** All messages in the current conversation */
|
|
61
|
-
messages: RagMessage[];
|
|
62
|
-
/** Whether a response is in flight */
|
|
63
|
-
isLoading: boolean;
|
|
64
|
-
/** Current error message, or null */
|
|
65
|
-
error: string | null;
|
|
66
|
-
/** Send a user message */
|
|
67
|
-
send: (text: string) => Promise<void>;
|
|
68
|
-
/** Clear the conversation (and localStorage if persist=true) */
|
|
69
|
-
clear: () => void;
|
|
70
|
-
/** Retry the last failed send */
|
|
71
|
-
retry: () => Promise<void>;
|
|
72
|
-
/** Programmatically set the conversation (e.g. to restore from a DB) */
|
|
73
|
-
setMessages: React.Dispatch<React.SetStateAction<RagMessage[]>>;
|
|
74
|
-
/** Abort the current active stream request */
|
|
75
|
-
stop: () => void;
|
|
76
|
-
/** Load message history from database storage */
|
|
77
|
-
loadHistory: (sessionId: string) => Promise<void>;
|
|
78
|
-
/** Clear conversation history from database and locally */
|
|
79
|
-
clearHistory: (sessionId: string) => Promise<void>;
|
|
80
|
-
/** Submit rating and optional comment for a specific assistant message */
|
|
81
|
-
submitFeedback: (messageId: string, rating: 'thumbs_up' | 'thumbs_down', comment?: string) => Promise<void>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
1
|
declare const VECTOR_DB_PROVIDERS: readonly ["pinecone", "pgvector", "postgresql", "mongodb", "qdrant", "milvus", "chromadb", "redis", "weaviate", "rest", "universal_rest", "custom"];
|
|
85
2
|
declare const LLM_PROVIDERS: readonly ["openai", "anthropic", "ollama", "gemini", "groq", "qwen", "rest", "universal_rest", "custom"];
|
|
86
3
|
declare const EMBEDDING_PROVIDERS: readonly ["openai", "ollama", "gemini", "qwen", "rest", "universal_rest", "custom"];
|
|
@@ -409,6 +326,89 @@ type UniversalRagConfig = Partial<Omit<RagConfig, 'vectorDb' | 'rag' | 'llm' | '
|
|
|
409
326
|
workflow?: WorkflowConfig;
|
|
410
327
|
};
|
|
411
328
|
|
|
329
|
+
type MessageRole = 'user' | 'assistant' | 'system';
|
|
330
|
+
interface ChatMessage {
|
|
331
|
+
role: MessageRole;
|
|
332
|
+
content: string;
|
|
333
|
+
}
|
|
334
|
+
interface RagMessage extends ChatMessage {
|
|
335
|
+
id: string;
|
|
336
|
+
sources?: VectorMatch[];
|
|
337
|
+
uiTransformation?: unknown;
|
|
338
|
+
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
339
|
+
trace?: ObservabilityTrace;
|
|
340
|
+
createdAt: string;
|
|
341
|
+
/**
|
|
342
|
+
* Chain-of-thought reasoning from the LLM.
|
|
343
|
+
* Populated by native Anthropic extended thinking or simulated <think> tag stripping.
|
|
344
|
+
*/
|
|
345
|
+
thinking?: string;
|
|
346
|
+
/** Wall-clock ms the model spent in the thinking phase. */
|
|
347
|
+
thinkingMs?: number;
|
|
348
|
+
}
|
|
349
|
+
interface ChatOptions {
|
|
350
|
+
/** Override max tokens for this specific call */
|
|
351
|
+
maxTokens?: number;
|
|
352
|
+
/** Override temperature for this specific call */
|
|
353
|
+
temperature?: number;
|
|
354
|
+
/** Stop sequences */
|
|
355
|
+
stop?: string[];
|
|
356
|
+
/**
|
|
357
|
+
* Per-call system prompt override. When provided, providers should use this
|
|
358
|
+
* instead of (or in addition to) their configured llmConfig.systemPrompt.
|
|
359
|
+
* Useful for one-off analytical calls (e.g. UITransformer.analyzeAndDecide).
|
|
360
|
+
*/
|
|
361
|
+
systemPrompt?: string;
|
|
362
|
+
}
|
|
363
|
+
interface UseRagChatOptions {
|
|
364
|
+
/** Override the chat API endpoint (default: /api/chat) */
|
|
365
|
+
apiUrl?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Base URL for the Retrivora SDK catch-all route used for history, feedback,
|
|
368
|
+
* and sessions endpoints. Defaults to '/api/retrivora'.
|
|
369
|
+
* e.g. if your catch-all is at /api/retrivora/[[...retrivora]], set this to '/api/retrivora'.
|
|
370
|
+
*/
|
|
371
|
+
retrivoraApiBase?: string;
|
|
372
|
+
/** Override project namespace */
|
|
373
|
+
namespace?: string;
|
|
374
|
+
/** Persist chat history to localStorage (default: true) */
|
|
375
|
+
persist?: boolean;
|
|
376
|
+
/** Called after each successful assistant reply */
|
|
377
|
+
onReply?: (message: RagMessage) => void;
|
|
378
|
+
/** Called on error */
|
|
379
|
+
onError?: (error: string) => void;
|
|
380
|
+
/** Optional custom headers to send with the chat request */
|
|
381
|
+
headers?: Record<string, string>;
|
|
382
|
+
/** Optional Retrivora license key override */
|
|
383
|
+
licenseKey?: string;
|
|
384
|
+
/** Session ID for history and feedback tracking (default: 'default') */
|
|
385
|
+
sessionId?: string;
|
|
386
|
+
}
|
|
387
|
+
interface UseRagChatReturn {
|
|
388
|
+
/** All messages in the current conversation */
|
|
389
|
+
messages: RagMessage[];
|
|
390
|
+
/** Whether a response is in flight */
|
|
391
|
+
isLoading: boolean;
|
|
392
|
+
/** Current error message, or null */
|
|
393
|
+
error: string | null;
|
|
394
|
+
/** Send a user message */
|
|
395
|
+
send: (text: string) => Promise<void>;
|
|
396
|
+
/** Clear the conversation (and localStorage if persist=true) */
|
|
397
|
+
clear: () => void;
|
|
398
|
+
/** Retry the last failed send */
|
|
399
|
+
retry: () => Promise<void>;
|
|
400
|
+
/** Programmatically set the conversation (e.g. to restore from a DB) */
|
|
401
|
+
setMessages: React.Dispatch<React.SetStateAction<RagMessage[]>>;
|
|
402
|
+
/** Abort the current active stream request */
|
|
403
|
+
stop: () => void;
|
|
404
|
+
/** Load message history from database storage */
|
|
405
|
+
loadHistory: (sessionId: string) => Promise<void>;
|
|
406
|
+
/** Clear conversation history from database and locally */
|
|
407
|
+
clearHistory: (sessionId: string) => Promise<void>;
|
|
408
|
+
/** Submit rating and optional comment for a specific assistant message */
|
|
409
|
+
submitFeedback: (messageId: string, rating: 'thumbs_up' | 'thumbs_down', comment?: string) => Promise<void>;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
412
|
/** Per-stage latency breakdown for a single RAG request. */
|
|
413
413
|
interface LatencyBreakdown {
|
|
414
414
|
embedMs: number;
|