@retrivora-ai/rag-engine 2.3.5 → 2.3.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.
- package/dist/{BatchProcessor-tVzb9CdE.d.mts → BatchProcessor-BhLczWj5.d.mts} +179 -3
- package/dist/{BatchProcessor-CQDtlggz.d.ts → BatchProcessor-C42_RVWO.d.ts} +179 -3
- package/dist/{ILLMProvider-CcJ5N6XD.d.mts → ILLMProvider-B8TAVx3j.d.mts} +63 -1
- package/dist/{ILLMProvider-CcJ5N6XD.d.ts → ILLMProvider-B8TAVx3j.d.ts} +63 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +493 -217
- package/dist/handlers/index.mjs +493 -217
- package/dist/{index-BwmyPJHp.d.ts → index-ejOWsaqb.d.ts} +1 -1
- package/dist/{index-CL-zF6bD.d.mts → index-xxQOFx-u.d.mts} +1 -1
- package/dist/index.css +9 -0
- package/dist/index.d.mts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +643 -207
- package/dist/index.mjs +683 -252
- package/dist/server.d.mts +253 -7
- package/dist/server.d.ts +253 -7
- package/dist/server.js +1145 -230
- package/dist/server.mjs +1131 -230
- package/package.json +1 -1
- package/src/LicensedRetrivora.ts +273 -0
- package/src/components/ChatWidget.tsx +44 -19
- package/src/components/ChatWindow.tsx +30 -14
- package/src/components/ConfigProvider.tsx +86 -6
- package/src/components/DocumentUpload.tsx +8 -2
- package/src/config/LicenseConfigResolver.ts +296 -0
- package/src/config/RagConfig.ts +4 -0
- package/src/config/serverConfig.ts +74 -14
- package/src/core/ConfigFetcher.ts +10 -1
- package/src/core/ConfigResolver.ts +1 -0
- package/src/core/LicenseValidator.ts +21 -12
- package/src/core/LicenseVerifier.ts +7 -11
- package/src/core/ProjectSettings.ts +247 -0
- package/src/handlers/index.ts +65 -5
- package/src/hooks/useProjectSettings.ts +105 -0
- package/src/index.css +9 -0
- package/src/index.ts +37 -0
- package/src/llm/providers/UniversalLLMAdapter.ts +67 -12
- package/src/server.ts +46 -2
- package/src/telemetry/TelemetryService.ts +330 -0
- package/src/types/props.ts +14 -2
package/dist/server.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig,
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
6
|
-
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-
|
|
1
|
+
import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, n as RagConfig, t as UniversalRagConfig, u as UpsertDocument, w as VectorMatch, G as GraphDBConfig, D as GraphNode, F as Edge, H as GraphSearchResult, I as ILLMProvider, v as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, s as UIConfig, J as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions, f as IngestDocument, c as ChatResponse } from './ILLMProvider-B8TAVx3j.mjs';
|
|
2
|
+
export { A as AuthMode, K as BarChartData, M as CarouselProduct, N as IRetriever, h as LatencyBreakdown, Q as LineChartDataPoint, S as MessageRole, X as MetricCardData, O as ObservabilityTrace, Y as PieChartData, Z as Product, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, P as ProjectChatSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, o as RagMessage, p as RetrievalConfig, _ as RetrievalResult, q as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, r as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-B8TAVx3j.mjs';
|
|
3
|
+
import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-BhLczWj5.mjs';
|
|
4
|
+
export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-BhLczWj5.mjs';
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-xxQOFx-u.mjs';
|
|
6
|
+
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-xxQOFx-u.mjs';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -246,6 +246,32 @@ declare class ProviderRegistry {
|
|
|
246
246
|
* universal_rest→ VECTOR_BASE_URL, VECTOR_DB_REST_API_KEY
|
|
247
247
|
*/
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Runtime tier configuration injected from the /api/v1/config + /api/v1/credentials
|
|
251
|
+
* API responses at app startup. This overrides static env-var defaults so that
|
|
252
|
+
* the tier-based model selection from the license is applied to all SDK calls.
|
|
253
|
+
*/
|
|
254
|
+
interface RuntimeTierConfig {
|
|
255
|
+
llmModel?: string;
|
|
256
|
+
embeddingModel?: string;
|
|
257
|
+
/** LiteLLM master key for authenticating with llm.retrivora.com */
|
|
258
|
+
litellmApiKey?: string;
|
|
259
|
+
/** LiteLLM gateway base URL (defaults to https://llm.retrivora.com/api/v1) */
|
|
260
|
+
llmBaseUrl?: string;
|
|
261
|
+
embeddingBaseUrl?: string;
|
|
262
|
+
maxTokens?: number;
|
|
263
|
+
topK?: number;
|
|
264
|
+
chunkSize?: number;
|
|
265
|
+
chunkOverlap?: number;
|
|
266
|
+
tier?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Inject tier-based config fetched from /api/v1/config + /api/v1/credentials.
|
|
270
|
+
* Call this once after successful license init (e.g. in validate-env.ts).
|
|
271
|
+
*/
|
|
272
|
+
declare function injectRuntimeConfig(config: RuntimeTierConfig): void;
|
|
273
|
+
/** Returns the currently injected runtime config, or null if not yet set. */
|
|
274
|
+
declare function getRuntimeConfig(): RuntimeTierConfig | null;
|
|
249
275
|
declare function getRagConfig(baseConfig?: Partial<RagConfig>, env?: Record<string, string | undefined>): RagConfig;
|
|
250
276
|
|
|
251
277
|
/**
|
|
@@ -1126,4 +1152,224 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1126
1152
|
ping(): Promise<boolean>;
|
|
1127
1153
|
}
|
|
1128
1154
|
|
|
1129
|
-
|
|
1155
|
+
/**
|
|
1156
|
+
* LicensedRetrivora — End-user facing SDK that only requires:
|
|
1157
|
+
* - License Key (JWT from Retrivora)
|
|
1158
|
+
* - Project ID (workspace identifier)
|
|
1159
|
+
*
|
|
1160
|
+
* Everything else (models, vector DB, embeddings) is resolved from
|
|
1161
|
+
* the Retrivora admin dashboard based on tier.
|
|
1162
|
+
*
|
|
1163
|
+
* NOTE: This is a SERVER-ONLY module. Import from '@retrivora-ai/rag-engine/server'
|
|
1164
|
+
* Do NOT import in client components.
|
|
1165
|
+
*/
|
|
1166
|
+
|
|
1167
|
+
interface LicensedRetrivoraOptions {
|
|
1168
|
+
licenseKey: string;
|
|
1169
|
+
projectId: string;
|
|
1170
|
+
userTelemetryUrl?: string;
|
|
1171
|
+
enableTelemetry?: boolean;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* End-user facing SDK for Retrivora RAG engine
|
|
1175
|
+
*/
|
|
1176
|
+
declare class LicensedRetrivora {
|
|
1177
|
+
private licenseKey;
|
|
1178
|
+
private projectId;
|
|
1179
|
+
private pipeline?;
|
|
1180
|
+
private ragConfig?;
|
|
1181
|
+
private initialized;
|
|
1182
|
+
constructor(options: LicensedRetrivoraOptions);
|
|
1183
|
+
/**
|
|
1184
|
+
* Initialize the SDK by validating license and fetching config
|
|
1185
|
+
*/
|
|
1186
|
+
private generateId;
|
|
1187
|
+
/**
|
|
1188
|
+
* Initialize the SDK by validating license and fetching config
|
|
1189
|
+
*/
|
|
1190
|
+
initialize(): Promise<void>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Ingest documents (upload files to vector database)
|
|
1193
|
+
* Returns success/failure status to end-user
|
|
1194
|
+
*/
|
|
1195
|
+
ingest(documents: IngestDocument[]): Promise<{
|
|
1196
|
+
success: boolean;
|
|
1197
|
+
message: string;
|
|
1198
|
+
documentIds?: string[];
|
|
1199
|
+
}>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Execute a user query and get response
|
|
1202
|
+
* Returns only the response text and sources (abstracted from underlying models)
|
|
1203
|
+
*/
|
|
1204
|
+
query(queryText: string, options?: {
|
|
1205
|
+
topK?: number;
|
|
1206
|
+
}): Promise<ChatResponse>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Get license tier information (for UI display if needed)
|
|
1209
|
+
*/
|
|
1210
|
+
getTierInfo(): Promise<{
|
|
1211
|
+
tier: string;
|
|
1212
|
+
model: string;
|
|
1213
|
+
embeddingModel: string;
|
|
1214
|
+
}>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Cleanup and shutdown
|
|
1217
|
+
*/
|
|
1218
|
+
shutdown(): Promise<void>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Check if SDK is initialized
|
|
1221
|
+
*/
|
|
1222
|
+
isInitialized(): boolean;
|
|
1223
|
+
/**
|
|
1224
|
+
* Get current RAG configuration (for debugging)
|
|
1225
|
+
*/
|
|
1226
|
+
getConfig(): RagConfig | undefined;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Convenience function to create and initialize SDK in one call
|
|
1230
|
+
*/
|
|
1231
|
+
declare function createRetrivora(options: LicensedRetrivoraOptions): Promise<LicensedRetrivora>;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* TelemetryService — Tracks LLM calls, embedding operations, and user interactions
|
|
1235
|
+
* for billing, analytics, and usage monitoring.
|
|
1236
|
+
*
|
|
1237
|
+
* Sends telemetry to both:
|
|
1238
|
+
* - Admin dashboard (retrivora.com)
|
|
1239
|
+
* - User's own dashboard (if configured)
|
|
1240
|
+
*/
|
|
1241
|
+
declare enum EventType {
|
|
1242
|
+
EMBEDDING_GENERATED = "embedding_generated",
|
|
1243
|
+
LLM_CHAT_COMPLETION = "llm_chat_completion",
|
|
1244
|
+
DOCUMENT_INGESTED = "document_ingested",
|
|
1245
|
+
QUERY_EXECUTED = "query_executed",
|
|
1246
|
+
ERROR_OCCURRED = "error_occurred",
|
|
1247
|
+
CONFIGURATION_LOADED = "configuration_loaded"
|
|
1248
|
+
}
|
|
1249
|
+
interface TelemetryEvent {
|
|
1250
|
+
eventType: EventType;
|
|
1251
|
+
projectId: string;
|
|
1252
|
+
timestamp: number;
|
|
1253
|
+
operationId?: string;
|
|
1254
|
+
durationMs?: number;
|
|
1255
|
+
model?: string;
|
|
1256
|
+
inputTokens?: number;
|
|
1257
|
+
outputTokens?: number;
|
|
1258
|
+
totalTokens?: number;
|
|
1259
|
+
embeddingModel?: string;
|
|
1260
|
+
vectorDimensions?: number;
|
|
1261
|
+
textLength?: number;
|
|
1262
|
+
documentId?: string;
|
|
1263
|
+
documentName?: string;
|
|
1264
|
+
documentSize?: number;
|
|
1265
|
+
chunksGenerated?: number;
|
|
1266
|
+
queryText?: string;
|
|
1267
|
+
resultCount?: number;
|
|
1268
|
+
errorCode?: string;
|
|
1269
|
+
errorMessage?: string;
|
|
1270
|
+
stackTrace?: string;
|
|
1271
|
+
metadata?: Record<string, unknown>;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Telemetry service for tracking usage, billing, and analytics
|
|
1275
|
+
*/
|
|
1276
|
+
declare class TelemetryService {
|
|
1277
|
+
private static readonly RETRIVORA_TELEMETRY_URL;
|
|
1278
|
+
private static readonly USER_TELEMETRY_URL_ENV_KEY;
|
|
1279
|
+
private http;
|
|
1280
|
+
private projectId;
|
|
1281
|
+
private licenseKey;
|
|
1282
|
+
private userTelemetryUrl?;
|
|
1283
|
+
private batchSize;
|
|
1284
|
+
private flushIntervalMs;
|
|
1285
|
+
private eventQueue;
|
|
1286
|
+
private flushTimer?;
|
|
1287
|
+
private enabled;
|
|
1288
|
+
constructor(projectId: string, licenseKey: string, userTelemetryUrl?: string);
|
|
1289
|
+
/**
|
|
1290
|
+
* Record a telemetry event
|
|
1291
|
+
*/
|
|
1292
|
+
recordEvent(event: Partial<TelemetryEvent>): void;
|
|
1293
|
+
/**
|
|
1294
|
+
* Record LLM completion event
|
|
1295
|
+
*/
|
|
1296
|
+
recordLLMCompletion(data: {
|
|
1297
|
+
model: string;
|
|
1298
|
+
inputTokens: number;
|
|
1299
|
+
outputTokens: number;
|
|
1300
|
+
durationMs: number;
|
|
1301
|
+
operationId?: string;
|
|
1302
|
+
metadata?: Record<string, unknown>;
|
|
1303
|
+
}): void;
|
|
1304
|
+
/**
|
|
1305
|
+
* Record embedding generation event
|
|
1306
|
+
*/
|
|
1307
|
+
recordEmbeddingGenerated(data: {
|
|
1308
|
+
embeddingModel: string;
|
|
1309
|
+
vectorDimensions: number;
|
|
1310
|
+
textLength: number;
|
|
1311
|
+
durationMs: number;
|
|
1312
|
+
operationId?: string;
|
|
1313
|
+
}): void;
|
|
1314
|
+
/**
|
|
1315
|
+
* Record document ingestion event
|
|
1316
|
+
*/
|
|
1317
|
+
recordDocumentIngested(data: {
|
|
1318
|
+
documentId: string;
|
|
1319
|
+
documentName: string;
|
|
1320
|
+
documentSize: number;
|
|
1321
|
+
chunksGenerated: number;
|
|
1322
|
+
durationMs: number;
|
|
1323
|
+
}): void;
|
|
1324
|
+
/**
|
|
1325
|
+
* Record query execution event
|
|
1326
|
+
*/
|
|
1327
|
+
recordQueryExecuted(data: {
|
|
1328
|
+
queryText: string;
|
|
1329
|
+
resultCount: number;
|
|
1330
|
+
durationMs: number;
|
|
1331
|
+
operationId?: string;
|
|
1332
|
+
}): void;
|
|
1333
|
+
/**
|
|
1334
|
+
* Record error event
|
|
1335
|
+
*/
|
|
1336
|
+
recordError(error: Error, context?: Record<string, unknown>): void;
|
|
1337
|
+
/**
|
|
1338
|
+
* Flush all queued events to telemetry endpoints
|
|
1339
|
+
*/
|
|
1340
|
+
flush(): Promise<void>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Start automatic flush interval
|
|
1343
|
+
*/
|
|
1344
|
+
private startAutoFlush;
|
|
1345
|
+
/**
|
|
1346
|
+
* Stop telemetry service and flush remaining events
|
|
1347
|
+
*/
|
|
1348
|
+
shutdown(): Promise<void>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Disable telemetry temporarily
|
|
1351
|
+
*/
|
|
1352
|
+
disable(): void;
|
|
1353
|
+
/**
|
|
1354
|
+
* Enable telemetry
|
|
1355
|
+
*/
|
|
1356
|
+
enable(): void;
|
|
1357
|
+
/**
|
|
1358
|
+
* Get current queue size (for debugging)
|
|
1359
|
+
*/
|
|
1360
|
+
getQueueSize(): number;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Get or create global telemetry service instance
|
|
1364
|
+
*/
|
|
1365
|
+
declare function getTelemetryService(): TelemetryService | null;
|
|
1366
|
+
/**
|
|
1367
|
+
* Initialize global telemetry service
|
|
1368
|
+
*/
|
|
1369
|
+
declare function initializeTelemetryService(projectId: string, licenseKey: string, userTelemetryUrl?: string): TelemetryService;
|
|
1370
|
+
/**
|
|
1371
|
+
* Shutdown global telemetry service
|
|
1372
|
+
*/
|
|
1373
|
+
declare function shutdownTelemetryService(): Promise<void>;
|
|
1374
|
+
|
|
1375
|
+
export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig,
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
6
|
-
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-
|
|
1
|
+
import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, n as RagConfig, t as UniversalRagConfig, u as UpsertDocument, w as VectorMatch, G as GraphDBConfig, D as GraphNode, F as Edge, H as GraphSearchResult, I as ILLMProvider, v as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, s as UIConfig, J as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions, f as IngestDocument, c as ChatResponse } from './ILLMProvider-B8TAVx3j.js';
|
|
2
|
+
export { A as AuthMode, K as BarChartData, M as CarouselProduct, N as IRetriever, h as LatencyBreakdown, Q as LineChartDataPoint, S as MessageRole, X as MetricCardData, O as ObservabilityTrace, Y as PieChartData, Z as Product, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, P as ProjectChatSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, o as RagMessage, p as RetrievalConfig, _ as RetrievalResult, q as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, r as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-B8TAVx3j.js';
|
|
3
|
+
import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-C42_RVWO.js';
|
|
4
|
+
export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-C42_RVWO.js';
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-ejOWsaqb.js';
|
|
6
|
+
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-ejOWsaqb.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -246,6 +246,32 @@ declare class ProviderRegistry {
|
|
|
246
246
|
* universal_rest→ VECTOR_BASE_URL, VECTOR_DB_REST_API_KEY
|
|
247
247
|
*/
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Runtime tier configuration injected from the /api/v1/config + /api/v1/credentials
|
|
251
|
+
* API responses at app startup. This overrides static env-var defaults so that
|
|
252
|
+
* the tier-based model selection from the license is applied to all SDK calls.
|
|
253
|
+
*/
|
|
254
|
+
interface RuntimeTierConfig {
|
|
255
|
+
llmModel?: string;
|
|
256
|
+
embeddingModel?: string;
|
|
257
|
+
/** LiteLLM master key for authenticating with llm.retrivora.com */
|
|
258
|
+
litellmApiKey?: string;
|
|
259
|
+
/** LiteLLM gateway base URL (defaults to https://llm.retrivora.com/api/v1) */
|
|
260
|
+
llmBaseUrl?: string;
|
|
261
|
+
embeddingBaseUrl?: string;
|
|
262
|
+
maxTokens?: number;
|
|
263
|
+
topK?: number;
|
|
264
|
+
chunkSize?: number;
|
|
265
|
+
chunkOverlap?: number;
|
|
266
|
+
tier?: string;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Inject tier-based config fetched from /api/v1/config + /api/v1/credentials.
|
|
270
|
+
* Call this once after successful license init (e.g. in validate-env.ts).
|
|
271
|
+
*/
|
|
272
|
+
declare function injectRuntimeConfig(config: RuntimeTierConfig): void;
|
|
273
|
+
/** Returns the currently injected runtime config, or null if not yet set. */
|
|
274
|
+
declare function getRuntimeConfig(): RuntimeTierConfig | null;
|
|
249
275
|
declare function getRagConfig(baseConfig?: Partial<RagConfig>, env?: Record<string, string | undefined>): RagConfig;
|
|
250
276
|
|
|
251
277
|
/**
|
|
@@ -1126,4 +1152,224 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1126
1152
|
ping(): Promise<boolean>;
|
|
1127
1153
|
}
|
|
1128
1154
|
|
|
1129
|
-
|
|
1155
|
+
/**
|
|
1156
|
+
* LicensedRetrivora — End-user facing SDK that only requires:
|
|
1157
|
+
* - License Key (JWT from Retrivora)
|
|
1158
|
+
* - Project ID (workspace identifier)
|
|
1159
|
+
*
|
|
1160
|
+
* Everything else (models, vector DB, embeddings) is resolved from
|
|
1161
|
+
* the Retrivora admin dashboard based on tier.
|
|
1162
|
+
*
|
|
1163
|
+
* NOTE: This is a SERVER-ONLY module. Import from '@retrivora-ai/rag-engine/server'
|
|
1164
|
+
* Do NOT import in client components.
|
|
1165
|
+
*/
|
|
1166
|
+
|
|
1167
|
+
interface LicensedRetrivoraOptions {
|
|
1168
|
+
licenseKey: string;
|
|
1169
|
+
projectId: string;
|
|
1170
|
+
userTelemetryUrl?: string;
|
|
1171
|
+
enableTelemetry?: boolean;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* End-user facing SDK for Retrivora RAG engine
|
|
1175
|
+
*/
|
|
1176
|
+
declare class LicensedRetrivora {
|
|
1177
|
+
private licenseKey;
|
|
1178
|
+
private projectId;
|
|
1179
|
+
private pipeline?;
|
|
1180
|
+
private ragConfig?;
|
|
1181
|
+
private initialized;
|
|
1182
|
+
constructor(options: LicensedRetrivoraOptions);
|
|
1183
|
+
/**
|
|
1184
|
+
* Initialize the SDK by validating license and fetching config
|
|
1185
|
+
*/
|
|
1186
|
+
private generateId;
|
|
1187
|
+
/**
|
|
1188
|
+
* Initialize the SDK by validating license and fetching config
|
|
1189
|
+
*/
|
|
1190
|
+
initialize(): Promise<void>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Ingest documents (upload files to vector database)
|
|
1193
|
+
* Returns success/failure status to end-user
|
|
1194
|
+
*/
|
|
1195
|
+
ingest(documents: IngestDocument[]): Promise<{
|
|
1196
|
+
success: boolean;
|
|
1197
|
+
message: string;
|
|
1198
|
+
documentIds?: string[];
|
|
1199
|
+
}>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Execute a user query and get response
|
|
1202
|
+
* Returns only the response text and sources (abstracted from underlying models)
|
|
1203
|
+
*/
|
|
1204
|
+
query(queryText: string, options?: {
|
|
1205
|
+
topK?: number;
|
|
1206
|
+
}): Promise<ChatResponse>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Get license tier information (for UI display if needed)
|
|
1209
|
+
*/
|
|
1210
|
+
getTierInfo(): Promise<{
|
|
1211
|
+
tier: string;
|
|
1212
|
+
model: string;
|
|
1213
|
+
embeddingModel: string;
|
|
1214
|
+
}>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Cleanup and shutdown
|
|
1217
|
+
*/
|
|
1218
|
+
shutdown(): Promise<void>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Check if SDK is initialized
|
|
1221
|
+
*/
|
|
1222
|
+
isInitialized(): boolean;
|
|
1223
|
+
/**
|
|
1224
|
+
* Get current RAG configuration (for debugging)
|
|
1225
|
+
*/
|
|
1226
|
+
getConfig(): RagConfig | undefined;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Convenience function to create and initialize SDK in one call
|
|
1230
|
+
*/
|
|
1231
|
+
declare function createRetrivora(options: LicensedRetrivoraOptions): Promise<LicensedRetrivora>;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* TelemetryService — Tracks LLM calls, embedding operations, and user interactions
|
|
1235
|
+
* for billing, analytics, and usage monitoring.
|
|
1236
|
+
*
|
|
1237
|
+
* Sends telemetry to both:
|
|
1238
|
+
* - Admin dashboard (retrivora.com)
|
|
1239
|
+
* - User's own dashboard (if configured)
|
|
1240
|
+
*/
|
|
1241
|
+
declare enum EventType {
|
|
1242
|
+
EMBEDDING_GENERATED = "embedding_generated",
|
|
1243
|
+
LLM_CHAT_COMPLETION = "llm_chat_completion",
|
|
1244
|
+
DOCUMENT_INGESTED = "document_ingested",
|
|
1245
|
+
QUERY_EXECUTED = "query_executed",
|
|
1246
|
+
ERROR_OCCURRED = "error_occurred",
|
|
1247
|
+
CONFIGURATION_LOADED = "configuration_loaded"
|
|
1248
|
+
}
|
|
1249
|
+
interface TelemetryEvent {
|
|
1250
|
+
eventType: EventType;
|
|
1251
|
+
projectId: string;
|
|
1252
|
+
timestamp: number;
|
|
1253
|
+
operationId?: string;
|
|
1254
|
+
durationMs?: number;
|
|
1255
|
+
model?: string;
|
|
1256
|
+
inputTokens?: number;
|
|
1257
|
+
outputTokens?: number;
|
|
1258
|
+
totalTokens?: number;
|
|
1259
|
+
embeddingModel?: string;
|
|
1260
|
+
vectorDimensions?: number;
|
|
1261
|
+
textLength?: number;
|
|
1262
|
+
documentId?: string;
|
|
1263
|
+
documentName?: string;
|
|
1264
|
+
documentSize?: number;
|
|
1265
|
+
chunksGenerated?: number;
|
|
1266
|
+
queryText?: string;
|
|
1267
|
+
resultCount?: number;
|
|
1268
|
+
errorCode?: string;
|
|
1269
|
+
errorMessage?: string;
|
|
1270
|
+
stackTrace?: string;
|
|
1271
|
+
metadata?: Record<string, unknown>;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Telemetry service for tracking usage, billing, and analytics
|
|
1275
|
+
*/
|
|
1276
|
+
declare class TelemetryService {
|
|
1277
|
+
private static readonly RETRIVORA_TELEMETRY_URL;
|
|
1278
|
+
private static readonly USER_TELEMETRY_URL_ENV_KEY;
|
|
1279
|
+
private http;
|
|
1280
|
+
private projectId;
|
|
1281
|
+
private licenseKey;
|
|
1282
|
+
private userTelemetryUrl?;
|
|
1283
|
+
private batchSize;
|
|
1284
|
+
private flushIntervalMs;
|
|
1285
|
+
private eventQueue;
|
|
1286
|
+
private flushTimer?;
|
|
1287
|
+
private enabled;
|
|
1288
|
+
constructor(projectId: string, licenseKey: string, userTelemetryUrl?: string);
|
|
1289
|
+
/**
|
|
1290
|
+
* Record a telemetry event
|
|
1291
|
+
*/
|
|
1292
|
+
recordEvent(event: Partial<TelemetryEvent>): void;
|
|
1293
|
+
/**
|
|
1294
|
+
* Record LLM completion event
|
|
1295
|
+
*/
|
|
1296
|
+
recordLLMCompletion(data: {
|
|
1297
|
+
model: string;
|
|
1298
|
+
inputTokens: number;
|
|
1299
|
+
outputTokens: number;
|
|
1300
|
+
durationMs: number;
|
|
1301
|
+
operationId?: string;
|
|
1302
|
+
metadata?: Record<string, unknown>;
|
|
1303
|
+
}): void;
|
|
1304
|
+
/**
|
|
1305
|
+
* Record embedding generation event
|
|
1306
|
+
*/
|
|
1307
|
+
recordEmbeddingGenerated(data: {
|
|
1308
|
+
embeddingModel: string;
|
|
1309
|
+
vectorDimensions: number;
|
|
1310
|
+
textLength: number;
|
|
1311
|
+
durationMs: number;
|
|
1312
|
+
operationId?: string;
|
|
1313
|
+
}): void;
|
|
1314
|
+
/**
|
|
1315
|
+
* Record document ingestion event
|
|
1316
|
+
*/
|
|
1317
|
+
recordDocumentIngested(data: {
|
|
1318
|
+
documentId: string;
|
|
1319
|
+
documentName: string;
|
|
1320
|
+
documentSize: number;
|
|
1321
|
+
chunksGenerated: number;
|
|
1322
|
+
durationMs: number;
|
|
1323
|
+
}): void;
|
|
1324
|
+
/**
|
|
1325
|
+
* Record query execution event
|
|
1326
|
+
*/
|
|
1327
|
+
recordQueryExecuted(data: {
|
|
1328
|
+
queryText: string;
|
|
1329
|
+
resultCount: number;
|
|
1330
|
+
durationMs: number;
|
|
1331
|
+
operationId?: string;
|
|
1332
|
+
}): void;
|
|
1333
|
+
/**
|
|
1334
|
+
* Record error event
|
|
1335
|
+
*/
|
|
1336
|
+
recordError(error: Error, context?: Record<string, unknown>): void;
|
|
1337
|
+
/**
|
|
1338
|
+
* Flush all queued events to telemetry endpoints
|
|
1339
|
+
*/
|
|
1340
|
+
flush(): Promise<void>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Start automatic flush interval
|
|
1343
|
+
*/
|
|
1344
|
+
private startAutoFlush;
|
|
1345
|
+
/**
|
|
1346
|
+
* Stop telemetry service and flush remaining events
|
|
1347
|
+
*/
|
|
1348
|
+
shutdown(): Promise<void>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Disable telemetry temporarily
|
|
1351
|
+
*/
|
|
1352
|
+
disable(): void;
|
|
1353
|
+
/**
|
|
1354
|
+
* Enable telemetry
|
|
1355
|
+
*/
|
|
1356
|
+
enable(): void;
|
|
1357
|
+
/**
|
|
1358
|
+
* Get current queue size (for debugging)
|
|
1359
|
+
*/
|
|
1360
|
+
getQueueSize(): number;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Get or create global telemetry service instance
|
|
1364
|
+
*/
|
|
1365
|
+
declare function getTelemetryService(): TelemetryService | null;
|
|
1366
|
+
/**
|
|
1367
|
+
* Initialize global telemetry service
|
|
1368
|
+
*/
|
|
1369
|
+
declare function initializeTelemetryService(projectId: string, licenseKey: string, userTelemetryUrl?: string): TelemetryService;
|
|
1370
|
+
/**
|
|
1371
|
+
* Shutdown global telemetry service
|
|
1372
|
+
*/
|
|
1373
|
+
declare function shutdownTelemetryService(): Promise<void>;
|
|
1374
|
+
|
|
1375
|
+
export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
|