@digilogiclabs/platform-core 1.1.1 → 1.2.0
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/{ConsoleEmail-CYPpn2sR.d.mts → ConsoleEmail-hUDFsKoA.d.mts} +1128 -40
- package/dist/{ConsoleEmail-CYPpn2sR.d.ts → ConsoleEmail-hUDFsKoA.d.ts} +1128 -40
- package/dist/index.d.mts +650 -918
- package/dist/index.d.ts +650 -918
- package/dist/index.js +10205 -5223
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10188 -5222
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.js +1101 -0
- package/dist/migrate.js.map +1 -0
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1100 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1102 -4
- package/dist/testing.mjs.map +1 -1
- package/package.json +35 -9
|
@@ -902,6 +902,840 @@ declare class NoopTracing implements ITracing {
|
|
|
902
902
|
close(): Promise<void>;
|
|
903
903
|
}
|
|
904
904
|
|
|
905
|
+
/**
|
|
906
|
+
* IAI - Core AI abstraction interface for platform-core
|
|
907
|
+
*
|
|
908
|
+
* Provides a vendor-agnostic interface for AI operations including:
|
|
909
|
+
* - Text generation (chat, completion)
|
|
910
|
+
* - Embeddings generation
|
|
911
|
+
* - Model routing and fallback
|
|
912
|
+
* - Streaming support
|
|
913
|
+
* - Token usage tracking
|
|
914
|
+
*/
|
|
915
|
+
type AIProvider = "openai" | "anthropic" | "google" | "azure" | "bedrock" | "custom";
|
|
916
|
+
type AIModelType = "chat" | "completion" | "embedding" | "image" | "audio" | "video";
|
|
917
|
+
type AIRole = "system" | "user" | "assistant" | "function" | "tool";
|
|
918
|
+
interface AIMessage {
|
|
919
|
+
role: AIRole;
|
|
920
|
+
content: string;
|
|
921
|
+
name?: string;
|
|
922
|
+
toolCallId?: string;
|
|
923
|
+
toolCalls?: AIToolCall[];
|
|
924
|
+
}
|
|
925
|
+
interface AIToolCall {
|
|
926
|
+
id: string;
|
|
927
|
+
type: "function";
|
|
928
|
+
function: {
|
|
929
|
+
name: string;
|
|
930
|
+
arguments: string;
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
interface AITool {
|
|
934
|
+
type: "function";
|
|
935
|
+
function: {
|
|
936
|
+
name: string;
|
|
937
|
+
description: string;
|
|
938
|
+
parameters: Record<string, unknown>;
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
interface AIModelConfig {
|
|
942
|
+
/** Model identifier (e.g., 'gpt-4', 'claude-3-opus') */
|
|
943
|
+
modelId: string;
|
|
944
|
+
/** Provider for this model */
|
|
945
|
+
provider: AIProvider;
|
|
946
|
+
/** Model capabilities */
|
|
947
|
+
capabilities: AIModelType[];
|
|
948
|
+
/** Maximum context window in tokens */
|
|
949
|
+
maxContextTokens: number;
|
|
950
|
+
/** Maximum output tokens */
|
|
951
|
+
maxOutputTokens: number;
|
|
952
|
+
/** Cost per 1K input tokens in USD */
|
|
953
|
+
inputCostPer1K: number;
|
|
954
|
+
/** Cost per 1K output tokens in USD */
|
|
955
|
+
outputCostPer1K: number;
|
|
956
|
+
/** Supports streaming */
|
|
957
|
+
supportsStreaming: boolean;
|
|
958
|
+
/** Supports function/tool calling */
|
|
959
|
+
supportsTools: boolean;
|
|
960
|
+
/** Supports vision (image input) */
|
|
961
|
+
supportsVision: boolean;
|
|
962
|
+
/** Rate limits per minute */
|
|
963
|
+
rateLimits?: {
|
|
964
|
+
requestsPerMinute: number;
|
|
965
|
+
tokensPerMinute: number;
|
|
966
|
+
};
|
|
967
|
+
/** Custom endpoint for self-hosted models */
|
|
968
|
+
endpoint?: string;
|
|
969
|
+
/** Additional provider-specific config */
|
|
970
|
+
providerConfig?: Record<string, unknown>;
|
|
971
|
+
}
|
|
972
|
+
interface AIChatRequest {
|
|
973
|
+
messages: AIMessage[];
|
|
974
|
+
model?: string;
|
|
975
|
+
temperature?: number;
|
|
976
|
+
maxTokens?: number;
|
|
977
|
+
topP?: number;
|
|
978
|
+
frequencyPenalty?: number;
|
|
979
|
+
presencePenalty?: number;
|
|
980
|
+
stop?: string | string[];
|
|
981
|
+
tools?: AITool[];
|
|
982
|
+
toolChoice?: "auto" | "none" | "required" | {
|
|
983
|
+
type: "function";
|
|
984
|
+
function: {
|
|
985
|
+
name: string;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
stream?: boolean;
|
|
989
|
+
user?: string;
|
|
990
|
+
metadata?: Record<string, unknown>;
|
|
991
|
+
}
|
|
992
|
+
interface AICompletionRequest {
|
|
993
|
+
prompt: string;
|
|
994
|
+
model?: string;
|
|
995
|
+
temperature?: number;
|
|
996
|
+
maxTokens?: number;
|
|
997
|
+
topP?: number;
|
|
998
|
+
frequencyPenalty?: number;
|
|
999
|
+
presencePenalty?: number;
|
|
1000
|
+
stop?: string | string[];
|
|
1001
|
+
stream?: boolean;
|
|
1002
|
+
user?: string;
|
|
1003
|
+
metadata?: Record<string, unknown>;
|
|
1004
|
+
}
|
|
1005
|
+
interface AIEmbeddingRequest {
|
|
1006
|
+
input: string | string[];
|
|
1007
|
+
model?: string;
|
|
1008
|
+
dimensions?: number;
|
|
1009
|
+
user?: string;
|
|
1010
|
+
metadata?: Record<string, unknown>;
|
|
1011
|
+
}
|
|
1012
|
+
interface AIChatResponse {
|
|
1013
|
+
id: string;
|
|
1014
|
+
model: string;
|
|
1015
|
+
provider: AIProvider;
|
|
1016
|
+
choices: AIChatChoice[];
|
|
1017
|
+
usage: AIUsageInfo;
|
|
1018
|
+
created: Date;
|
|
1019
|
+
finishReason: AIFinishReason;
|
|
1020
|
+
}
|
|
1021
|
+
interface AIChatChoice {
|
|
1022
|
+
index: number;
|
|
1023
|
+
message: AIMessage;
|
|
1024
|
+
finishReason: AIFinishReason;
|
|
1025
|
+
}
|
|
1026
|
+
type AIFinishReason = "stop" | "length" | "tool_calls" | "content_filter" | "error";
|
|
1027
|
+
interface AICompletionResponse {
|
|
1028
|
+
id: string;
|
|
1029
|
+
model: string;
|
|
1030
|
+
provider: AIProvider;
|
|
1031
|
+
text: string;
|
|
1032
|
+
usage: AIUsageInfo;
|
|
1033
|
+
created: Date;
|
|
1034
|
+
finishReason: AIFinishReason;
|
|
1035
|
+
}
|
|
1036
|
+
interface AIEmbeddingResponse {
|
|
1037
|
+
id: string;
|
|
1038
|
+
model: string;
|
|
1039
|
+
provider: AIProvider;
|
|
1040
|
+
embeddings: number[][];
|
|
1041
|
+
usage: AIUsageInfo;
|
|
1042
|
+
created: Date;
|
|
1043
|
+
}
|
|
1044
|
+
interface AIUsageInfo {
|
|
1045
|
+
promptTokens: number;
|
|
1046
|
+
completionTokens: number;
|
|
1047
|
+
totalTokens: number;
|
|
1048
|
+
estimatedCostUsd: number;
|
|
1049
|
+
}
|
|
1050
|
+
interface AIStreamChunk {
|
|
1051
|
+
id: string;
|
|
1052
|
+
model: string;
|
|
1053
|
+
provider: AIProvider;
|
|
1054
|
+
delta: {
|
|
1055
|
+
content?: string;
|
|
1056
|
+
toolCalls?: AIToolCall[];
|
|
1057
|
+
role?: AIRole;
|
|
1058
|
+
};
|
|
1059
|
+
finishReason?: AIFinishReason;
|
|
1060
|
+
usage?: AIUsageInfo;
|
|
1061
|
+
}
|
|
1062
|
+
type AIStreamCallback = (chunk: AIStreamChunk) => void | Promise<void>;
|
|
1063
|
+
type RoutingStrategy = "priority" | "round-robin" | "least-latency" | "cost-optimized" | "random";
|
|
1064
|
+
interface AIRouterConfig {
|
|
1065
|
+
/** Primary model to use */
|
|
1066
|
+
primaryModel: string;
|
|
1067
|
+
/** Fallback models in order of preference */
|
|
1068
|
+
fallbackModels?: string[];
|
|
1069
|
+
/** Routing strategy for load balancing */
|
|
1070
|
+
strategy?: RoutingStrategy;
|
|
1071
|
+
/** Maximum retries before failing */
|
|
1072
|
+
maxRetries?: number;
|
|
1073
|
+
/** Timeout in milliseconds */
|
|
1074
|
+
timeoutMs?: number;
|
|
1075
|
+
/** Enable automatic fallback on errors */
|
|
1076
|
+
autoFallback?: boolean;
|
|
1077
|
+
/** Cost budget per request in USD (for cost-optimized routing) */
|
|
1078
|
+
costBudget?: number;
|
|
1079
|
+
/** Custom routing function */
|
|
1080
|
+
customRouter?: (request: AIChatRequest | AICompletionRequest) => string;
|
|
1081
|
+
}
|
|
1082
|
+
type AIErrorCode = "invalid_request" | "authentication_error" | "rate_limit_exceeded" | "quota_exceeded" | "model_not_found" | "context_length_exceeded" | "content_filter" | "server_error" | "timeout" | "network_error" | "provider_unavailable" | "unknown";
|
|
1083
|
+
interface AIError extends Error {
|
|
1084
|
+
code: AIErrorCode;
|
|
1085
|
+
provider?: AIProvider;
|
|
1086
|
+
model?: string;
|
|
1087
|
+
statusCode?: number;
|
|
1088
|
+
retryable: boolean;
|
|
1089
|
+
retryAfterMs?: number;
|
|
1090
|
+
}
|
|
1091
|
+
declare const AIErrorMessages: Record<AIErrorCode, string>;
|
|
1092
|
+
declare function createAIError(code: AIErrorCode, message?: string, options?: {
|
|
1093
|
+
provider?: AIProvider;
|
|
1094
|
+
model?: string;
|
|
1095
|
+
statusCode?: number;
|
|
1096
|
+
retryable?: boolean;
|
|
1097
|
+
retryAfterMs?: number;
|
|
1098
|
+
cause?: Error;
|
|
1099
|
+
}): AIError;
|
|
1100
|
+
declare function isAIError(error: unknown): error is AIError;
|
|
1101
|
+
interface AIConfig {
|
|
1102
|
+
/** Default model for chat requests */
|
|
1103
|
+
defaultChatModel?: string;
|
|
1104
|
+
/** Default model for completion requests */
|
|
1105
|
+
defaultCompletionModel?: string;
|
|
1106
|
+
/** Default model for embedding requests */
|
|
1107
|
+
defaultEmbeddingModel?: string;
|
|
1108
|
+
/** Router configuration */
|
|
1109
|
+
router?: AIRouterConfig;
|
|
1110
|
+
/** Available model configurations */
|
|
1111
|
+
models?: AIModelConfig[];
|
|
1112
|
+
/** API keys for providers */
|
|
1113
|
+
apiKeys?: Partial<Record<AIProvider, string>>;
|
|
1114
|
+
/** Default timeout in milliseconds */
|
|
1115
|
+
defaultTimeoutMs?: number;
|
|
1116
|
+
/** Enable request/response logging */
|
|
1117
|
+
enableLogging?: boolean;
|
|
1118
|
+
/** Cache embeddings */
|
|
1119
|
+
cacheEmbeddings?: boolean;
|
|
1120
|
+
/** Embedding cache TTL in seconds */
|
|
1121
|
+
embeddingCacheTtlSeconds?: number;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* IAI - Core AI interface
|
|
1125
|
+
*
|
|
1126
|
+
* @example
|
|
1127
|
+
* ```typescript
|
|
1128
|
+
* const ai = platform.ai;
|
|
1129
|
+
*
|
|
1130
|
+
* // Chat completion
|
|
1131
|
+
* const response = await ai.chat({
|
|
1132
|
+
* messages: [
|
|
1133
|
+
* { role: 'system', content: 'You are a helpful assistant.' },
|
|
1134
|
+
* { role: 'user', content: 'Hello!' }
|
|
1135
|
+
* ]
|
|
1136
|
+
* });
|
|
1137
|
+
*
|
|
1138
|
+
* // Streaming chat
|
|
1139
|
+
* for await (const chunk of ai.chatStream({
|
|
1140
|
+
* messages: [{ role: 'user', content: 'Tell me a story' }]
|
|
1141
|
+
* })) {
|
|
1142
|
+
* process.stdout.write(chunk.delta.content || '');
|
|
1143
|
+
* }
|
|
1144
|
+
*
|
|
1145
|
+
* // Embeddings
|
|
1146
|
+
* const embeddings = await ai.embed({
|
|
1147
|
+
* input: ['Hello world', 'Goodbye world']
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
interface IAI {
|
|
1152
|
+
/**
|
|
1153
|
+
* Send a chat completion request
|
|
1154
|
+
*/
|
|
1155
|
+
chat(request: AIChatRequest): Promise<AIChatResponse>;
|
|
1156
|
+
/**
|
|
1157
|
+
* Send a streaming chat completion request
|
|
1158
|
+
*/
|
|
1159
|
+
chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Send a chat completion request with callback-based streaming
|
|
1162
|
+
*/
|
|
1163
|
+
chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Send a text completion request
|
|
1166
|
+
*/
|
|
1167
|
+
complete(request: AICompletionRequest): Promise<AICompletionResponse>;
|
|
1168
|
+
/**
|
|
1169
|
+
* Send a streaming completion request
|
|
1170
|
+
*/
|
|
1171
|
+
completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Generate embeddings for text
|
|
1174
|
+
*/
|
|
1175
|
+
embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Calculate similarity between two texts
|
|
1178
|
+
*/
|
|
1179
|
+
similarity(text1: string, text2: string, model?: string): Promise<number>;
|
|
1180
|
+
/**
|
|
1181
|
+
* List available models
|
|
1182
|
+
*/
|
|
1183
|
+
listModels(): Promise<AIModelConfig[]>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Get model configuration
|
|
1186
|
+
*/
|
|
1187
|
+
getModel(modelId: string): Promise<AIModelConfig | null>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Check if a model supports a capability
|
|
1190
|
+
*/
|
|
1191
|
+
supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Estimate tokens for text
|
|
1194
|
+
*/
|
|
1195
|
+
estimateTokens(text: string, model?: string): Promise<number>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Estimate cost for a request
|
|
1198
|
+
*/
|
|
1199
|
+
estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Check if AI service is healthy
|
|
1202
|
+
*/
|
|
1203
|
+
healthCheck(): Promise<{
|
|
1204
|
+
healthy: boolean;
|
|
1205
|
+
providers: Record<AIProvider, {
|
|
1206
|
+
available: boolean;
|
|
1207
|
+
latencyMs?: number;
|
|
1208
|
+
error?: string;
|
|
1209
|
+
}>;
|
|
1210
|
+
}>;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* MemoryAI - In-memory implementation for testing
|
|
1214
|
+
*/
|
|
1215
|
+
declare class MemoryAI implements IAI {
|
|
1216
|
+
private config;
|
|
1217
|
+
private models;
|
|
1218
|
+
private responses;
|
|
1219
|
+
private embeddings;
|
|
1220
|
+
private requestLog;
|
|
1221
|
+
constructor(config?: AIConfig);
|
|
1222
|
+
setResponse(key: string, response: AIChatResponse | AICompletionResponse): void;
|
|
1223
|
+
setEmbedding(text: string, embedding: number[]): void;
|
|
1224
|
+
getRequestLog(): Array<{
|
|
1225
|
+
type: string;
|
|
1226
|
+
request: unknown;
|
|
1227
|
+
timestamp: Date;
|
|
1228
|
+
}>;
|
|
1229
|
+
clearRequestLog(): void;
|
|
1230
|
+
chat(request: AIChatRequest): Promise<AIChatResponse>;
|
|
1231
|
+
chatStream(request: AIChatRequest): AsyncIterable<AIStreamChunk>;
|
|
1232
|
+
chatWithCallback(request: AIChatRequest, callback: AIStreamCallback): Promise<AIChatResponse>;
|
|
1233
|
+
complete(request: AICompletionRequest): Promise<AICompletionResponse>;
|
|
1234
|
+
completeStream(request: AICompletionRequest): AsyncIterable<AIStreamChunk>;
|
|
1235
|
+
embed(request: AIEmbeddingRequest): Promise<AIEmbeddingResponse>;
|
|
1236
|
+
similarity(text1: string, text2: string, model?: string): Promise<number>;
|
|
1237
|
+
listModels(): Promise<AIModelConfig[]>;
|
|
1238
|
+
getModel(modelId: string): Promise<AIModelConfig | null>;
|
|
1239
|
+
supportsCapability(modelId: string, capability: AIModelType): Promise<boolean>;
|
|
1240
|
+
estimateTokens(text: string, _model?: string): Promise<number>;
|
|
1241
|
+
estimateCost(request: AIChatRequest | AICompletionRequest | AIEmbeddingRequest): Promise<number>;
|
|
1242
|
+
healthCheck(): Promise<{
|
|
1243
|
+
healthy: boolean;
|
|
1244
|
+
providers: Record<AIProvider, {
|
|
1245
|
+
available: boolean;
|
|
1246
|
+
latencyMs?: number;
|
|
1247
|
+
error?: string;
|
|
1248
|
+
}>;
|
|
1249
|
+
}>;
|
|
1250
|
+
private estimateTokensSync;
|
|
1251
|
+
private calculateCost;
|
|
1252
|
+
private generateMockEmbedding;
|
|
1253
|
+
private cosineSimilarity;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* IRAG - Retrieval Augmented Generation interface
|
|
1258
|
+
*
|
|
1259
|
+
* Provides infrastructure for building RAG pipelines:
|
|
1260
|
+
* - Document ingestion and chunking
|
|
1261
|
+
* - Vector storage and retrieval
|
|
1262
|
+
* - Semantic search
|
|
1263
|
+
* - Hybrid search (vector + keyword)
|
|
1264
|
+
* - Reranking
|
|
1265
|
+
* - Context assembly
|
|
1266
|
+
*/
|
|
1267
|
+
type DocumentStatus = "pending" | "processing" | "indexed" | "failed";
|
|
1268
|
+
interface RAGDocument {
|
|
1269
|
+
id: string;
|
|
1270
|
+
/** Source identifier (e.g., file path, URL, database ID) */
|
|
1271
|
+
source: string;
|
|
1272
|
+
/** Document type (pdf, markdown, html, text, etc.) */
|
|
1273
|
+
type: string;
|
|
1274
|
+
/** Original content */
|
|
1275
|
+
content: string;
|
|
1276
|
+
/** Document title */
|
|
1277
|
+
title?: string;
|
|
1278
|
+
/** Document metadata */
|
|
1279
|
+
metadata: Record<string, unknown>;
|
|
1280
|
+
/** Tenant ID for multi-tenant isolation */
|
|
1281
|
+
tenantId?: string;
|
|
1282
|
+
/** Collection/namespace */
|
|
1283
|
+
collection: string;
|
|
1284
|
+
/** Document status */
|
|
1285
|
+
status: DocumentStatus;
|
|
1286
|
+
/** Error message if failed */
|
|
1287
|
+
error?: string;
|
|
1288
|
+
/** Chunk count */
|
|
1289
|
+
chunkCount?: number;
|
|
1290
|
+
/** Token count */
|
|
1291
|
+
tokenCount?: number;
|
|
1292
|
+
/** Created timestamp */
|
|
1293
|
+
createdAt: Date;
|
|
1294
|
+
/** Updated timestamp */
|
|
1295
|
+
updatedAt: Date;
|
|
1296
|
+
}
|
|
1297
|
+
interface RAGChunk {
|
|
1298
|
+
id: string;
|
|
1299
|
+
documentId: string;
|
|
1300
|
+
/** Chunk index within document */
|
|
1301
|
+
index: number;
|
|
1302
|
+
/** Chunk content */
|
|
1303
|
+
content: string;
|
|
1304
|
+
/** Embedding vector */
|
|
1305
|
+
embedding?: number[];
|
|
1306
|
+
/** Chunk metadata */
|
|
1307
|
+
metadata: Record<string, unknown>;
|
|
1308
|
+
/** Start character position in original document */
|
|
1309
|
+
startOffset?: number;
|
|
1310
|
+
/** End character position */
|
|
1311
|
+
endOffset?: number;
|
|
1312
|
+
/** Token count */
|
|
1313
|
+
tokenCount: number;
|
|
1314
|
+
/** Collection/namespace */
|
|
1315
|
+
collection: string;
|
|
1316
|
+
/** Tenant ID */
|
|
1317
|
+
tenantId?: string;
|
|
1318
|
+
}
|
|
1319
|
+
type ChunkingStrategy = "fixed" | "sentence" | "paragraph" | "semantic" | "recursive";
|
|
1320
|
+
interface ChunkingConfig {
|
|
1321
|
+
/** Chunking strategy */
|
|
1322
|
+
strategy: ChunkingStrategy;
|
|
1323
|
+
/** Target chunk size in tokens */
|
|
1324
|
+
chunkSize: number;
|
|
1325
|
+
/** Overlap between chunks in tokens */
|
|
1326
|
+
chunkOverlap: number;
|
|
1327
|
+
/** Minimum chunk size */
|
|
1328
|
+
minChunkSize?: number;
|
|
1329
|
+
/** Maximum chunk size */
|
|
1330
|
+
maxChunkSize?: number;
|
|
1331
|
+
/** Separators for recursive chunking */
|
|
1332
|
+
separators?: string[];
|
|
1333
|
+
/** Keep metadata in chunks */
|
|
1334
|
+
includeMetadata?: boolean;
|
|
1335
|
+
/** Add document title to each chunk */
|
|
1336
|
+
includeTitle?: boolean;
|
|
1337
|
+
}
|
|
1338
|
+
declare const ChunkingPresets: Record<string, ChunkingConfig>;
|
|
1339
|
+
type SearchMode = "vector" | "keyword" | "hybrid";
|
|
1340
|
+
interface RAGSearchQuery {
|
|
1341
|
+
/** Search query text */
|
|
1342
|
+
query: string;
|
|
1343
|
+
/** Collection to search */
|
|
1344
|
+
collection: string;
|
|
1345
|
+
/** Tenant ID for filtering */
|
|
1346
|
+
tenantId?: string;
|
|
1347
|
+
/** Search mode */
|
|
1348
|
+
mode?: SearchMode;
|
|
1349
|
+
/** Maximum results to return */
|
|
1350
|
+
limit?: number;
|
|
1351
|
+
/** Minimum similarity score (0-1) */
|
|
1352
|
+
minScore?: number;
|
|
1353
|
+
/** Metadata filters */
|
|
1354
|
+
filters?: RAGFilter[];
|
|
1355
|
+
/** Include embeddings in results */
|
|
1356
|
+
includeEmbeddings?: boolean;
|
|
1357
|
+
/** Include original document content */
|
|
1358
|
+
includeDocumentContent?: boolean;
|
|
1359
|
+
/** Rerank results using cross-encoder */
|
|
1360
|
+
rerank?: boolean;
|
|
1361
|
+
/** Number of candidates for reranking */
|
|
1362
|
+
rerankCandidates?: number;
|
|
1363
|
+
}
|
|
1364
|
+
interface RAGFilter {
|
|
1365
|
+
field: string;
|
|
1366
|
+
operator: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "contains";
|
|
1367
|
+
value: unknown;
|
|
1368
|
+
}
|
|
1369
|
+
interface RAGSearchResult {
|
|
1370
|
+
chunk: RAGChunk;
|
|
1371
|
+
score: number;
|
|
1372
|
+
document?: RAGDocument;
|
|
1373
|
+
highlights?: string[];
|
|
1374
|
+
}
|
|
1375
|
+
interface RAGSearchResponse {
|
|
1376
|
+
results: RAGSearchResult[];
|
|
1377
|
+
query: string;
|
|
1378
|
+
totalMatches: number;
|
|
1379
|
+
searchTimeMs: number;
|
|
1380
|
+
mode: SearchMode;
|
|
1381
|
+
}
|
|
1382
|
+
interface ContextAssemblyConfig {
|
|
1383
|
+
/** Maximum tokens for assembled context */
|
|
1384
|
+
maxTokens: number;
|
|
1385
|
+
/** Template for formatting each chunk */
|
|
1386
|
+
chunkTemplate?: string;
|
|
1387
|
+
/** Template for the full context */
|
|
1388
|
+
contextTemplate?: string;
|
|
1389
|
+
/** Include source citations */
|
|
1390
|
+
includeCitations?: boolean;
|
|
1391
|
+
/** Deduplicate similar chunks */
|
|
1392
|
+
deduplicate?: boolean;
|
|
1393
|
+
/** Deduplication similarity threshold */
|
|
1394
|
+
dedupeThreshold?: number;
|
|
1395
|
+
/** Sort order for chunks */
|
|
1396
|
+
sortBy?: "score" | "document" | "position";
|
|
1397
|
+
}
|
|
1398
|
+
interface AssembledContext {
|
|
1399
|
+
/** Final assembled context string */
|
|
1400
|
+
context: string;
|
|
1401
|
+
/** Chunks included in context */
|
|
1402
|
+
chunks: RAGChunk[];
|
|
1403
|
+
/** Total tokens used */
|
|
1404
|
+
tokenCount: number;
|
|
1405
|
+
/** Source documents referenced */
|
|
1406
|
+
sources: Array<{
|
|
1407
|
+
documentId: string;
|
|
1408
|
+
title?: string;
|
|
1409
|
+
source: string;
|
|
1410
|
+
}>;
|
|
1411
|
+
/** Chunks excluded due to limits */
|
|
1412
|
+
truncated: boolean;
|
|
1413
|
+
}
|
|
1414
|
+
interface IngestionOptions {
|
|
1415
|
+
/** Collection to add documents to */
|
|
1416
|
+
collection: string;
|
|
1417
|
+
/** Tenant ID */
|
|
1418
|
+
tenantId?: string;
|
|
1419
|
+
/** Chunking configuration */
|
|
1420
|
+
chunking?: Partial<ChunkingConfig>;
|
|
1421
|
+
/** Document metadata to attach */
|
|
1422
|
+
metadata?: Record<string, unknown>;
|
|
1423
|
+
/** Generate embeddings immediately */
|
|
1424
|
+
generateEmbeddings?: boolean;
|
|
1425
|
+
/** Batch size for processing */
|
|
1426
|
+
batchSize?: number;
|
|
1427
|
+
/** Skip existing documents */
|
|
1428
|
+
skipExisting?: boolean;
|
|
1429
|
+
}
|
|
1430
|
+
interface IngestionResult {
|
|
1431
|
+
documentId: string;
|
|
1432
|
+
status: DocumentStatus;
|
|
1433
|
+
chunkCount: number;
|
|
1434
|
+
tokenCount: number;
|
|
1435
|
+
error?: string;
|
|
1436
|
+
processingTimeMs: number;
|
|
1437
|
+
}
|
|
1438
|
+
interface BulkIngestionResult {
|
|
1439
|
+
total: number;
|
|
1440
|
+
successful: number;
|
|
1441
|
+
failed: number;
|
|
1442
|
+
results: IngestionResult[];
|
|
1443
|
+
totalProcessingTimeMs: number;
|
|
1444
|
+
}
|
|
1445
|
+
interface RAGCollection {
|
|
1446
|
+
name: string;
|
|
1447
|
+
description?: string;
|
|
1448
|
+
/** Embedding model used */
|
|
1449
|
+
embeddingModel: string;
|
|
1450
|
+
/** Embedding dimensions */
|
|
1451
|
+
dimensions: number;
|
|
1452
|
+
/** Distance metric for similarity */
|
|
1453
|
+
distanceMetric: "cosine" | "euclidean" | "dotproduct";
|
|
1454
|
+
/** Chunking config for this collection */
|
|
1455
|
+
chunkingConfig: ChunkingConfig;
|
|
1456
|
+
/** Document count */
|
|
1457
|
+
documentCount: number;
|
|
1458
|
+
/** Chunk count */
|
|
1459
|
+
chunkCount: number;
|
|
1460
|
+
/** Total token count */
|
|
1461
|
+
totalTokens: number;
|
|
1462
|
+
/** Created timestamp */
|
|
1463
|
+
createdAt: Date;
|
|
1464
|
+
/** Updated timestamp */
|
|
1465
|
+
updatedAt: Date;
|
|
1466
|
+
}
|
|
1467
|
+
interface CreateCollectionOptions {
|
|
1468
|
+
name: string;
|
|
1469
|
+
description?: string;
|
|
1470
|
+
embeddingModel?: string;
|
|
1471
|
+
dimensions?: number;
|
|
1472
|
+
distanceMetric?: "cosine" | "euclidean" | "dotproduct";
|
|
1473
|
+
chunkingConfig?: Partial<ChunkingConfig>;
|
|
1474
|
+
}
|
|
1475
|
+
interface RAGPipelineStep {
|
|
1476
|
+
name: string;
|
|
1477
|
+
type: "transform" | "filter" | "enrich" | "embed" | "store";
|
|
1478
|
+
config: Record<string, unknown>;
|
|
1479
|
+
enabled: boolean;
|
|
1480
|
+
}
|
|
1481
|
+
interface RAGPipeline {
|
|
1482
|
+
id: string;
|
|
1483
|
+
name: string;
|
|
1484
|
+
description?: string;
|
|
1485
|
+
collection: string;
|
|
1486
|
+
steps: RAGPipelineStep[];
|
|
1487
|
+
createdAt: Date;
|
|
1488
|
+
updatedAt: Date;
|
|
1489
|
+
}
|
|
1490
|
+
interface RAGConfig {
|
|
1491
|
+
/** Default embedding model */
|
|
1492
|
+
defaultEmbeddingModel?: string;
|
|
1493
|
+
/** Default chunking config */
|
|
1494
|
+
defaultChunkingConfig?: Partial<ChunkingConfig>;
|
|
1495
|
+
/** Default search mode */
|
|
1496
|
+
defaultSearchMode?: SearchMode;
|
|
1497
|
+
/** Default result limit */
|
|
1498
|
+
defaultLimit?: number;
|
|
1499
|
+
/** Enable caching */
|
|
1500
|
+
enableCache?: boolean;
|
|
1501
|
+
/** Cache TTL in seconds */
|
|
1502
|
+
cacheTtlSeconds?: number;
|
|
1503
|
+
/** Maximum documents per collection */
|
|
1504
|
+
maxDocumentsPerCollection?: number;
|
|
1505
|
+
/** Maximum chunks per document */
|
|
1506
|
+
maxChunksPerDocument?: number;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* IRAG - RAG pipeline interface
|
|
1510
|
+
*
|
|
1511
|
+
* @example
|
|
1512
|
+
* ```typescript
|
|
1513
|
+
* const rag = platform.rag;
|
|
1514
|
+
*
|
|
1515
|
+
* // Create a collection
|
|
1516
|
+
* await rag.createCollection({
|
|
1517
|
+
* name: 'knowledge-base',
|
|
1518
|
+
* embeddingModel: 'text-embedding-3-small',
|
|
1519
|
+
* });
|
|
1520
|
+
*
|
|
1521
|
+
* // Ingest documents
|
|
1522
|
+
* await rag.ingest('knowledge-base', [
|
|
1523
|
+
* { source: 'doc1.pdf', content: '...', type: 'pdf' },
|
|
1524
|
+
* { source: 'doc2.md', content: '...', type: 'markdown' },
|
|
1525
|
+
* ]);
|
|
1526
|
+
*
|
|
1527
|
+
* // Search
|
|
1528
|
+
* const results = await rag.search({
|
|
1529
|
+
* query: 'How do I configure authentication?',
|
|
1530
|
+
* collection: 'knowledge-base',
|
|
1531
|
+
* limit: 5,
|
|
1532
|
+
* });
|
|
1533
|
+
*
|
|
1534
|
+
* // Assemble context for LLM
|
|
1535
|
+
* const context = await rag.assembleContext(results, {
|
|
1536
|
+
* maxTokens: 4000,
|
|
1537
|
+
* includeCitations: true,
|
|
1538
|
+
* });
|
|
1539
|
+
*
|
|
1540
|
+
* // Use with AI
|
|
1541
|
+
* const response = await ai.chat({
|
|
1542
|
+
* messages: [
|
|
1543
|
+
* { role: 'system', content: `Use this context: ${context.context}` },
|
|
1544
|
+
* { role: 'user', content: 'How do I configure authentication?' }
|
|
1545
|
+
* ]
|
|
1546
|
+
* });
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
interface IRAG {
|
|
1550
|
+
/**
|
|
1551
|
+
* Create a new collection
|
|
1552
|
+
*/
|
|
1553
|
+
createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Get a collection by name
|
|
1556
|
+
*/
|
|
1557
|
+
getCollection(name: string): Promise<RAGCollection | null>;
|
|
1558
|
+
/**
|
|
1559
|
+
* List all collections
|
|
1560
|
+
*/
|
|
1561
|
+
listCollections(tenantId?: string): Promise<RAGCollection[]>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Delete a collection and all its documents
|
|
1564
|
+
*/
|
|
1565
|
+
deleteCollection(name: string): Promise<void>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Get collection statistics
|
|
1568
|
+
*/
|
|
1569
|
+
getCollectionStats(name: string): Promise<{
|
|
1570
|
+
documentCount: number;
|
|
1571
|
+
chunkCount: number;
|
|
1572
|
+
totalTokens: number;
|
|
1573
|
+
averageChunkSize: number;
|
|
1574
|
+
storageBytes: number;
|
|
1575
|
+
}>;
|
|
1576
|
+
/**
|
|
1577
|
+
* Ingest documents into a collection
|
|
1578
|
+
*/
|
|
1579
|
+
ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Ingest a single document
|
|
1582
|
+
*/
|
|
1583
|
+
ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Get a document by ID
|
|
1586
|
+
*/
|
|
1587
|
+
getDocument(documentId: string): Promise<RAGDocument | null>;
|
|
1588
|
+
/**
|
|
1589
|
+
* List documents in a collection
|
|
1590
|
+
*/
|
|
1591
|
+
listDocuments(collection: string, options?: {
|
|
1592
|
+
tenantId?: string;
|
|
1593
|
+
status?: DocumentStatus;
|
|
1594
|
+
limit?: number;
|
|
1595
|
+
offset?: number;
|
|
1596
|
+
}): Promise<{
|
|
1597
|
+
documents: RAGDocument[];
|
|
1598
|
+
total: number;
|
|
1599
|
+
}>;
|
|
1600
|
+
/**
|
|
1601
|
+
* Delete a document and its chunks
|
|
1602
|
+
*/
|
|
1603
|
+
deleteDocument(documentId: string): Promise<void>;
|
|
1604
|
+
/**
|
|
1605
|
+
* Reprocess a document (re-chunk and re-embed)
|
|
1606
|
+
*/
|
|
1607
|
+
reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
|
|
1608
|
+
/**
|
|
1609
|
+
* Get chunks for a document
|
|
1610
|
+
*/
|
|
1611
|
+
getChunks(documentId: string): Promise<RAGChunk[]>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Get a specific chunk by ID
|
|
1614
|
+
*/
|
|
1615
|
+
getChunk(chunkId: string): Promise<RAGChunk | null>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Update chunk metadata
|
|
1618
|
+
*/
|
|
1619
|
+
updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Search for relevant chunks
|
|
1622
|
+
*/
|
|
1623
|
+
search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Get similar chunks to a given chunk
|
|
1626
|
+
*/
|
|
1627
|
+
findSimilar(chunkId: string, options?: {
|
|
1628
|
+
limit?: number;
|
|
1629
|
+
minScore?: number;
|
|
1630
|
+
collection?: string;
|
|
1631
|
+
}): Promise<RAGSearchResult[]>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Multi-query search (query expansion)
|
|
1634
|
+
*/
|
|
1635
|
+
multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Assemble context from search results
|
|
1638
|
+
*/
|
|
1639
|
+
assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
|
|
1640
|
+
/**
|
|
1641
|
+
* Query and assemble in one step
|
|
1642
|
+
*/
|
|
1643
|
+
queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
|
|
1644
|
+
searchResponse: RAGSearchResponse;
|
|
1645
|
+
context: AssembledContext;
|
|
1646
|
+
}>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Generate embeddings for text
|
|
1649
|
+
*/
|
|
1650
|
+
embed(texts: string | string[], model?: string): Promise<number[][]>;
|
|
1651
|
+
/**
|
|
1652
|
+
* Update embeddings for a collection
|
|
1653
|
+
*/
|
|
1654
|
+
reembed(collection: string, model?: string, batchSize?: number): Promise<{
|
|
1655
|
+
updated: number;
|
|
1656
|
+
errors: number;
|
|
1657
|
+
}>;
|
|
1658
|
+
/**
|
|
1659
|
+
* Create a processing pipeline
|
|
1660
|
+
*/
|
|
1661
|
+
createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
|
|
1662
|
+
/**
|
|
1663
|
+
* Get a pipeline
|
|
1664
|
+
*/
|
|
1665
|
+
getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Run a pipeline on documents
|
|
1668
|
+
*/
|
|
1669
|
+
runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* MemoryRAG - In-memory implementation for testing
|
|
1673
|
+
*/
|
|
1674
|
+
declare class MemoryRAG implements IRAG {
|
|
1675
|
+
private config;
|
|
1676
|
+
private collections;
|
|
1677
|
+
private documents;
|
|
1678
|
+
private chunks;
|
|
1679
|
+
private pipelines;
|
|
1680
|
+
private embeddings;
|
|
1681
|
+
constructor(config?: RAGConfig);
|
|
1682
|
+
createCollection(options: CreateCollectionOptions): Promise<RAGCollection>;
|
|
1683
|
+
getCollection(name: string): Promise<RAGCollection | null>;
|
|
1684
|
+
listCollections(tenantId?: string): Promise<RAGCollection[]>;
|
|
1685
|
+
deleteCollection(name: string): Promise<void>;
|
|
1686
|
+
getCollectionStats(name: string): Promise<{
|
|
1687
|
+
documentCount: number;
|
|
1688
|
+
chunkCount: number;
|
|
1689
|
+
totalTokens: number;
|
|
1690
|
+
averageChunkSize: number;
|
|
1691
|
+
storageBytes: number;
|
|
1692
|
+
}>;
|
|
1693
|
+
ingest(collection: string, documents: Array<Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt">>, options?: Partial<IngestionOptions>): Promise<BulkIngestionResult>;
|
|
1694
|
+
ingestOne(collection: string, document: Omit<RAGDocument, "id" | "status" | "chunkCount" | "tokenCount" | "createdAt" | "updatedAt" | "collection">, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
|
|
1695
|
+
getDocument(documentId: string): Promise<RAGDocument | null>;
|
|
1696
|
+
listDocuments(collection: string, options?: {
|
|
1697
|
+
tenantId?: string;
|
|
1698
|
+
status?: DocumentStatus;
|
|
1699
|
+
limit?: number;
|
|
1700
|
+
offset?: number;
|
|
1701
|
+
}): Promise<{
|
|
1702
|
+
documents: RAGDocument[];
|
|
1703
|
+
total: number;
|
|
1704
|
+
}>;
|
|
1705
|
+
deleteDocument(documentId: string): Promise<void>;
|
|
1706
|
+
reprocessDocument(documentId: string, options?: Partial<IngestionOptions>): Promise<IngestionResult>;
|
|
1707
|
+
getChunks(documentId: string): Promise<RAGChunk[]>;
|
|
1708
|
+
getChunk(chunkId: string): Promise<RAGChunk | null>;
|
|
1709
|
+
updateChunkMetadata(chunkId: string, metadata: Record<string, unknown>): Promise<RAGChunk>;
|
|
1710
|
+
search(query: RAGSearchQuery): Promise<RAGSearchResponse>;
|
|
1711
|
+
findSimilar(chunkId: string, options?: {
|
|
1712
|
+
limit?: number;
|
|
1713
|
+
minScore?: number;
|
|
1714
|
+
collection?: string;
|
|
1715
|
+
}): Promise<RAGSearchResult[]>;
|
|
1716
|
+
multiSearch(queries: RAGSearchQuery[]): Promise<RAGSearchResponse[]>;
|
|
1717
|
+
assembleContext(results: RAGSearchResponse | RAGSearchResult[], config?: Partial<ContextAssemblyConfig>): Promise<AssembledContext>;
|
|
1718
|
+
queryWithContext(query: RAGSearchQuery, contextConfig?: Partial<ContextAssemblyConfig>): Promise<{
|
|
1719
|
+
searchResponse: RAGSearchResponse;
|
|
1720
|
+
context: AssembledContext;
|
|
1721
|
+
}>;
|
|
1722
|
+
embed(texts: string | string[], model?: string): Promise<number[][]>;
|
|
1723
|
+
reembed(collection: string, model?: string, batchSize?: number): Promise<{
|
|
1724
|
+
updated: number;
|
|
1725
|
+
errors: number;
|
|
1726
|
+
}>;
|
|
1727
|
+
createPipeline(pipeline: Omit<RAGPipeline, "id" | "createdAt" | "updatedAt">): Promise<RAGPipeline>;
|
|
1728
|
+
getPipeline(pipelineId: string): Promise<RAGPipeline | null>;
|
|
1729
|
+
runPipeline(pipelineId: string, documentIds: string[]): Promise<BulkIngestionResult>;
|
|
1730
|
+
private chunkDocument;
|
|
1731
|
+
private generateMockEmbedding;
|
|
1732
|
+
private cosineSimilarity;
|
|
1733
|
+
private keywordScore;
|
|
1734
|
+
private matchesFilters;
|
|
1735
|
+
private generateHighlights;
|
|
1736
|
+
private deduplicateResults;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
905
1739
|
/**
|
|
906
1740
|
* Main Platform interface
|
|
907
1741
|
* Combines all infrastructure services into a single entry point
|
|
@@ -936,6 +1770,10 @@ interface IPlatform {
|
|
|
936
1770
|
readonly metrics?: IMetrics;
|
|
937
1771
|
/** Tracing service (optional) */
|
|
938
1772
|
readonly tracing?: ITracing;
|
|
1773
|
+
/** AI service (optional, enabled via AI_ENABLED=true) */
|
|
1774
|
+
readonly ai?: IAI;
|
|
1775
|
+
/** RAG service (optional, enabled via RAG_ENABLED=true) */
|
|
1776
|
+
readonly rag?: IRAG;
|
|
939
1777
|
/**
|
|
940
1778
|
* Check health of all services
|
|
941
1779
|
*/
|
|
@@ -1138,6 +1976,8 @@ declare const EmailProviderSchema: z.ZodEnum<["memory", "console", "smtp", "rese
|
|
|
1138
1976
|
declare const QueueProviderSchema: z.ZodEnum<["memory", "bullmq"]>;
|
|
1139
1977
|
declare const TracingProviderSchema: z.ZodEnum<["noop", "memory", "otlp"]>;
|
|
1140
1978
|
declare const LogLevelSchema: z.ZodEnum<["debug", "info", "warn", "error"]>;
|
|
1979
|
+
declare const AIProviderSchema: z.ZodEnum<["memory", "openai", "anthropic", "google"]>;
|
|
1980
|
+
declare const RAGProviderSchema: z.ZodEnum<["memory", "pinecone", "weaviate"]>;
|
|
1141
1981
|
declare const DatabaseConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
1142
1982
|
provider: z.ZodDefault<z.ZodEnum<["memory", "postgres", "supabase"]>>;
|
|
1143
1983
|
url: z.ZodOptional<z.ZodString>;
|
|
@@ -1167,8 +2007,8 @@ declare const DatabaseConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1167
2007
|
rejectUnauthorized?: boolean | undefined;
|
|
1168
2008
|
} | undefined;
|
|
1169
2009
|
}, {
|
|
1170
|
-
url?: string | undefined;
|
|
1171
2010
|
provider?: "memory" | "postgres" | "supabase" | undefined;
|
|
2011
|
+
url?: string | undefined;
|
|
1172
2012
|
connectionString?: string | undefined;
|
|
1173
2013
|
supabaseUrl?: string | undefined;
|
|
1174
2014
|
supabaseAnonKey?: string | undefined;
|
|
@@ -1191,8 +2031,8 @@ declare const DatabaseConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1191
2031
|
rejectUnauthorized?: boolean | undefined;
|
|
1192
2032
|
} | undefined;
|
|
1193
2033
|
}, {
|
|
1194
|
-
url?: string | undefined;
|
|
1195
2034
|
provider?: "memory" | "postgres" | "supabase" | undefined;
|
|
2035
|
+
url?: string | undefined;
|
|
1196
2036
|
connectionString?: string | undefined;
|
|
1197
2037
|
supabaseUrl?: string | undefined;
|
|
1198
2038
|
supabaseAnonKey?: string | undefined;
|
|
@@ -1220,8 +2060,8 @@ declare const CacheConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1220
2060
|
upstashUrl?: string | undefined;
|
|
1221
2061
|
upstashToken?: string | undefined;
|
|
1222
2062
|
}, {
|
|
1223
|
-
url?: string | undefined;
|
|
1224
2063
|
provider?: "memory" | "redis" | "upstash" | undefined;
|
|
2064
|
+
url?: string | undefined;
|
|
1225
2065
|
maxRetries?: number | undefined;
|
|
1226
2066
|
upstashUrl?: string | undefined;
|
|
1227
2067
|
upstashToken?: string | undefined;
|
|
@@ -1236,8 +2076,8 @@ declare const CacheConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1236
2076
|
upstashUrl?: string | undefined;
|
|
1237
2077
|
upstashToken?: string | undefined;
|
|
1238
2078
|
}, {
|
|
1239
|
-
url?: string | undefined;
|
|
1240
2079
|
provider?: "memory" | "redis" | "upstash" | undefined;
|
|
2080
|
+
url?: string | undefined;
|
|
1241
2081
|
maxRetries?: number | undefined;
|
|
1242
2082
|
upstashUrl?: string | undefined;
|
|
1243
2083
|
upstashToken?: string | undefined;
|
|
@@ -1265,8 +2105,8 @@ declare const StorageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1265
2105
|
bucket?: string | undefined;
|
|
1266
2106
|
publicUrl?: string | undefined;
|
|
1267
2107
|
}, {
|
|
1268
|
-
endpoint?: string | undefined;
|
|
1269
2108
|
provider?: "memory" | "supabase" | "s3" | "minio" | "r2" | undefined;
|
|
2109
|
+
endpoint?: string | undefined;
|
|
1270
2110
|
region?: string | undefined;
|
|
1271
2111
|
accessKey?: string | undefined;
|
|
1272
2112
|
secretKey?: string | undefined;
|
|
@@ -1285,8 +2125,8 @@ declare const StorageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1285
2125
|
bucket?: string | undefined;
|
|
1286
2126
|
publicUrl?: string | undefined;
|
|
1287
2127
|
}, {
|
|
1288
|
-
endpoint?: string | undefined;
|
|
1289
2128
|
provider?: "memory" | "supabase" | "s3" | "minio" | "r2" | undefined;
|
|
2129
|
+
endpoint?: string | undefined;
|
|
1290
2130
|
region?: string | undefined;
|
|
1291
2131
|
accessKey?: string | undefined;
|
|
1292
2132
|
secretKey?: string | undefined;
|
|
@@ -1397,6 +2237,108 @@ declare const QueueConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1397
2237
|
concurrency?: number | undefined;
|
|
1398
2238
|
retryDelay?: number | undefined;
|
|
1399
2239
|
}>;
|
|
2240
|
+
declare const AIConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
2241
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2242
|
+
provider: z.ZodDefault<z.ZodEnum<["memory", "openai", "anthropic", "google"]>>;
|
|
2243
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
2244
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2245
|
+
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
2246
|
+
temperature: z.ZodDefault<z.ZodNumber>;
|
|
2247
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
2248
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
2249
|
+
}, "strip", z.ZodTypeAny, {
|
|
2250
|
+
timeout: number;
|
|
2251
|
+
provider: "openai" | "anthropic" | "google" | "memory";
|
|
2252
|
+
maxTokens: number;
|
|
2253
|
+
enabled: boolean;
|
|
2254
|
+
temperature: number;
|
|
2255
|
+
model?: string | undefined;
|
|
2256
|
+
baseUrl?: string | undefined;
|
|
2257
|
+
apiKey?: string | undefined;
|
|
2258
|
+
}, {
|
|
2259
|
+
timeout?: number | undefined;
|
|
2260
|
+
provider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
2261
|
+
model?: string | undefined;
|
|
2262
|
+
maxTokens?: number | undefined;
|
|
2263
|
+
enabled?: boolean | undefined;
|
|
2264
|
+
baseUrl?: string | undefined;
|
|
2265
|
+
apiKey?: string | undefined;
|
|
2266
|
+
temperature?: number | undefined;
|
|
2267
|
+
}>, {
|
|
2268
|
+
timeout: number;
|
|
2269
|
+
provider: "openai" | "anthropic" | "google" | "memory";
|
|
2270
|
+
maxTokens: number;
|
|
2271
|
+
enabled: boolean;
|
|
2272
|
+
temperature: number;
|
|
2273
|
+
model?: string | undefined;
|
|
2274
|
+
baseUrl?: string | undefined;
|
|
2275
|
+
apiKey?: string | undefined;
|
|
2276
|
+
}, {
|
|
2277
|
+
timeout?: number | undefined;
|
|
2278
|
+
provider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
2279
|
+
model?: string | undefined;
|
|
2280
|
+
maxTokens?: number | undefined;
|
|
2281
|
+
enabled?: boolean | undefined;
|
|
2282
|
+
baseUrl?: string | undefined;
|
|
2283
|
+
apiKey?: string | undefined;
|
|
2284
|
+
temperature?: number | undefined;
|
|
2285
|
+
}>;
|
|
2286
|
+
declare const RAGConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
2287
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2288
|
+
provider: z.ZodDefault<z.ZodEnum<["memory", "pinecone", "weaviate"]>>;
|
|
2289
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
2290
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
2291
|
+
indexName: z.ZodOptional<z.ZodString>;
|
|
2292
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
2293
|
+
host: z.ZodOptional<z.ZodString>;
|
|
2294
|
+
embeddingProvider: z.ZodDefault<z.ZodEnum<["memory", "openai", "anthropic", "google"]>>;
|
|
2295
|
+
embeddingApiKey: z.ZodOptional<z.ZodString>;
|
|
2296
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
2297
|
+
}, "strip", z.ZodTypeAny, {
|
|
2298
|
+
provider: "memory" | "pinecone" | "weaviate";
|
|
2299
|
+
enabled: boolean;
|
|
2300
|
+
embeddingProvider: "openai" | "anthropic" | "google" | "memory";
|
|
2301
|
+
environment?: string | undefined;
|
|
2302
|
+
apiKey?: string | undefined;
|
|
2303
|
+
host?: string | undefined;
|
|
2304
|
+
indexName?: string | undefined;
|
|
2305
|
+
namespace?: string | undefined;
|
|
2306
|
+
embeddingApiKey?: string | undefined;
|
|
2307
|
+
embeddingModel?: string | undefined;
|
|
2308
|
+
}, {
|
|
2309
|
+
environment?: string | undefined;
|
|
2310
|
+
provider?: "memory" | "pinecone" | "weaviate" | undefined;
|
|
2311
|
+
enabled?: boolean | undefined;
|
|
2312
|
+
apiKey?: string | undefined;
|
|
2313
|
+
host?: string | undefined;
|
|
2314
|
+
indexName?: string | undefined;
|
|
2315
|
+
namespace?: string | undefined;
|
|
2316
|
+
embeddingProvider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
2317
|
+
embeddingApiKey?: string | undefined;
|
|
2318
|
+
embeddingModel?: string | undefined;
|
|
2319
|
+
}>, {
|
|
2320
|
+
provider: "memory" | "pinecone" | "weaviate";
|
|
2321
|
+
enabled: boolean;
|
|
2322
|
+
embeddingProvider: "openai" | "anthropic" | "google" | "memory";
|
|
2323
|
+
environment?: string | undefined;
|
|
2324
|
+
apiKey?: string | undefined;
|
|
2325
|
+
host?: string | undefined;
|
|
2326
|
+
indexName?: string | undefined;
|
|
2327
|
+
namespace?: string | undefined;
|
|
2328
|
+
embeddingApiKey?: string | undefined;
|
|
2329
|
+
embeddingModel?: string | undefined;
|
|
2330
|
+
}, {
|
|
2331
|
+
environment?: string | undefined;
|
|
2332
|
+
provider?: "memory" | "pinecone" | "weaviate" | undefined;
|
|
2333
|
+
enabled?: boolean | undefined;
|
|
2334
|
+
apiKey?: string | undefined;
|
|
2335
|
+
host?: string | undefined;
|
|
2336
|
+
indexName?: string | undefined;
|
|
2337
|
+
namespace?: string | undefined;
|
|
2338
|
+
embeddingProvider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
2339
|
+
embeddingApiKey?: string | undefined;
|
|
2340
|
+
embeddingModel?: string | undefined;
|
|
2341
|
+
}>;
|
|
1400
2342
|
declare const RetryConfigSchema: z.ZodObject<{
|
|
1401
2343
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1402
2344
|
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1447,19 +2389,19 @@ declare const TimeoutConfigSchema: z.ZodObject<{
|
|
|
1447
2389
|
email: z.ZodDefault<z.ZodNumber>;
|
|
1448
2390
|
queue: z.ZodDefault<z.ZodNumber>;
|
|
1449
2391
|
}, "strip", z.ZodTypeAny, {
|
|
2392
|
+
default: number;
|
|
1450
2393
|
email: number;
|
|
1451
2394
|
enabled: boolean;
|
|
1452
2395
|
database: number;
|
|
1453
2396
|
storage: number;
|
|
1454
|
-
default: number;
|
|
1455
2397
|
cache: number;
|
|
1456
2398
|
queue: number;
|
|
1457
2399
|
}, {
|
|
2400
|
+
default?: number | undefined;
|
|
1458
2401
|
email?: number | undefined;
|
|
1459
2402
|
enabled?: boolean | undefined;
|
|
1460
2403
|
database?: number | undefined;
|
|
1461
2404
|
storage?: number | undefined;
|
|
1462
|
-
default?: number | undefined;
|
|
1463
2405
|
cache?: number | undefined;
|
|
1464
2406
|
queue?: number | undefined;
|
|
1465
2407
|
}>;
|
|
@@ -1530,19 +2472,19 @@ declare const ResilienceConfigSchema: z.ZodObject<{
|
|
|
1530
2472
|
email: z.ZodDefault<z.ZodNumber>;
|
|
1531
2473
|
queue: z.ZodDefault<z.ZodNumber>;
|
|
1532
2474
|
}, "strip", z.ZodTypeAny, {
|
|
2475
|
+
default: number;
|
|
1533
2476
|
email: number;
|
|
1534
2477
|
enabled: boolean;
|
|
1535
2478
|
database: number;
|
|
1536
2479
|
storage: number;
|
|
1537
|
-
default: number;
|
|
1538
2480
|
cache: number;
|
|
1539
2481
|
queue: number;
|
|
1540
2482
|
}, {
|
|
2483
|
+
default?: number | undefined;
|
|
1541
2484
|
email?: number | undefined;
|
|
1542
2485
|
enabled?: boolean | undefined;
|
|
1543
2486
|
database?: number | undefined;
|
|
1544
2487
|
storage?: number | undefined;
|
|
1545
|
-
default?: number | undefined;
|
|
1546
2488
|
cache?: number | undefined;
|
|
1547
2489
|
queue?: number | undefined;
|
|
1548
2490
|
}>>;
|
|
@@ -1564,11 +2506,11 @@ declare const ResilienceConfigSchema: z.ZodObject<{
|
|
|
1564
2506
|
}>>;
|
|
1565
2507
|
}, "strip", z.ZodTypeAny, {
|
|
1566
2508
|
timeout: {
|
|
2509
|
+
default: number;
|
|
1567
2510
|
email: number;
|
|
1568
2511
|
enabled: boolean;
|
|
1569
2512
|
database: number;
|
|
1570
2513
|
storage: number;
|
|
1571
|
-
default: number;
|
|
1572
2514
|
cache: number;
|
|
1573
2515
|
queue: number;
|
|
1574
2516
|
};
|
|
@@ -1595,11 +2537,11 @@ declare const ResilienceConfigSchema: z.ZodObject<{
|
|
|
1595
2537
|
};
|
|
1596
2538
|
}, {
|
|
1597
2539
|
timeout?: {
|
|
2540
|
+
default?: number | undefined;
|
|
1598
2541
|
email?: number | undefined;
|
|
1599
2542
|
enabled?: boolean | undefined;
|
|
1600
2543
|
database?: number | undefined;
|
|
1601
2544
|
storage?: number | undefined;
|
|
1602
|
-
default?: number | undefined;
|
|
1603
2545
|
cache?: number | undefined;
|
|
1604
2546
|
queue?: number | undefined;
|
|
1605
2547
|
} | undefined;
|
|
@@ -1674,8 +2616,8 @@ declare const TracingConfigSchema: z.ZodObject<{
|
|
|
1674
2616
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
1675
2617
|
exporterType: z.ZodDefault<z.ZodEnum<["otlp-http", "otlp-grpc", "console"]>>;
|
|
1676
2618
|
}, "strip", z.ZodTypeAny, {
|
|
1677
|
-
enabled: boolean;
|
|
1678
2619
|
provider: "otlp" | "memory" | "noop";
|
|
2620
|
+
enabled: boolean;
|
|
1679
2621
|
sampleRate: number;
|
|
1680
2622
|
propagateContext: boolean;
|
|
1681
2623
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -1685,9 +2627,9 @@ declare const TracingConfigSchema: z.ZodObject<{
|
|
|
1685
2627
|
serviceVersion?: string | undefined;
|
|
1686
2628
|
}, {
|
|
1687
2629
|
environment?: string | undefined;
|
|
2630
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1688
2631
|
endpoint?: string | undefined;
|
|
1689
2632
|
enabled?: boolean | undefined;
|
|
1690
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1691
2633
|
serviceName?: string | undefined;
|
|
1692
2634
|
serviceVersion?: string | undefined;
|
|
1693
2635
|
sampleRate?: number | undefined;
|
|
@@ -1744,8 +2686,8 @@ declare const ObservabilityConfigSchema: z.ZodObject<{
|
|
|
1744
2686
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
1745
2687
|
exporterType: z.ZodDefault<z.ZodEnum<["otlp-http", "otlp-grpc", "console"]>>;
|
|
1746
2688
|
}, "strip", z.ZodTypeAny, {
|
|
1747
|
-
enabled: boolean;
|
|
1748
2689
|
provider: "otlp" | "memory" | "noop";
|
|
2690
|
+
enabled: boolean;
|
|
1749
2691
|
sampleRate: number;
|
|
1750
2692
|
propagateContext: boolean;
|
|
1751
2693
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -1755,9 +2697,9 @@ declare const ObservabilityConfigSchema: z.ZodObject<{
|
|
|
1755
2697
|
serviceVersion?: string | undefined;
|
|
1756
2698
|
}, {
|
|
1757
2699
|
environment?: string | undefined;
|
|
2700
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1758
2701
|
endpoint?: string | undefined;
|
|
1759
2702
|
enabled?: boolean | undefined;
|
|
1760
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1761
2703
|
serviceName?: string | undefined;
|
|
1762
2704
|
serviceVersion?: string | undefined;
|
|
1763
2705
|
sampleRate?: number | undefined;
|
|
@@ -1780,8 +2722,8 @@ declare const ObservabilityConfigSchema: z.ZodObject<{
|
|
|
1780
2722
|
histogramBuckets: number[];
|
|
1781
2723
|
};
|
|
1782
2724
|
tracing: {
|
|
1783
|
-
enabled: boolean;
|
|
1784
2725
|
provider: "otlp" | "memory" | "noop";
|
|
2726
|
+
enabled: boolean;
|
|
1785
2727
|
sampleRate: number;
|
|
1786
2728
|
propagateContext: boolean;
|
|
1787
2729
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -1807,9 +2749,9 @@ declare const ObservabilityConfigSchema: z.ZodObject<{
|
|
|
1807
2749
|
} | undefined;
|
|
1808
2750
|
tracing?: {
|
|
1809
2751
|
environment?: string | undefined;
|
|
2752
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1810
2753
|
endpoint?: string | undefined;
|
|
1811
2754
|
enabled?: boolean | undefined;
|
|
1812
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
1813
2755
|
serviceName?: string | undefined;
|
|
1814
2756
|
serviceVersion?: string | undefined;
|
|
1815
2757
|
sampleRate?: number | undefined;
|
|
@@ -1896,8 +2838,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
1896
2838
|
rejectUnauthorized?: boolean | undefined;
|
|
1897
2839
|
} | undefined;
|
|
1898
2840
|
}, {
|
|
1899
|
-
url?: string | undefined;
|
|
1900
2841
|
provider?: "memory" | "postgres" | "supabase" | undefined;
|
|
2842
|
+
url?: string | undefined;
|
|
1901
2843
|
connectionString?: string | undefined;
|
|
1902
2844
|
supabaseUrl?: string | undefined;
|
|
1903
2845
|
supabaseAnonKey?: string | undefined;
|
|
@@ -1920,8 +2862,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
1920
2862
|
rejectUnauthorized?: boolean | undefined;
|
|
1921
2863
|
} | undefined;
|
|
1922
2864
|
}, {
|
|
1923
|
-
url?: string | undefined;
|
|
1924
2865
|
provider?: "memory" | "postgres" | "supabase" | undefined;
|
|
2866
|
+
url?: string | undefined;
|
|
1925
2867
|
connectionString?: string | undefined;
|
|
1926
2868
|
supabaseUrl?: string | undefined;
|
|
1927
2869
|
supabaseAnonKey?: string | undefined;
|
|
@@ -1949,8 +2891,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
1949
2891
|
upstashUrl?: string | undefined;
|
|
1950
2892
|
upstashToken?: string | undefined;
|
|
1951
2893
|
}, {
|
|
1952
|
-
url?: string | undefined;
|
|
1953
2894
|
provider?: "memory" | "redis" | "upstash" | undefined;
|
|
2895
|
+
url?: string | undefined;
|
|
1954
2896
|
maxRetries?: number | undefined;
|
|
1955
2897
|
upstashUrl?: string | undefined;
|
|
1956
2898
|
upstashToken?: string | undefined;
|
|
@@ -1965,8 +2907,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
1965
2907
|
upstashUrl?: string | undefined;
|
|
1966
2908
|
upstashToken?: string | undefined;
|
|
1967
2909
|
}, {
|
|
1968
|
-
url?: string | undefined;
|
|
1969
2910
|
provider?: "memory" | "redis" | "upstash" | undefined;
|
|
2911
|
+
url?: string | undefined;
|
|
1970
2912
|
maxRetries?: number | undefined;
|
|
1971
2913
|
upstashUrl?: string | undefined;
|
|
1972
2914
|
upstashToken?: string | undefined;
|
|
@@ -1994,8 +2936,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
1994
2936
|
bucket?: string | undefined;
|
|
1995
2937
|
publicUrl?: string | undefined;
|
|
1996
2938
|
}, {
|
|
1997
|
-
endpoint?: string | undefined;
|
|
1998
2939
|
provider?: "memory" | "supabase" | "s3" | "minio" | "r2" | undefined;
|
|
2940
|
+
endpoint?: string | undefined;
|
|
1999
2941
|
region?: string | undefined;
|
|
2000
2942
|
accessKey?: string | undefined;
|
|
2001
2943
|
secretKey?: string | undefined;
|
|
@@ -2014,8 +2956,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2014
2956
|
bucket?: string | undefined;
|
|
2015
2957
|
publicUrl?: string | undefined;
|
|
2016
2958
|
}, {
|
|
2017
|
-
endpoint?: string | undefined;
|
|
2018
2959
|
provider?: "memory" | "supabase" | "s3" | "minio" | "r2" | undefined;
|
|
2960
|
+
endpoint?: string | undefined;
|
|
2019
2961
|
region?: string | undefined;
|
|
2020
2962
|
accessKey?: string | undefined;
|
|
2021
2963
|
secretKey?: string | undefined;
|
|
@@ -2126,6 +3068,108 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2126
3068
|
concurrency?: number | undefined;
|
|
2127
3069
|
retryDelay?: number | undefined;
|
|
2128
3070
|
}>>;
|
|
3071
|
+
ai: z.ZodDefault<z.ZodEffects<z.ZodObject<{
|
|
3072
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
3073
|
+
provider: z.ZodDefault<z.ZodEnum<["memory", "openai", "anthropic", "google"]>>;
|
|
3074
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
3075
|
+
model: z.ZodOptional<z.ZodString>;
|
|
3076
|
+
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
3077
|
+
temperature: z.ZodDefault<z.ZodNumber>;
|
|
3078
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
3079
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
3080
|
+
}, "strip", z.ZodTypeAny, {
|
|
3081
|
+
timeout: number;
|
|
3082
|
+
provider: "openai" | "anthropic" | "google" | "memory";
|
|
3083
|
+
maxTokens: number;
|
|
3084
|
+
enabled: boolean;
|
|
3085
|
+
temperature: number;
|
|
3086
|
+
model?: string | undefined;
|
|
3087
|
+
baseUrl?: string | undefined;
|
|
3088
|
+
apiKey?: string | undefined;
|
|
3089
|
+
}, {
|
|
3090
|
+
timeout?: number | undefined;
|
|
3091
|
+
provider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3092
|
+
model?: string | undefined;
|
|
3093
|
+
maxTokens?: number | undefined;
|
|
3094
|
+
enabled?: boolean | undefined;
|
|
3095
|
+
baseUrl?: string | undefined;
|
|
3096
|
+
apiKey?: string | undefined;
|
|
3097
|
+
temperature?: number | undefined;
|
|
3098
|
+
}>, {
|
|
3099
|
+
timeout: number;
|
|
3100
|
+
provider: "openai" | "anthropic" | "google" | "memory";
|
|
3101
|
+
maxTokens: number;
|
|
3102
|
+
enabled: boolean;
|
|
3103
|
+
temperature: number;
|
|
3104
|
+
model?: string | undefined;
|
|
3105
|
+
baseUrl?: string | undefined;
|
|
3106
|
+
apiKey?: string | undefined;
|
|
3107
|
+
}, {
|
|
3108
|
+
timeout?: number | undefined;
|
|
3109
|
+
provider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3110
|
+
model?: string | undefined;
|
|
3111
|
+
maxTokens?: number | undefined;
|
|
3112
|
+
enabled?: boolean | undefined;
|
|
3113
|
+
baseUrl?: string | undefined;
|
|
3114
|
+
apiKey?: string | undefined;
|
|
3115
|
+
temperature?: number | undefined;
|
|
3116
|
+
}>>;
|
|
3117
|
+
rag: z.ZodDefault<z.ZodEffects<z.ZodObject<{
|
|
3118
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
3119
|
+
provider: z.ZodDefault<z.ZodEnum<["memory", "pinecone", "weaviate"]>>;
|
|
3120
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
3121
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
3122
|
+
indexName: z.ZodOptional<z.ZodString>;
|
|
3123
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
3124
|
+
host: z.ZodOptional<z.ZodString>;
|
|
3125
|
+
embeddingProvider: z.ZodDefault<z.ZodEnum<["memory", "openai", "anthropic", "google"]>>;
|
|
3126
|
+
embeddingApiKey: z.ZodOptional<z.ZodString>;
|
|
3127
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
3128
|
+
}, "strip", z.ZodTypeAny, {
|
|
3129
|
+
provider: "memory" | "pinecone" | "weaviate";
|
|
3130
|
+
enabled: boolean;
|
|
3131
|
+
embeddingProvider: "openai" | "anthropic" | "google" | "memory";
|
|
3132
|
+
environment?: string | undefined;
|
|
3133
|
+
apiKey?: string | undefined;
|
|
3134
|
+
host?: string | undefined;
|
|
3135
|
+
indexName?: string | undefined;
|
|
3136
|
+
namespace?: string | undefined;
|
|
3137
|
+
embeddingApiKey?: string | undefined;
|
|
3138
|
+
embeddingModel?: string | undefined;
|
|
3139
|
+
}, {
|
|
3140
|
+
environment?: string | undefined;
|
|
3141
|
+
provider?: "memory" | "pinecone" | "weaviate" | undefined;
|
|
3142
|
+
enabled?: boolean | undefined;
|
|
3143
|
+
apiKey?: string | undefined;
|
|
3144
|
+
host?: string | undefined;
|
|
3145
|
+
indexName?: string | undefined;
|
|
3146
|
+
namespace?: string | undefined;
|
|
3147
|
+
embeddingProvider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3148
|
+
embeddingApiKey?: string | undefined;
|
|
3149
|
+
embeddingModel?: string | undefined;
|
|
3150
|
+
}>, {
|
|
3151
|
+
provider: "memory" | "pinecone" | "weaviate";
|
|
3152
|
+
enabled: boolean;
|
|
3153
|
+
embeddingProvider: "openai" | "anthropic" | "google" | "memory";
|
|
3154
|
+
environment?: string | undefined;
|
|
3155
|
+
apiKey?: string | undefined;
|
|
3156
|
+
host?: string | undefined;
|
|
3157
|
+
indexName?: string | undefined;
|
|
3158
|
+
namespace?: string | undefined;
|
|
3159
|
+
embeddingApiKey?: string | undefined;
|
|
3160
|
+
embeddingModel?: string | undefined;
|
|
3161
|
+
}, {
|
|
3162
|
+
environment?: string | undefined;
|
|
3163
|
+
provider?: "memory" | "pinecone" | "weaviate" | undefined;
|
|
3164
|
+
enabled?: boolean | undefined;
|
|
3165
|
+
apiKey?: string | undefined;
|
|
3166
|
+
host?: string | undefined;
|
|
3167
|
+
indexName?: string | undefined;
|
|
3168
|
+
namespace?: string | undefined;
|
|
3169
|
+
embeddingProvider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3170
|
+
embeddingApiKey?: string | undefined;
|
|
3171
|
+
embeddingModel?: string | undefined;
|
|
3172
|
+
}>>;
|
|
2129
3173
|
resilience: z.ZodDefault<z.ZodObject<{
|
|
2130
3174
|
retry: z.ZodDefault<z.ZodObject<{
|
|
2131
3175
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -2177,19 +3221,19 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2177
3221
|
email: z.ZodDefault<z.ZodNumber>;
|
|
2178
3222
|
queue: z.ZodDefault<z.ZodNumber>;
|
|
2179
3223
|
}, "strip", z.ZodTypeAny, {
|
|
3224
|
+
default: number;
|
|
2180
3225
|
email: number;
|
|
2181
3226
|
enabled: boolean;
|
|
2182
3227
|
database: number;
|
|
2183
3228
|
storage: number;
|
|
2184
|
-
default: number;
|
|
2185
3229
|
cache: number;
|
|
2186
3230
|
queue: number;
|
|
2187
3231
|
}, {
|
|
3232
|
+
default?: number | undefined;
|
|
2188
3233
|
email?: number | undefined;
|
|
2189
3234
|
enabled?: boolean | undefined;
|
|
2190
3235
|
database?: number | undefined;
|
|
2191
3236
|
storage?: number | undefined;
|
|
2192
|
-
default?: number | undefined;
|
|
2193
3237
|
cache?: number | undefined;
|
|
2194
3238
|
queue?: number | undefined;
|
|
2195
3239
|
}>>;
|
|
@@ -2211,11 +3255,11 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2211
3255
|
}>>;
|
|
2212
3256
|
}, "strip", z.ZodTypeAny, {
|
|
2213
3257
|
timeout: {
|
|
3258
|
+
default: number;
|
|
2214
3259
|
email: number;
|
|
2215
3260
|
enabled: boolean;
|
|
2216
3261
|
database: number;
|
|
2217
3262
|
storage: number;
|
|
2218
|
-
default: number;
|
|
2219
3263
|
cache: number;
|
|
2220
3264
|
queue: number;
|
|
2221
3265
|
};
|
|
@@ -2242,11 +3286,11 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2242
3286
|
};
|
|
2243
3287
|
}, {
|
|
2244
3288
|
timeout?: {
|
|
3289
|
+
default?: number | undefined;
|
|
2245
3290
|
email?: number | undefined;
|
|
2246
3291
|
enabled?: boolean | undefined;
|
|
2247
3292
|
database?: number | undefined;
|
|
2248
3293
|
storage?: number | undefined;
|
|
2249
|
-
default?: number | undefined;
|
|
2250
3294
|
cache?: number | undefined;
|
|
2251
3295
|
queue?: number | undefined;
|
|
2252
3296
|
} | undefined;
|
|
@@ -2322,8 +3366,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2322
3366
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
2323
3367
|
exporterType: z.ZodDefault<z.ZodEnum<["otlp-http", "otlp-grpc", "console"]>>;
|
|
2324
3368
|
}, "strip", z.ZodTypeAny, {
|
|
2325
|
-
enabled: boolean;
|
|
2326
3369
|
provider: "otlp" | "memory" | "noop";
|
|
3370
|
+
enabled: boolean;
|
|
2327
3371
|
sampleRate: number;
|
|
2328
3372
|
propagateContext: boolean;
|
|
2329
3373
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -2333,9 +3377,9 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2333
3377
|
serviceVersion?: string | undefined;
|
|
2334
3378
|
}, {
|
|
2335
3379
|
environment?: string | undefined;
|
|
3380
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2336
3381
|
endpoint?: string | undefined;
|
|
2337
3382
|
enabled?: boolean | undefined;
|
|
2338
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2339
3383
|
serviceName?: string | undefined;
|
|
2340
3384
|
serviceVersion?: string | undefined;
|
|
2341
3385
|
sampleRate?: number | undefined;
|
|
@@ -2358,8 +3402,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2358
3402
|
histogramBuckets: number[];
|
|
2359
3403
|
};
|
|
2360
3404
|
tracing: {
|
|
2361
|
-
enabled: boolean;
|
|
2362
3405
|
provider: "otlp" | "memory" | "noop";
|
|
3406
|
+
enabled: boolean;
|
|
2363
3407
|
sampleRate: number;
|
|
2364
3408
|
propagateContext: boolean;
|
|
2365
3409
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -2385,9 +3429,9 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2385
3429
|
} | undefined;
|
|
2386
3430
|
tracing?: {
|
|
2387
3431
|
environment?: string | undefined;
|
|
3432
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2388
3433
|
endpoint?: string | undefined;
|
|
2389
3434
|
enabled?: boolean | undefined;
|
|
2390
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2391
3435
|
serviceName?: string | undefined;
|
|
2392
3436
|
serviceVersion?: string | undefined;
|
|
2393
3437
|
sampleRate?: number | undefined;
|
|
@@ -2500,13 +3544,35 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2500
3544
|
retryDelay: number;
|
|
2501
3545
|
redisUrl?: string | undefined;
|
|
2502
3546
|
};
|
|
3547
|
+
ai: {
|
|
3548
|
+
timeout: number;
|
|
3549
|
+
provider: "openai" | "anthropic" | "google" | "memory";
|
|
3550
|
+
maxTokens: number;
|
|
3551
|
+
enabled: boolean;
|
|
3552
|
+
temperature: number;
|
|
3553
|
+
model?: string | undefined;
|
|
3554
|
+
baseUrl?: string | undefined;
|
|
3555
|
+
apiKey?: string | undefined;
|
|
3556
|
+
};
|
|
3557
|
+
rag: {
|
|
3558
|
+
provider: "memory" | "pinecone" | "weaviate";
|
|
3559
|
+
enabled: boolean;
|
|
3560
|
+
embeddingProvider: "openai" | "anthropic" | "google" | "memory";
|
|
3561
|
+
environment?: string | undefined;
|
|
3562
|
+
apiKey?: string | undefined;
|
|
3563
|
+
host?: string | undefined;
|
|
3564
|
+
indexName?: string | undefined;
|
|
3565
|
+
namespace?: string | undefined;
|
|
3566
|
+
embeddingApiKey?: string | undefined;
|
|
3567
|
+
embeddingModel?: string | undefined;
|
|
3568
|
+
};
|
|
2503
3569
|
resilience: {
|
|
2504
3570
|
timeout: {
|
|
3571
|
+
default: number;
|
|
2505
3572
|
email: number;
|
|
2506
3573
|
enabled: boolean;
|
|
2507
3574
|
database: number;
|
|
2508
3575
|
storage: number;
|
|
2509
|
-
default: number;
|
|
2510
3576
|
cache: number;
|
|
2511
3577
|
queue: number;
|
|
2512
3578
|
};
|
|
@@ -2548,8 +3614,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2548
3614
|
histogramBuckets: number[];
|
|
2549
3615
|
};
|
|
2550
3616
|
tracing: {
|
|
2551
|
-
enabled: boolean;
|
|
2552
3617
|
provider: "otlp" | "memory" | "noop";
|
|
3618
|
+
enabled: boolean;
|
|
2553
3619
|
sampleRate: number;
|
|
2554
3620
|
propagateContext: boolean;
|
|
2555
3621
|
exporterType: "console" | "otlp-http" | "otlp-grpc";
|
|
@@ -2586,8 +3652,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2586
3652
|
rateLimitPerSecond?: number | undefined;
|
|
2587
3653
|
} | undefined;
|
|
2588
3654
|
database?: {
|
|
2589
|
-
url?: string | undefined;
|
|
2590
3655
|
provider?: "memory" | "postgres" | "supabase" | undefined;
|
|
3656
|
+
url?: string | undefined;
|
|
2591
3657
|
connectionString?: string | undefined;
|
|
2592
3658
|
supabaseUrl?: string | undefined;
|
|
2593
3659
|
supabaseAnonKey?: string | undefined;
|
|
@@ -2599,8 +3665,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2599
3665
|
} | undefined;
|
|
2600
3666
|
} | undefined;
|
|
2601
3667
|
storage?: {
|
|
2602
|
-
endpoint?: string | undefined;
|
|
2603
3668
|
provider?: "memory" | "supabase" | "s3" | "minio" | "r2" | undefined;
|
|
3669
|
+
endpoint?: string | undefined;
|
|
2604
3670
|
region?: string | undefined;
|
|
2605
3671
|
accessKey?: string | undefined;
|
|
2606
3672
|
secretKey?: string | undefined;
|
|
@@ -2610,8 +3676,8 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2610
3676
|
signedUrlExpiry?: number | undefined;
|
|
2611
3677
|
} | undefined;
|
|
2612
3678
|
cache?: {
|
|
2613
|
-
url?: string | undefined;
|
|
2614
3679
|
provider?: "memory" | "redis" | "upstash" | undefined;
|
|
3680
|
+
url?: string | undefined;
|
|
2615
3681
|
maxRetries?: number | undefined;
|
|
2616
3682
|
upstashUrl?: string | undefined;
|
|
2617
3683
|
upstashToken?: string | undefined;
|
|
@@ -2628,13 +3694,35 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2628
3694
|
concurrency?: number | undefined;
|
|
2629
3695
|
retryDelay?: number | undefined;
|
|
2630
3696
|
} | undefined;
|
|
3697
|
+
ai?: {
|
|
3698
|
+
timeout?: number | undefined;
|
|
3699
|
+
provider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3700
|
+
model?: string | undefined;
|
|
3701
|
+
maxTokens?: number | undefined;
|
|
3702
|
+
enabled?: boolean | undefined;
|
|
3703
|
+
baseUrl?: string | undefined;
|
|
3704
|
+
apiKey?: string | undefined;
|
|
3705
|
+
temperature?: number | undefined;
|
|
3706
|
+
} | undefined;
|
|
3707
|
+
rag?: {
|
|
3708
|
+
environment?: string | undefined;
|
|
3709
|
+
provider?: "memory" | "pinecone" | "weaviate" | undefined;
|
|
3710
|
+
enabled?: boolean | undefined;
|
|
3711
|
+
apiKey?: string | undefined;
|
|
3712
|
+
host?: string | undefined;
|
|
3713
|
+
indexName?: string | undefined;
|
|
3714
|
+
namespace?: string | undefined;
|
|
3715
|
+
embeddingProvider?: "openai" | "anthropic" | "google" | "memory" | undefined;
|
|
3716
|
+
embeddingApiKey?: string | undefined;
|
|
3717
|
+
embeddingModel?: string | undefined;
|
|
3718
|
+
} | undefined;
|
|
2631
3719
|
resilience?: {
|
|
2632
3720
|
timeout?: {
|
|
3721
|
+
default?: number | undefined;
|
|
2633
3722
|
email?: number | undefined;
|
|
2634
3723
|
enabled?: boolean | undefined;
|
|
2635
3724
|
database?: number | undefined;
|
|
2636
3725
|
storage?: number | undefined;
|
|
2637
|
-
default?: number | undefined;
|
|
2638
3726
|
cache?: number | undefined;
|
|
2639
3727
|
queue?: number | undefined;
|
|
2640
3728
|
} | undefined;
|
|
@@ -2677,9 +3765,9 @@ declare const PlatformConfigSchema: z.ZodObject<{
|
|
|
2677
3765
|
} | undefined;
|
|
2678
3766
|
tracing?: {
|
|
2679
3767
|
environment?: string | undefined;
|
|
3768
|
+
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2680
3769
|
endpoint?: string | undefined;
|
|
2681
3770
|
enabled?: boolean | undefined;
|
|
2682
|
-
provider?: "otlp" | "memory" | "noop" | undefined;
|
|
2683
3771
|
serviceName?: string | undefined;
|
|
2684
3772
|
serviceVersion?: string | undefined;
|
|
2685
3773
|
sampleRate?: number | undefined;
|
|
@@ -2946,4 +4034,4 @@ declare class ConsoleEmail implements IEmail {
|
|
|
2946
4034
|
private formatAddresses;
|
|
2947
4035
|
}
|
|
2948
4036
|
|
|
2949
|
-
export { type
|
|
4037
|
+
export { type RAGDocument as $, type AIConfig as A, type AIChatRequest as B, ConsoleEmail as C, type AIChatResponse as D, EnvSecrets as E, type AIStreamChunk as F, type AIStreamCallback as G, type AICompletionRequest as H, type IPlatform as I, type Job as J, type AICompletionResponse as K, type AIEmbeddingRequest as L, MemoryDatabase as M, NoopLogger as N, type AIEmbeddingResponse as O, type PlatformHealthStatus as P, type QueryResult as Q, type RepeatOptions as R, type StorageFile as S, type AIModelConfig as T, type UploadOptions as U, type AIModelType as V, type AIProvider as W, type IRAG as X, type RAGConfig as Y, type CreateCollectionOptions as Z, type RAGCollection as _, MemoryCache as a, type EmailAddress as a$, type IngestionOptions as a0, type BulkIngestionResult as a1, type IngestionResult as a2, type DocumentStatus as a3, type RAGChunk as a4, type RAGSearchQuery as a5, type RAGSearchResponse as a6, type RAGSearchResult as a7, type ContextAssemblyConfig as a8, type AssembledContext as a9, type AIToolCall as aA, type AITool as aB, type AIChatChoice as aC, type AIFinishReason as aD, type AIUsageInfo as aE, type RoutingStrategy as aF, type AIRouterConfig as aG, type AIErrorCode as aH, type AIError as aI, MemoryRAG as aJ, ChunkingPresets as aK, type ChunkingStrategy as aL, type ChunkingConfig as aM, type SearchMode as aN, type RAGFilter as aO, type RAGPipelineStep as aP, createPlatformAsync as aQ, createScopedMetrics as aR, MemoryTracing as aS, NoopTracing as aT, type ITracing as aU, type ISpan as aV, type SpanContext as aW, type SpanOptions as aX, type SpanStatus as aY, type SpanKind as aZ, type TracingConfig as a_, type RAGPipeline as aa, type ICacheOptions as ab, type JobResult as ac, type JobContext as ad, type JobEvent as ae, type QueueStats as af, type BackoffOptions as ag, type LogLevel as ah, type LogMeta as ai, type LogEntry as aj, type LoggerConfig as ak, type MetricTags as al, type HistogramStats as am, type TimingStats as an, type Secret as ao, type SecretMetadata as ap, type GetSecretOptions as aq, type SetSecretOptions as ar, type RotateSecretOptions as as, type RotationResult as at, createAIError as au, isAIError as av, AIErrorMessages as aw, MemoryAI as ax, type AIRole as ay, type AIMessage as az, MemoryStorage as b, type EmailAttachment as b0, calculateBackoff as b1, generateJobId as b2, type SpanStatusCode as b3, type SpanEvent as b4, DatabaseProviderSchema as b5, CacheProviderSchema as b6, StorageProviderSchema as b7, EmailProviderSchema as b8, QueueProviderSchema as b9, type EmailConfig as bA, type QueueConfig as bB, type ResilienceConfig as bC, type ObservabilityConfig as bD, type MiddlewareConfig as bE, loadConfig as bF, validateConfig as bG, safeValidateConfig as bH, getDefaultConfig as bI, TracingProviderSchema as ba, LogLevelSchema as bb, AIProviderSchema as bc, RAGProviderSchema as bd, DatabaseConfigSchema as be, CacheConfigSchema as bf, StorageConfigSchema as bg, EmailConfigSchema as bh, QueueConfigSchema as bi, AIConfigSchema as bj, RAGConfigSchema as bk, RetryConfigSchema as bl, CircuitBreakerConfigSchema as bm, TimeoutConfigSchema as bn, BulkheadConfigSchema as bo, ResilienceConfigSchema as bp, LoggingConfigSchema as bq, MetricsConfigSchema as br, TracingConfigSchema as bs, ObservabilityConfigSchema as bt, MiddlewareConfigSchema as bu, PlatformConfigSchema as bv, type PlatformConfig as bw, type DatabaseConfig as bx, type CacheConfig as by, type StorageConfig as bz, MemoryEmail as c, MemoryQueue as d, type IDatabase as e, MemorySecrets as f, createPlatform as g, ConsoleLogger as h, MemoryMetrics as i, NoopMetrics as j, type IQueryBuilder as k, type ICache as l, type IStorage as m, type IEmail as n, type IQueue as o, type ILogger as p, type IMetrics as q, type ISecrets as r, type JobOptions as s, type EmailMessage as t, type MetricsSummary as u, type EmailResult as v, type JobState as w, type JobEventType as x, type JobEventHandler as y, type IAI as z };
|