@retrivora-ai/rag-engine 1.9.6 → 1.9.7

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 (44) hide show
  1. package/README.md +32 -7
  2. package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +2 -6
  3. package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +2 -6
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +213 -67
  7. package/dist/handlers/index.mjs +212 -67
  8. package/dist/{index-CjQdL0cX.d.ts → index-B9J_XEh0.d.ts} +6 -2
  9. package/dist/{index-C9v7-tWd.d.mts → index-BJ4cd-t5.d.mts} +6 -2
  10. package/dist/{index-Hgbwl9X4.d.ts → index-Bu7T6xgr.d.ts} +20 -3
  11. package/dist/{index-CHL1jdYm.d.mts → index-C3SVtPYg.d.mts} +20 -3
  12. package/dist/index.css +197 -10
  13. package/dist/index.d.mts +13 -5
  14. package/dist/index.d.ts +13 -5
  15. package/dist/index.js +39 -6
  16. package/dist/index.mjs +38 -7
  17. package/dist/server.d.mts +5 -5
  18. package/dist/server.d.ts +5 -5
  19. package/dist/server.js +310 -113
  20. package/dist/server.mjs +307 -112
  21. package/package.json +2 -4
  22. package/src/app/constants.tsx +183 -218
  23. package/src/app/layout.tsx +4 -28
  24. package/src/app/types.ts +17 -17
  25. package/src/components/ChatWidget.tsx +3 -1
  26. package/src/components/ChatWindow.tsx +5 -1
  27. package/src/components/DocViewer.tsx +71 -5
  28. package/src/components/Documentation.tsx +74 -11
  29. package/src/components/constants.tsx +275 -0
  30. package/src/config/RagConfig.ts +10 -10
  31. package/src/config/constants.ts +1 -0
  32. package/src/core/ConfigResolver.ts +24 -25
  33. package/src/core/Pipeline.ts +2 -1
  34. package/src/core/ProviderRegistry.ts +5 -5
  35. package/src/core/Retrivora.ts +46 -6
  36. package/src/core/VectorPlugin.ts +62 -8
  37. package/src/exceptions/index.ts +52 -0
  38. package/src/handlers/index.ts +71 -0
  39. package/src/hooks/useRagChat.ts +4 -1
  40. package/src/index.ts +2 -0
  41. package/src/llm/LLMFactory.ts +6 -5
  42. package/src/server.ts +16 -13
  43. package/src/types/chat.ts +2 -0
  44. package/src/types/props.ts +38 -1
@@ -6,9 +6,6 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
8
  var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
9
- var __typeError = (msg) => {
10
- throw TypeError(msg);
11
- };
12
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
10
  var __spreadValues = (a, b) => {
14
11
  for (var prop in b || (b = {}))
@@ -56,34 +53,6 @@ var __asyncGenerator = (__this, __arguments, generator) => {
56
53
  }, method = (k, call, wait, clear) => it[k] = (x) => (call = new Promise((yes, no, run) => (run = () => resume(k, x, yes, no), q ? q.then(run) : run())), clear = () => q === wait && (q = 0), q = wait = call.then(clear, clear), call), q, it = {};
57
54
  return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
58
55
  };
59
- var __yieldStar = (value) => {
60
- var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
61
- if (obj == null) {
62
- obj = value[__knownSymbol("iterator")]();
63
- method = (k) => it[k] = (x) => obj[k](x);
64
- } else {
65
- obj = obj.call(value);
66
- method = (k) => it[k] = (v) => {
67
- if (isAwait) {
68
- isAwait = false;
69
- if (k === "throw") throw v;
70
- return v;
71
- }
72
- isAwait = true;
73
- return {
74
- done: false,
75
- value: new __await(new Promise((resolve) => {
76
- var x = obj[k](v);
77
- if (!(x instanceof Object)) __typeError("Object expected");
78
- resolve(x);
79
- }), 1)
80
- };
81
- };
82
- }
83
- return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
84
- throw x;
85
- }, "return" in obj && method("return"), it;
86
- };
87
56
  var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
88
57
 
89
58
  // src/utils/templateUtils.ts
@@ -2298,26 +2267,6 @@ function getEnvConfig(env = process.env, base) {
2298
2267
  } : {});
2299
2268
  }
2300
2269
 
2301
- // src/exceptions/index.ts
2302
- var RetrivoraError = class extends Error {
2303
- constructor(message, code, details) {
2304
- super(message);
2305
- this.name = new.target.name;
2306
- this.code = code;
2307
- this.details = details;
2308
- }
2309
- };
2310
- var ProviderNotFoundException = class extends RetrivoraError {
2311
- constructor(providerType, provider, details) {
2312
- super(`Unsupported ${providerType} provider: ${provider}`, "PROVIDER_NOT_FOUND", details);
2313
- }
2314
- };
2315
- var ConfigurationException = class extends RetrivoraError {
2316
- constructor(message, details) {
2317
- super(message, "CONFIGURATION_ERROR", details);
2318
- }
2319
- };
2320
-
2321
2270
  // src/core/ConfigResolver.ts
2322
2271
  var ConfigResolver = class {
2323
2272
  /**
@@ -2363,13 +2312,13 @@ var ConfigResolver = class {
2363
2312
  */
2364
2313
  static validate(config) {
2365
2314
  if (!config.projectId) {
2366
- throw new ConfigurationException("[ConfigResolver] projectId is required");
2315
+ throw new Error("[ConfigResolver] projectId is required");
2367
2316
  }
2368
2317
  if (!config.vectorDb.provider) {
2369
- throw new ConfigurationException("[ConfigResolver] vectorDb.provider is required");
2318
+ throw new Error("[ConfigResolver] vectorDb.provider is required");
2370
2319
  }
2371
2320
  if (!config.llm.provider) {
2372
- throw new ConfigurationException("[ConfigResolver] llm.provider is required");
2321
+ throw new Error("[ConfigResolver] llm.provider is required");
2373
2322
  }
2374
2323
  }
2375
2324
  static mergeRetrievalWorkflow(rag, retrieval, workflow) {
@@ -3410,6 +3359,78 @@ ${context != null ? context : "None"}` },
3410
3359
  }
3411
3360
  };
3412
3361
 
3362
+ // src/exceptions/index.ts
3363
+ var RetrivoraError = class extends Error {
3364
+ constructor(message, code, details) {
3365
+ super(message);
3366
+ this.name = new.target.name;
3367
+ this.code = code;
3368
+ this.details = details;
3369
+ }
3370
+ };
3371
+ var ProviderNotFoundException = class extends RetrivoraError {
3372
+ constructor(providerType, provider, details) {
3373
+ super(`Unsupported ${providerType} provider: ${provider}`, "PROVIDER_NOT_FOUND", details);
3374
+ }
3375
+ };
3376
+ var EmbeddingFailedException = class extends RetrivoraError {
3377
+ constructor(message = "Embedding generation failed", details) {
3378
+ super(message, "EMBEDDING_FAILED", details);
3379
+ }
3380
+ };
3381
+ var RetrievalException = class extends RetrivoraError {
3382
+ constructor(message = "Retrieval failed", details) {
3383
+ super(message, "RETRIEVAL_FAILED", details);
3384
+ }
3385
+ };
3386
+ var RateLimitException = class extends RetrivoraError {
3387
+ constructor(message = "Provider rate limit exceeded", details) {
3388
+ super(message, "RATE_LIMITED", details);
3389
+ }
3390
+ };
3391
+ var ConfigurationException = class extends RetrivoraError {
3392
+ constructor(message, details) {
3393
+ super(message, "CONFIGURATION_ERROR", details);
3394
+ }
3395
+ };
3396
+ var AuthenticationException = class extends RetrivoraError {
3397
+ constructor(message = "Provider authentication failed", details) {
3398
+ super(message, "AUTHENTICATION_ERROR", details);
3399
+ }
3400
+ };
3401
+ function wrapError(err, defaultCode, defaultMessage) {
3402
+ var _a;
3403
+ if (err instanceof RetrivoraError) {
3404
+ return err;
3405
+ }
3406
+ const error = err;
3407
+ const message = (error == null ? void 0 : error.message) || defaultMessage || String(err);
3408
+ const status = (error == null ? void 0 : error.status) || (error == null ? void 0 : error.statusCode) || ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status);
3409
+ const code = error == null ? void 0 : error.code;
3410
+ if (status === 429 || /rate[- ]?limit/i.test(message) || code === "RATE_LIMIT_EXCEEDED") {
3411
+ return new RateLimitException(message, err);
3412
+ }
3413
+ if (status === 401 || status === 403 || /unauthorized|auth|api[- ]?key/i.test(message) || code === "INVALID_API_KEY") {
3414
+ return new AuthenticationException(message, err);
3415
+ }
3416
+ switch (defaultCode) {
3417
+ case "PROVIDER_NOT_FOUND":
3418
+ return new ProviderNotFoundException("provider", message, err);
3419
+ case "EMBEDDING_FAILED":
3420
+ return new EmbeddingFailedException(message, err);
3421
+ case "RETRIEVAL_FAILED":
3422
+ return new RetrievalException(message, err);
3423
+ case "RATE_LIMITED":
3424
+ return new RateLimitException(message, err);
3425
+ case "CONFIGURATION_ERROR":
3426
+ return new ConfigurationException(message, err);
3427
+ case "AUTHENTICATION_ERROR":
3428
+ return new AuthenticationException(message, err);
3429
+ default:
3430
+ return new RetrivoraError(message, defaultCode, err);
3431
+ }
3432
+ }
3433
+
3413
3434
  // src/llm/LLMFactory.ts
3414
3435
  var customProviders = /* @__PURE__ */ new Map();
3415
3436
  var LLMFactory = class _LLMFactory {
@@ -3455,7 +3476,7 @@ var LLMFactory = class _LLMFactory {
3455
3476
  ];
3456
3477
  }
3457
3478
  static create(llmConfig, embeddingConfig) {
3458
- var _a, _b;
3479
+ var _a, _b, _c;
3459
3480
  switch (llmConfig.provider) {
3460
3481
  case "openai":
3461
3482
  return new OpenAIProvider(llmConfig, embeddingConfig);
@@ -3479,9 +3500,12 @@ var LLMFactory = class _LLMFactory {
3479
3500
  return new UniversalLLMAdapter(llmConfig);
3480
3501
  }
3481
3502
  throw new ProviderNotFoundException(
3482
- "LLM",
3483
- String(llmConfig.provider),
3484
- `[LLMFactory] Unknown provider "${llmConfig.provider}". Built-in providers: ${_LLMFactory.listProviders().join(", ")}. Register a custom provider with LLMFactory.register().`
3503
+ "llm",
3504
+ (_c = llmConfig.provider) != null ? _c : "undefined",
3505
+ {
3506
+ message: `Unknown provider "${llmConfig.provider}". Register a custom provider with LLMFactory.register().`,
3507
+ available: _LLMFactory.listProviders()
3508
+ }
3485
3509
  );
3486
3510
  }
3487
3511
  }
@@ -6410,7 +6434,7 @@ var Pipeline = class {
6410
6434
  embedBatchOptions
6411
6435
  );
6412
6436
  if (vectors.length !== chunks.length) {
6413
- throw new Error(
6437
+ throw new EmbeddingFailedException(
6414
6438
  `[Pipeline] Embedding mismatch: got ${vectors.length} vectors for ${chunks.length} chunks. Check embedding provider logs for individual chunk failures.`
6415
6439
  );
6416
6440
  }
@@ -7129,6 +7153,8 @@ var VectorPlugin = class {
7129
7153
  constructor(hostConfig) {
7130
7154
  this.config = ConfigResolver.resolve(hostConfig);
7131
7155
  this.validationPromise = ConfigValidator.validateAndThrow(this.config);
7156
+ this.validationPromise.catch(() => {
7157
+ });
7132
7158
  this.pipeline = new Pipeline(this.config);
7133
7159
  }
7134
7160
  /**
@@ -7162,31 +7188,93 @@ var VectorPlugin = class {
7162
7188
  * Run a chat query.
7163
7189
  */
7164
7190
  async chat(message, history = [], namespace) {
7165
- await this.validationPromise;
7166
- return this.pipeline.ask(message, history, namespace);
7191
+ try {
7192
+ await this.validationPromise;
7193
+ } catch (err) {
7194
+ throw wrapError(err, "CONFIGURATION_ERROR");
7195
+ }
7196
+ try {
7197
+ return await this.pipeline.ask(message, history, namespace);
7198
+ } catch (err) {
7199
+ const msg = String(err);
7200
+ let defaultCode = "RETRIEVAL_FAILED";
7201
+ if (msg.includes("Embed") || msg.includes("embed")) {
7202
+ defaultCode = "EMBEDDING_FAILED";
7203
+ }
7204
+ throw wrapError(err, defaultCode);
7205
+ }
7167
7206
  }
7168
7207
  /**
7169
7208
  * Run a streaming chat query.
7170
7209
  */
7171
7210
  chatStream(_0) {
7172
7211
  return __asyncGenerator(this, arguments, function* (message, history = [], namespace) {
7173
- yield new __await(this.validationPromise);
7174
- yield* __yieldStar(this.pipeline.askStream(message, history, namespace));
7212
+ try {
7213
+ yield new __await(this.validationPromise);
7214
+ } catch (err) {
7215
+ throw wrapError(err, "CONFIGURATION_ERROR");
7216
+ }
7217
+ try {
7218
+ const stream = this.pipeline.askStream(message, history, namespace);
7219
+ try {
7220
+ for (var iter = __forAwait(stream), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
7221
+ const chunk = temp.value;
7222
+ yield chunk;
7223
+ }
7224
+ } catch (temp) {
7225
+ error = [temp];
7226
+ } finally {
7227
+ try {
7228
+ more && (temp = iter.return) && (yield new __await(temp.call(iter)));
7229
+ } finally {
7230
+ if (error)
7231
+ throw error[0];
7232
+ }
7233
+ }
7234
+ } catch (err) {
7235
+ const msg = String(err);
7236
+ let defaultCode = "RETRIEVAL_FAILED";
7237
+ if (msg.includes("Embed") || msg.includes("embed")) {
7238
+ defaultCode = "EMBEDDING_FAILED";
7239
+ }
7240
+ throw wrapError(err, defaultCode);
7241
+ }
7175
7242
  });
7176
7243
  }
7177
7244
  /**
7178
7245
  * Ingest documents into the vector database.
7179
7246
  */
7180
7247
  async ingest(documents, namespace) {
7181
- await this.validationPromise;
7182
- return this.pipeline.ingest(documents, namespace);
7248
+ try {
7249
+ await this.validationPromise;
7250
+ } catch (err) {
7251
+ throw wrapError(err, "CONFIGURATION_ERROR");
7252
+ }
7253
+ try {
7254
+ return await this.pipeline.ingest(documents, namespace);
7255
+ } catch (err) {
7256
+ const msg = String(err);
7257
+ let defaultCode = "RETRIEVAL_FAILED";
7258
+ if (msg.includes("Embed") || msg.includes("embed")) {
7259
+ defaultCode = "EMBEDDING_FAILED";
7260
+ }
7261
+ throw wrapError(err, defaultCode);
7262
+ }
7183
7263
  }
7184
7264
  /**
7185
7265
  * Get auto-suggestions based on a query prefix.
7186
7266
  */
7187
7267
  async getSuggestions(query, namespace) {
7188
- await this.validationPromise;
7189
- return this.pipeline.getSuggestions(query, namespace);
7268
+ try {
7269
+ await this.validationPromise;
7270
+ } catch (err) {
7271
+ throw wrapError(err, "CONFIGURATION_ERROR");
7272
+ }
7273
+ try {
7274
+ return await this.pipeline.getSuggestions(query, namespace);
7275
+ } catch (err) {
7276
+ throw wrapError(err, "RETRIEVAL_FAILED");
7277
+ }
7190
7278
  }
7191
7279
  };
7192
7280
 
@@ -7536,10 +7624,67 @@ function createSuggestionsHandler(configOrPlugin) {
7536
7624
  }
7537
7625
  };
7538
7626
  }
7627
+ function createRagHandler(configOrPlugin) {
7628
+ const plugin = configOrPlugin instanceof VectorPlugin ? configOrPlugin : new VectorPlugin(configOrPlugin);
7629
+ const chatHandler = createChatHandler(plugin);
7630
+ const streamHandler = createStreamHandler(plugin);
7631
+ const uploadHandler = createUploadHandler(plugin);
7632
+ const healthHandler = createHealthHandler(plugin);
7633
+ const suggestionsHandler = createSuggestionsHandler(plugin);
7634
+ async function routePostRequest(req, segment) {
7635
+ switch (segment) {
7636
+ case "chat":
7637
+ return streamHandler(req);
7638
+ case "chat-sync":
7639
+ return chatHandler(req);
7640
+ case "upload":
7641
+ return uploadHandler(req);
7642
+ case "suggestions":
7643
+ return suggestionsHandler(req);
7644
+ case "health":
7645
+ return healthHandler();
7646
+ default:
7647
+ return NextResponse.json({ error: `Not Found: POST segment "${segment}" not supported.` }, { status: 404 });
7648
+ }
7649
+ }
7650
+ async function routeGetRequest(req, segment) {
7651
+ if (segment === "health") {
7652
+ return healthHandler();
7653
+ }
7654
+ return NextResponse.json({ error: `Method Not Allowed: GET is only supported for "health" segment.` }, { status: 405 });
7655
+ }
7656
+ async function getSegment(context) {
7657
+ var _a;
7658
+ const resolvedParams = typeof ((_a = context == null ? void 0 : context.params) == null ? void 0 : _a.then) === "function" ? await context.params : context == null ? void 0 : context.params;
7659
+ const segments = (resolvedParams == null ? void 0 : resolvedParams.retrivora) || [];
7660
+ return segments[0] || "chat";
7661
+ }
7662
+ return {
7663
+ GET: async (req, context) => {
7664
+ try {
7665
+ const segment = await getSegment(context);
7666
+ return await routeGetRequest(req, segment);
7667
+ } catch (err) {
7668
+ const msg = err instanceof Error ? err.message : "GET Routing failed";
7669
+ return NextResponse.json({ error: msg }, { status: 500 });
7670
+ }
7671
+ },
7672
+ POST: async (req, context) => {
7673
+ try {
7674
+ const segment = await getSegment(context);
7675
+ return await routePostRequest(req, segment);
7676
+ } catch (err) {
7677
+ const msg = err instanceof Error ? err.message : "POST Routing failed";
7678
+ return NextResponse.json({ error: msg }, { status: 500 });
7679
+ }
7680
+ }
7681
+ };
7682
+ }
7539
7683
  export {
7540
7684
  createChatHandler,
7541
7685
  createHealthHandler,
7542
7686
  createIngestHandler,
7687
+ createRagHandler,
7543
7688
  createStreamHandler,
7544
7689
  createSuggestionsHandler,
7545
7690
  createUploadHandler,
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-DNhyOYoK.js';
1
+ import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-Bhk6zJOK.js';
2
2
 
3
3
  /**
4
4
  * DocumentChunker — splits long text into overlapping chunks
@@ -179,5 +179,9 @@ declare class ConfigurationException extends RetrivoraError {
179
179
  declare class AuthenticationException extends RetrivoraError {
180
180
  constructor(message?: string, details?: unknown);
181
181
  }
182
+ /**
183
+ * Wraps any unknown error into an appropriate RetrivoraError subclass.
184
+ */
185
+ declare function wrapError(err: unknown, defaultCode: RetrivoraErrorCode, defaultMessage?: string): RetrivoraError;
182
186
 
183
- export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g };
187
+ export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g, wrapError as w };
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-DNhyOYoK.mjs';
1
+ import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-Bhk6zJOK.mjs';
2
2
 
3
3
  /**
4
4
  * DocumentChunker — splits long text into overlapping chunks
@@ -179,5 +179,9 @@ declare class ConfigurationException extends RetrivoraError {
179
179
  declare class AuthenticationException extends RetrivoraError {
180
180
  constructor(message?: string, details?: unknown);
181
181
  }
182
+ /**
183
+ * Wraps any unknown error into an appropriate RetrivoraError subclass.
184
+ */
185
+ declare function wrapError(err: unknown, defaultCode: RetrivoraErrorCode, defaultMessage?: string): RetrivoraError;
182
186
 
183
- export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g };
187
+ export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g, wrapError as w };
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-DNhyOYoK.js';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bhk6zJOK.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -110,7 +110,7 @@ declare class VectorPlugin {
110
110
  /**
111
111
  * Run a streaming chat query.
112
112
  */
113
- chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, any>;
113
+ chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, unknown>;
114
114
  /**
115
115
  * Ingest documents into the vector database.
116
116
  */
@@ -224,5 +224,22 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
224
224
  }> | NextResponse<{
225
225
  suggestions: string[];
226
226
  }>>;
227
+ /**
228
+ * createRagHandler — factory that returns GET and POST handlers for a catch-all route
229
+ * (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
230
+ */
231
+ declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin): {
232
+ GET: (req: NextRequest, context: any) => Promise<NextResponse<{
233
+ timestamp: string;
234
+ vectorDb: HealthCheckResult;
235
+ llm: HealthCheckResult;
236
+ embedding?: HealthCheckResult;
237
+ allHealthy: boolean;
238
+ status: string;
239
+ }> | NextResponse<{
240
+ error: string;
241
+ }>>;
242
+ POST: (req: NextRequest, context: any) => Promise<Response>;
243
+ };
227
244
 
228
- export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createStreamHandler as f, createUploadHandler as g, sseFrame as h, sseMetaFrame as i, sseTextFrame as j, createSuggestionsHandler as k, sseObservabilityFrame as l, sseUIFrame as m, sseErrorFrame as s };
245
+ export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createRagHandler as f, createStreamHandler as g, createUploadHandler as h, sseFrame as i, sseMetaFrame as j, sseTextFrame as k, createSuggestionsHandler as l, sseObservabilityFrame as m, sseUIFrame as n, sseErrorFrame as s };
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-DNhyOYoK.mjs';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bhk6zJOK.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -110,7 +110,7 @@ declare class VectorPlugin {
110
110
  /**
111
111
  * Run a streaming chat query.
112
112
  */
113
- chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, any>;
113
+ chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, unknown>;
114
114
  /**
115
115
  * Ingest documents into the vector database.
116
116
  */
@@ -224,5 +224,22 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
224
224
  }> | NextResponse<{
225
225
  suggestions: string[];
226
226
  }>>;
227
+ /**
228
+ * createRagHandler — factory that returns GET and POST handlers for a catch-all route
229
+ * (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
230
+ */
231
+ declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin): {
232
+ GET: (req: NextRequest, context: any) => Promise<NextResponse<{
233
+ timestamp: string;
234
+ vectorDb: HealthCheckResult;
235
+ llm: HealthCheckResult;
236
+ embedding?: HealthCheckResult;
237
+ allHealthy: boolean;
238
+ status: string;
239
+ }> | NextResponse<{
240
+ error: string;
241
+ }>>;
242
+ POST: (req: NextRequest, context: any) => Promise<Response>;
243
+ };
227
244
 
228
- export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createStreamHandler as f, createUploadHandler as g, sseFrame as h, sseMetaFrame as i, sseTextFrame as j, createSuggestionsHandler as k, sseObservabilityFrame as l, sseUIFrame as m, sseErrorFrame as s };
245
+ export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createRagHandler as f, createStreamHandler as g, createUploadHandler as h, sseFrame as i, sseMetaFrame as j, sseTextFrame as k, createSuggestionsHandler as l, sseObservabilityFrame as m, sseUIFrame as n, sseErrorFrame as s };