@llmops/core 1.0.0-beta.2 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14407 -2170
- package/dist/index.d.cts +226 -1292
- package/dist/index.d.mts +226 -1292
- package/dist/index.mjs +14461 -2201
- package/package.json +2 -17
- package/dist/bun-sqlite-dialect-CHpTFgAo.mjs +0 -155
- package/dist/bun-sqlite-dialect-CVUG5QUU.cjs +0 -156
- package/dist/db/index.cjs +0 -40
- package/dist/db/index.d.cts +0 -2
- package/dist/db/index.d.mts +0 -2
- package/dist/db/index.mjs +0 -4
- package/dist/db-CZ8KtpL-.mjs +0 -14325
- package/dist/db-DZv0NtMm.cjs +0 -14640
- package/dist/index-BlFAMkmT.d.mts +0 -2711
- package/dist/index-DjIHdwhi.d.cts +0 -2711
- package/dist/neon-dialect-BOnuygPe.cjs +0 -3
- package/dist/neon-dialect-ByrFa9iy.cjs +0 -42
- package/dist/neon-dialect-DySGBYUi.mjs +0 -30
- package/dist/neon-dialect-Hmo08nUq.mjs +0 -3
- package/dist/node-sqlite-dialect-B5oKhOm1.mjs +0 -155
- package/dist/node-sqlite-dialect-fwmW40Ar.cjs +0 -156
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { $ as SCHEMA_METADATA, A as DatasetsTable, At as playgroundsSchema, B as LLMRequest, Bt as workspaceSettingsSchema, C as Dataset, Ct as environmentSecretsSchema, D as DatasetVersionRecord, Dt as playgroundColumnSchema, E as DatasetVersion, Et as llmRequestsSchema, F as GuardrailConfig, Ft as spansSchema, G as PlaygroundResultsTable, H as Playground, I as GuardrailConfigsTable, It as targetingRulesSchema, J as PlaygroundsTable, K as PlaygroundRun, L as GuardrailResult, Lt as tracesSchema, M as EnvironmentSecret, Mt as providerGuardrailOverridesSchema, N as EnvironmentSecretsTable, Nt as schemas, O as DatasetVersionRecordsTable, Ot as playgroundResultsSchema, P as EnvironmentsTable, Pt as spanEventsSchema, Q as ProviderGuardrailOverridesTable, R as GuardrailResults, Rt as variantVersionsSchema, S as Database, St as datasetsSchema, T as DatasetRecordsTable, Tt as guardrailConfigsSchema, U as PlaygroundColumn, V as LLMRequestsTable, W as PlaygroundResult, X as ProviderConfigsTable, Y as ProviderConfig, Z as ProviderGuardrailOverride, _ as validateTableData, _t as configVariantsSchema, a as createDatabaseFromConnection, at as TableName, b as ConfigVariantsTable, bt as datasetVersionRecordsSchema, c as executeWithSchema, ct as Trace, d as getMigrations, dt as Variant, et as Selectable, f as matchType, ft as VariantVersion, g as validatePartialTableData, gt as WorkspaceSettingsTable, h as parseTableData, ht as WorkspaceSettings, i as createDatabase, it as SpansTable, j as Environment, jt as providerConfigsSchema, k as DatasetVersionsTable, kt as playgroundRunsSchema, l as MigrationOptions, lt as TracesTable, m as parsePartialTableData, mt as VariantsTable, n as DatabaseOptions, nt as SpanEvent, o as detectDatabaseType, ot as TargetingRule, p as runAutoMigrations, pt as VariantVersionsTable, q as PlaygroundRunsTable, r as DatabaseType, rt as SpanEventsTable, s as createNeonDialect, st as TargetingRulesTable, t as DatabaseConnection, tt as Span, u as MigrationResult, ut as Updateable, v as Config, vt as configsSchema, w as DatasetRecord, wt as environmentsSchema, x as ConfigsTable, xt as datasetVersionsSchema, y as ConfigVariant, yt as datasetRecordsSchema, z as Insertable, zt as variantsSchema } from "./index-BlFAMkmT.mjs";
|
|
2
1
|
import gateway from "@llmops/gateway";
|
|
3
|
-
import { Kysely } from "kysely";
|
|
4
2
|
import pino from "pino";
|
|
5
3
|
import z$1, { z } from "zod";
|
|
6
4
|
|
|
@@ -716,10 +714,10 @@ declare const chatCompletionCreateParamsBaseSchema: z.ZodObject<{
|
|
|
716
714
|
seed: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
717
715
|
service_tier: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
718
716
|
default: "default";
|
|
719
|
-
priority: "priority";
|
|
720
717
|
auto: "auto";
|
|
721
718
|
flex: "flex";
|
|
722
719
|
scale: "scale";
|
|
720
|
+
priority: "priority";
|
|
723
721
|
}>>>;
|
|
724
722
|
stop: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
725
723
|
store: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -905,10 +903,10 @@ declare const variantJsonDataSchema: z.ZodObject<{
|
|
|
905
903
|
seed: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
906
904
|
service_tier: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
907
905
|
default: "default";
|
|
908
|
-
priority: "priority";
|
|
909
906
|
auto: "auto";
|
|
910
907
|
flex: "flex";
|
|
911
908
|
scale: "scale";
|
|
909
|
+
priority: "priority";
|
|
912
910
|
}>>>;
|
|
913
911
|
stop: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
914
912
|
store: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1187,1280 +1185,6 @@ declare const logger: pino.Logger<never, boolean>;
|
|
|
1187
1185
|
//#region src/utils/id.d.ts
|
|
1188
1186
|
declare const generateId: (size?: number) => string;
|
|
1189
1187
|
//#endregion
|
|
1190
|
-
//#region src/datalayer/datasets.d.ts
|
|
1191
|
-
declare const createDataset: z$1.ZodObject<{
|
|
1192
|
-
name: z$1.ZodString;
|
|
1193
|
-
description: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1194
|
-
}, z$1.core.$strip>;
|
|
1195
|
-
declare const updateDataset: z$1.ZodObject<{
|
|
1196
|
-
datasetId: z$1.ZodString;
|
|
1197
|
-
name: z$1.ZodOptional<z$1.ZodString>;
|
|
1198
|
-
description: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1199
|
-
}, z$1.core.$strip>;
|
|
1200
|
-
declare const getDatasetById: z$1.ZodObject<{
|
|
1201
|
-
datasetId: z$1.ZodString;
|
|
1202
|
-
}, z$1.core.$strip>;
|
|
1203
|
-
declare const deleteDataset: z$1.ZodObject<{
|
|
1204
|
-
datasetId: z$1.ZodString;
|
|
1205
|
-
}, z$1.core.$strip>;
|
|
1206
|
-
declare const listDatasets: z$1.ZodObject<{
|
|
1207
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1208
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1209
|
-
}, z$1.core.$strip>;
|
|
1210
|
-
declare const createRecord: z$1.ZodObject<{
|
|
1211
|
-
datasetId: z$1.ZodString;
|
|
1212
|
-
input: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
1213
|
-
expected: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>>;
|
|
1214
|
-
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1215
|
-
}, z$1.core.$strip>;
|
|
1216
|
-
declare const updateRecord: z$1.ZodObject<{
|
|
1217
|
-
recordId: z$1.ZodString;
|
|
1218
|
-
input: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1219
|
-
expected: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>>;
|
|
1220
|
-
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1221
|
-
}, z$1.core.$strip>;
|
|
1222
|
-
declare const deleteRecord: z$1.ZodObject<{
|
|
1223
|
-
recordId: z$1.ZodString;
|
|
1224
|
-
}, z$1.core.$strip>;
|
|
1225
|
-
declare const listRecords: z$1.ZodObject<{
|
|
1226
|
-
datasetId: z$1.ZodString;
|
|
1227
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1228
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1229
|
-
}, z$1.core.$strip>;
|
|
1230
|
-
declare const createVersion: z$1.ZodObject<{
|
|
1231
|
-
datasetId: z$1.ZodString;
|
|
1232
|
-
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1233
|
-
description: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1234
|
-
}, z$1.core.$strip>;
|
|
1235
|
-
declare const getVersionById: z$1.ZodObject<{
|
|
1236
|
-
versionId: z$1.ZodString;
|
|
1237
|
-
}, z$1.core.$strip>;
|
|
1238
|
-
declare const listVersions: z$1.ZodObject<{
|
|
1239
|
-
datasetId: z$1.ZodString;
|
|
1240
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1241
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1242
|
-
}, z$1.core.$strip>;
|
|
1243
|
-
declare const getVersionRecords: z$1.ZodObject<{
|
|
1244
|
-
versionId: z$1.ZodString;
|
|
1245
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1246
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1247
|
-
}, z$1.core.$strip>;
|
|
1248
|
-
declare const createDatasetsDataLayer: (db: Kysely<Database>) => {
|
|
1249
|
-
createDataset: (params: z$1.infer<typeof createDataset>) => Promise<{
|
|
1250
|
-
name: string;
|
|
1251
|
-
id: string;
|
|
1252
|
-
createdAt: Date;
|
|
1253
|
-
updatedAt: Date;
|
|
1254
|
-
description: string | null;
|
|
1255
|
-
recordCount: number;
|
|
1256
|
-
latestVersionNumber: number;
|
|
1257
|
-
} | undefined>;
|
|
1258
|
-
updateDataset: (params: z$1.infer<typeof updateDataset>) => Promise<{
|
|
1259
|
-
name: string;
|
|
1260
|
-
id: string;
|
|
1261
|
-
createdAt: Date;
|
|
1262
|
-
updatedAt: Date;
|
|
1263
|
-
description: string | null;
|
|
1264
|
-
recordCount: number;
|
|
1265
|
-
latestVersionNumber: number;
|
|
1266
|
-
} | undefined>;
|
|
1267
|
-
getDatasetById: (params: z$1.infer<typeof getDatasetById>) => Promise<{
|
|
1268
|
-
name: string;
|
|
1269
|
-
id: string;
|
|
1270
|
-
createdAt: Date;
|
|
1271
|
-
updatedAt: Date;
|
|
1272
|
-
description: string | null;
|
|
1273
|
-
recordCount: number;
|
|
1274
|
-
latestVersionNumber: number;
|
|
1275
|
-
} | undefined>;
|
|
1276
|
-
deleteDataset: (params: z$1.infer<typeof deleteDataset>) => Promise<{
|
|
1277
|
-
name: string;
|
|
1278
|
-
id: string;
|
|
1279
|
-
createdAt: Date;
|
|
1280
|
-
updatedAt: Date;
|
|
1281
|
-
description: string | null;
|
|
1282
|
-
recordCount: number;
|
|
1283
|
-
latestVersionNumber: number;
|
|
1284
|
-
} | undefined>;
|
|
1285
|
-
listDatasets: (params?: z$1.infer<typeof listDatasets>) => Promise<{
|
|
1286
|
-
name: string;
|
|
1287
|
-
id: string;
|
|
1288
|
-
createdAt: Date;
|
|
1289
|
-
updatedAt: Date;
|
|
1290
|
-
description: string | null;
|
|
1291
|
-
recordCount: number;
|
|
1292
|
-
latestVersionNumber: number;
|
|
1293
|
-
}[]>;
|
|
1294
|
-
countDatasets: () => Promise<number>;
|
|
1295
|
-
createRecord: (params: z$1.infer<typeof createRecord>) => Promise<{
|
|
1296
|
-
id: string;
|
|
1297
|
-
createdAt: Date;
|
|
1298
|
-
updatedAt: Date;
|
|
1299
|
-
input: Record<string, unknown>;
|
|
1300
|
-
datasetId: string;
|
|
1301
|
-
expected: Record<string, unknown> | null;
|
|
1302
|
-
metadata: Record<string, unknown>;
|
|
1303
|
-
} | undefined>;
|
|
1304
|
-
updateRecord: (params: z$1.infer<typeof updateRecord>) => Promise<{
|
|
1305
|
-
id: string;
|
|
1306
|
-
createdAt: Date;
|
|
1307
|
-
updatedAt: Date;
|
|
1308
|
-
input: Record<string, unknown>;
|
|
1309
|
-
datasetId: string;
|
|
1310
|
-
expected: Record<string, unknown> | null;
|
|
1311
|
-
metadata: Record<string, unknown>;
|
|
1312
|
-
} | undefined>;
|
|
1313
|
-
deleteRecord: (params: z$1.infer<typeof deleteRecord>) => Promise<{
|
|
1314
|
-
id: string;
|
|
1315
|
-
createdAt: Date;
|
|
1316
|
-
updatedAt: Date;
|
|
1317
|
-
input: Record<string, unknown>;
|
|
1318
|
-
datasetId: string;
|
|
1319
|
-
expected: Record<string, unknown> | null;
|
|
1320
|
-
metadata: Record<string, unknown>;
|
|
1321
|
-
} | undefined>;
|
|
1322
|
-
listRecords: (params: z$1.infer<typeof listRecords>) => Promise<{
|
|
1323
|
-
id: string;
|
|
1324
|
-
createdAt: Date;
|
|
1325
|
-
updatedAt: Date;
|
|
1326
|
-
input: Record<string, unknown>;
|
|
1327
|
-
datasetId: string;
|
|
1328
|
-
expected: Record<string, unknown> | null;
|
|
1329
|
-
metadata: Record<string, unknown>;
|
|
1330
|
-
}[]>;
|
|
1331
|
-
getRecordById: (recordId: string) => Promise<{
|
|
1332
|
-
id: string;
|
|
1333
|
-
createdAt: Date;
|
|
1334
|
-
updatedAt: Date;
|
|
1335
|
-
input: Record<string, unknown>;
|
|
1336
|
-
datasetId: string;
|
|
1337
|
-
expected: Record<string, unknown> | null;
|
|
1338
|
-
metadata: Record<string, unknown>;
|
|
1339
|
-
} | undefined>;
|
|
1340
|
-
createVersion: (params: z$1.infer<typeof createVersion>) => Promise<{
|
|
1341
|
-
name: string | null;
|
|
1342
|
-
id: string;
|
|
1343
|
-
createdAt: Date;
|
|
1344
|
-
updatedAt: Date;
|
|
1345
|
-
datasetId: string;
|
|
1346
|
-
description: string | null;
|
|
1347
|
-
recordCount: number;
|
|
1348
|
-
versionNumber: number;
|
|
1349
|
-
snapshotHash: string;
|
|
1350
|
-
} | undefined>;
|
|
1351
|
-
getVersionById: (params: z$1.infer<typeof getVersionById>) => Promise<{
|
|
1352
|
-
name: string | null;
|
|
1353
|
-
id: string;
|
|
1354
|
-
createdAt: Date;
|
|
1355
|
-
updatedAt: Date;
|
|
1356
|
-
datasetId: string;
|
|
1357
|
-
description: string | null;
|
|
1358
|
-
recordCount: number;
|
|
1359
|
-
versionNumber: number;
|
|
1360
|
-
snapshotHash: string;
|
|
1361
|
-
} | undefined>;
|
|
1362
|
-
listVersions: (params: z$1.infer<typeof listVersions>) => Promise<{
|
|
1363
|
-
name: string | null;
|
|
1364
|
-
id: string;
|
|
1365
|
-
createdAt: Date;
|
|
1366
|
-
updatedAt: Date;
|
|
1367
|
-
datasetId: string;
|
|
1368
|
-
description: string | null;
|
|
1369
|
-
recordCount: number;
|
|
1370
|
-
versionNumber: number;
|
|
1371
|
-
snapshotHash: string;
|
|
1372
|
-
}[]>;
|
|
1373
|
-
getVersionRecords: (params: z$1.infer<typeof getVersionRecords>) => Promise<{
|
|
1374
|
-
id: string;
|
|
1375
|
-
createdAt: Date;
|
|
1376
|
-
updatedAt: Date;
|
|
1377
|
-
input: Record<string, unknown>;
|
|
1378
|
-
datasetId: string;
|
|
1379
|
-
expected: Record<string, unknown> | null;
|
|
1380
|
-
metadata: Record<string, unknown>;
|
|
1381
|
-
position: number;
|
|
1382
|
-
}[]>;
|
|
1383
|
-
};
|
|
1384
|
-
//#endregion
|
|
1385
|
-
//#region src/datalayer/llmRequests.d.ts
|
|
1386
|
-
/**
|
|
1387
|
-
* Schema for inserting a new LLM request log
|
|
1388
|
-
*/
|
|
1389
|
-
declare const insertLLMRequestSchema: z$1.ZodObject<{
|
|
1390
|
-
requestId: z$1.ZodString;
|
|
1391
|
-
configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1392
|
-
variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1393
|
-
environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1394
|
-
providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1395
|
-
provider: z$1.ZodString;
|
|
1396
|
-
model: z$1.ZodString;
|
|
1397
|
-
promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1398
|
-
completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1399
|
-
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1400
|
-
cachedTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1401
|
-
cacheCreationTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1402
|
-
cost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1403
|
-
cacheSavings: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1404
|
-
inputCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1405
|
-
outputCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1406
|
-
endpoint: z$1.ZodString;
|
|
1407
|
-
statusCode: z$1.ZodNumber;
|
|
1408
|
-
latencyMs: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1409
|
-
isStreaming: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1410
|
-
userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1411
|
-
tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
1412
|
-
guardrailResults: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
1413
|
-
results: z$1.ZodArray<z$1.ZodObject<{
|
|
1414
|
-
checkId: z$1.ZodString;
|
|
1415
|
-
functionId: z$1.ZodString;
|
|
1416
|
-
hookType: z$1.ZodEnum<{
|
|
1417
|
-
beforeRequestHook: "beforeRequestHook";
|
|
1418
|
-
afterRequestHook: "afterRequestHook";
|
|
1419
|
-
}>;
|
|
1420
|
-
verdict: z$1.ZodBoolean;
|
|
1421
|
-
latencyMs: z$1.ZodNumber;
|
|
1422
|
-
}, z$1.core.$strip>>;
|
|
1423
|
-
action: z$1.ZodEnum<{
|
|
1424
|
-
allowed: "allowed";
|
|
1425
|
-
blocked: "blocked";
|
|
1426
|
-
logged: "logged";
|
|
1427
|
-
}>;
|
|
1428
|
-
totalLatencyMs: z$1.ZodNumber;
|
|
1429
|
-
}, z$1.core.$strip>>>;
|
|
1430
|
-
traceId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1431
|
-
spanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1432
|
-
parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1433
|
-
sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1434
|
-
}, z$1.core.$strip>;
|
|
1435
|
-
type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
|
|
1436
|
-
/**
|
|
1437
|
-
* Schema for listing LLM requests
|
|
1438
|
-
*/
|
|
1439
|
-
declare const listRequestsSchema: z$1.ZodObject<{
|
|
1440
|
-
limit: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1441
|
-
offset: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1442
|
-
configId: z$1.ZodOptional<z$1.ZodString>;
|
|
1443
|
-
variantId: z$1.ZodOptional<z$1.ZodString>;
|
|
1444
|
-
environmentId: z$1.ZodOptional<z$1.ZodString>;
|
|
1445
|
-
providerConfigId: z$1.ZodOptional<z$1.ZodString>;
|
|
1446
|
-
provider: z$1.ZodOptional<z$1.ZodString>;
|
|
1447
|
-
model: z$1.ZodOptional<z$1.ZodString>;
|
|
1448
|
-
startDate: z$1.ZodOptional<z$1.ZodDate>;
|
|
1449
|
-
endDate: z$1.ZodOptional<z$1.ZodDate>;
|
|
1450
|
-
tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
|
|
1451
|
-
}, z$1.core.$strip>;
|
|
1452
|
-
/**
|
|
1453
|
-
* Schema for date range queries with optional filters
|
|
1454
|
-
*/
|
|
1455
|
-
declare const dateRangeSchema: z$1.ZodObject<{
|
|
1456
|
-
startDate: z$1.ZodDate;
|
|
1457
|
-
endDate: z$1.ZodDate;
|
|
1458
|
-
configId: z$1.ZodOptional<z$1.ZodString>;
|
|
1459
|
-
variantId: z$1.ZodOptional<z$1.ZodString>;
|
|
1460
|
-
environmentId: z$1.ZodOptional<z$1.ZodString>;
|
|
1461
|
-
tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
|
|
1462
|
-
}, z$1.core.$strip>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Valid groupBy values for cost summary queries
|
|
1465
|
-
*/
|
|
1466
|
-
declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
|
|
1467
|
-
type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
|
|
1468
|
-
/**
|
|
1469
|
-
* Schema for cost summary with grouping
|
|
1470
|
-
*/
|
|
1471
|
-
declare const costSummarySchema: z$1.ZodObject<{
|
|
1472
|
-
startDate: z$1.ZodDate;
|
|
1473
|
-
endDate: z$1.ZodDate;
|
|
1474
|
-
configId: z$1.ZodOptional<z$1.ZodString>;
|
|
1475
|
-
variantId: z$1.ZodOptional<z$1.ZodString>;
|
|
1476
|
-
environmentId: z$1.ZodOptional<z$1.ZodString>;
|
|
1477
|
-
tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
|
|
1478
|
-
groupBy: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1479
|
-
provider: "provider";
|
|
1480
|
-
model: "model";
|
|
1481
|
-
endpoint: "endpoint";
|
|
1482
|
-
tags: "tags";
|
|
1483
|
-
day: "day";
|
|
1484
|
-
hour: "hour";
|
|
1485
|
-
}>>;
|
|
1486
|
-
tagKeys: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
1487
|
-
}, z$1.core.$strip>;
|
|
1488
|
-
declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
|
|
1489
|
-
/**
|
|
1490
|
-
* Batch insert LLM request logs
|
|
1491
|
-
* Used by the BatchWriter service for efficient writes
|
|
1492
|
-
*/
|
|
1493
|
-
batchInsertRequests: (requests: LLMRequestInsert[]) => Promise<{
|
|
1494
|
-
count: number;
|
|
1495
|
-
}>;
|
|
1496
|
-
/**
|
|
1497
|
-
* Insert a single LLM request log
|
|
1498
|
-
*/
|
|
1499
|
-
insertRequest: (request: LLMRequestInsert) => Promise<{
|
|
1500
|
-
id: string;
|
|
1501
|
-
createdAt: Date;
|
|
1502
|
-
updatedAt: Date;
|
|
1503
|
-
variantId: string | null;
|
|
1504
|
-
provider: string;
|
|
1505
|
-
environmentId: string | null;
|
|
1506
|
-
configId: string | null;
|
|
1507
|
-
providerConfigId: string | null;
|
|
1508
|
-
latencyMs: number;
|
|
1509
|
-
promptTokens: number;
|
|
1510
|
-
completionTokens: number;
|
|
1511
|
-
totalTokens: number;
|
|
1512
|
-
cost: number;
|
|
1513
|
-
requestId: string;
|
|
1514
|
-
model: string;
|
|
1515
|
-
cachedTokens: number;
|
|
1516
|
-
cacheCreationTokens: number;
|
|
1517
|
-
cacheSavings: number;
|
|
1518
|
-
inputCost: number;
|
|
1519
|
-
outputCost: number;
|
|
1520
|
-
endpoint: string;
|
|
1521
|
-
statusCode: number;
|
|
1522
|
-
isStreaming: boolean;
|
|
1523
|
-
userId: string | null;
|
|
1524
|
-
tags: Record<string, string>;
|
|
1525
|
-
guardrailResults: {
|
|
1526
|
-
results: {
|
|
1527
|
-
checkId: string;
|
|
1528
|
-
functionId: string;
|
|
1529
|
-
hookType: "beforeRequestHook" | "afterRequestHook";
|
|
1530
|
-
verdict: boolean;
|
|
1531
|
-
latencyMs: number;
|
|
1532
|
-
}[];
|
|
1533
|
-
action: "allowed" | "blocked" | "logged";
|
|
1534
|
-
totalLatencyMs: number;
|
|
1535
|
-
} | null;
|
|
1536
|
-
traceId: string | null;
|
|
1537
|
-
spanId: string | null;
|
|
1538
|
-
parentSpanId: string | null;
|
|
1539
|
-
sessionId: string | null;
|
|
1540
|
-
} | undefined>;
|
|
1541
|
-
/**
|
|
1542
|
-
* List LLM requests with filtering and pagination
|
|
1543
|
-
* Returns data and total count for pagination
|
|
1544
|
-
*/
|
|
1545
|
-
listRequests: (params?: z$1.infer<typeof listRequestsSchema>) => Promise<{
|
|
1546
|
-
data: {
|
|
1547
|
-
id: string;
|
|
1548
|
-
createdAt: Date;
|
|
1549
|
-
updatedAt: Date;
|
|
1550
|
-
variantId: string | null;
|
|
1551
|
-
provider: string;
|
|
1552
|
-
environmentId: string | null;
|
|
1553
|
-
configId: string | null;
|
|
1554
|
-
providerConfigId: string | null;
|
|
1555
|
-
latencyMs: number;
|
|
1556
|
-
promptTokens: number;
|
|
1557
|
-
completionTokens: number;
|
|
1558
|
-
totalTokens: number;
|
|
1559
|
-
cost: number;
|
|
1560
|
-
requestId: string;
|
|
1561
|
-
model: string;
|
|
1562
|
-
cachedTokens: number;
|
|
1563
|
-
cacheCreationTokens: number;
|
|
1564
|
-
cacheSavings: number;
|
|
1565
|
-
inputCost: number;
|
|
1566
|
-
outputCost: number;
|
|
1567
|
-
endpoint: string;
|
|
1568
|
-
statusCode: number;
|
|
1569
|
-
isStreaming: boolean;
|
|
1570
|
-
userId: string | null;
|
|
1571
|
-
tags: Record<string, string>;
|
|
1572
|
-
guardrailResults: {
|
|
1573
|
-
results: {
|
|
1574
|
-
checkId: string;
|
|
1575
|
-
functionId: string;
|
|
1576
|
-
hookType: "beforeRequestHook" | "afterRequestHook";
|
|
1577
|
-
verdict: boolean;
|
|
1578
|
-
latencyMs: number;
|
|
1579
|
-
}[];
|
|
1580
|
-
action: "allowed" | "blocked" | "logged";
|
|
1581
|
-
totalLatencyMs: number;
|
|
1582
|
-
} | null;
|
|
1583
|
-
traceId: string | null;
|
|
1584
|
-
spanId: string | null;
|
|
1585
|
-
parentSpanId: string | null;
|
|
1586
|
-
sessionId: string | null;
|
|
1587
|
-
}[];
|
|
1588
|
-
total: number;
|
|
1589
|
-
limit: number;
|
|
1590
|
-
offset: number;
|
|
1591
|
-
}>;
|
|
1592
|
-
/**
|
|
1593
|
-
* Get a single request by requestId
|
|
1594
|
-
*/
|
|
1595
|
-
getRequestByRequestId: (requestId: string) => Promise<{
|
|
1596
|
-
id: string;
|
|
1597
|
-
createdAt: Date;
|
|
1598
|
-
updatedAt: Date;
|
|
1599
|
-
variantId: string | null;
|
|
1600
|
-
provider: string;
|
|
1601
|
-
environmentId: string | null;
|
|
1602
|
-
configId: string | null;
|
|
1603
|
-
providerConfigId: string | null;
|
|
1604
|
-
latencyMs: number;
|
|
1605
|
-
promptTokens: number;
|
|
1606
|
-
completionTokens: number;
|
|
1607
|
-
totalTokens: number;
|
|
1608
|
-
cost: number;
|
|
1609
|
-
requestId: string;
|
|
1610
|
-
model: string;
|
|
1611
|
-
cachedTokens: number;
|
|
1612
|
-
cacheCreationTokens: number;
|
|
1613
|
-
cacheSavings: number;
|
|
1614
|
-
inputCost: number;
|
|
1615
|
-
outputCost: number;
|
|
1616
|
-
endpoint: string;
|
|
1617
|
-
statusCode: number;
|
|
1618
|
-
isStreaming: boolean;
|
|
1619
|
-
userId: string | null;
|
|
1620
|
-
tags: Record<string, string>;
|
|
1621
|
-
guardrailResults: {
|
|
1622
|
-
results: {
|
|
1623
|
-
checkId: string;
|
|
1624
|
-
functionId: string;
|
|
1625
|
-
hookType: "beforeRequestHook" | "afterRequestHook";
|
|
1626
|
-
verdict: boolean;
|
|
1627
|
-
latencyMs: number;
|
|
1628
|
-
}[];
|
|
1629
|
-
action: "allowed" | "blocked" | "logged";
|
|
1630
|
-
totalLatencyMs: number;
|
|
1631
|
-
} | null;
|
|
1632
|
-
traceId: string | null;
|
|
1633
|
-
spanId: string | null;
|
|
1634
|
-
parentSpanId: string | null;
|
|
1635
|
-
sessionId: string | null;
|
|
1636
|
-
} | undefined>;
|
|
1637
|
-
/**
|
|
1638
|
-
* Get total cost for a date range with optional filters
|
|
1639
|
-
*/
|
|
1640
|
-
getTotalCost: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
|
|
1641
|
-
totalCost: number;
|
|
1642
|
-
totalInputCost: number;
|
|
1643
|
-
totalOutputCost: number;
|
|
1644
|
-
totalPromptTokens: number;
|
|
1645
|
-
totalCompletionTokens: number;
|
|
1646
|
-
totalTokens: number;
|
|
1647
|
-
totalCachedTokens: number;
|
|
1648
|
-
totalCacheSavings: number;
|
|
1649
|
-
requestCount: number;
|
|
1650
|
-
} | undefined>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Get cost breakdown by model
|
|
1653
|
-
*/
|
|
1654
|
-
getCostByModel: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
|
|
1655
|
-
provider: string;
|
|
1656
|
-
model: string;
|
|
1657
|
-
totalCost: number;
|
|
1658
|
-
totalInputCost: number;
|
|
1659
|
-
totalOutputCost: number;
|
|
1660
|
-
totalTokens: number;
|
|
1661
|
-
requestCount: number;
|
|
1662
|
-
avgLatencyMs: number;
|
|
1663
|
-
}[]>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Get cost breakdown by provider
|
|
1666
|
-
*/
|
|
1667
|
-
getCostByProvider: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
|
|
1668
|
-
provider: string;
|
|
1669
|
-
totalCost: number;
|
|
1670
|
-
totalInputCost: number;
|
|
1671
|
-
totalOutputCost: number;
|
|
1672
|
-
totalTokens: number;
|
|
1673
|
-
requestCount: number;
|
|
1674
|
-
avgLatencyMs: number;
|
|
1675
|
-
}[]>;
|
|
1676
|
-
/**
|
|
1677
|
-
* Get daily cost summary
|
|
1678
|
-
*/
|
|
1679
|
-
getDailyCosts: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
|
|
1680
|
-
totalCost: number;
|
|
1681
|
-
totalInputCost: number;
|
|
1682
|
-
totalOutputCost: number;
|
|
1683
|
-
totalTokens: number;
|
|
1684
|
-
requestCount: number;
|
|
1685
|
-
date: string;
|
|
1686
|
-
}[]>;
|
|
1687
|
-
/**
|
|
1688
|
-
* Get cost summary with flexible grouping and optional filters
|
|
1689
|
-
*/
|
|
1690
|
-
getCostSummary: (params: z$1.infer<typeof costSummarySchema>) => Promise<{
|
|
1691
|
-
totalCost: number;
|
|
1692
|
-
requestCount: number;
|
|
1693
|
-
groupKey: string;
|
|
1694
|
-
}[]>;
|
|
1695
|
-
/**
|
|
1696
|
-
* Get request count and stats for a time range with optional filters
|
|
1697
|
-
*/
|
|
1698
|
-
getRequestStats: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
|
|
1699
|
-
avgLatencyMs: number;
|
|
1700
|
-
totalRequests: number;
|
|
1701
|
-
successfulRequests: number;
|
|
1702
|
-
failedRequests: number;
|
|
1703
|
-
streamingRequests: number;
|
|
1704
|
-
maxLatencyMs: number;
|
|
1705
|
-
minLatencyMs: number;
|
|
1706
|
-
} | undefined>;
|
|
1707
|
-
/**
|
|
1708
|
-
* Get all distinct tag key-value pairs from llm_requests
|
|
1709
|
-
* Used for populating tag filter dropdowns in the UI
|
|
1710
|
-
*/
|
|
1711
|
-
getDistinctTags: () => Promise<{
|
|
1712
|
-
key: string;
|
|
1713
|
-
value: string;
|
|
1714
|
-
}[]>;
|
|
1715
|
-
};
|
|
1716
|
-
//#endregion
|
|
1717
|
-
//#region src/datalayer/playgrounds.d.ts
|
|
1718
|
-
declare const createNewPlayground: z$1.ZodObject<{
|
|
1719
|
-
name: z$1.ZodString;
|
|
1720
|
-
datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1721
|
-
columns: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
|
|
1722
|
-
id: z$1.ZodString;
|
|
1723
|
-
name: z$1.ZodString;
|
|
1724
|
-
position: z$1.ZodNumber;
|
|
1725
|
-
providerConfigId: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
1726
|
-
providerSlug: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1727
|
-
modelName: z$1.ZodString;
|
|
1728
|
-
messages: z$1.ZodArray<z$1.ZodObject<{
|
|
1729
|
-
role: z$1.ZodEnum<{
|
|
1730
|
-
system: "system";
|
|
1731
|
-
user: "user";
|
|
1732
|
-
assistant: "assistant";
|
|
1733
|
-
}>;
|
|
1734
|
-
content: z$1.ZodString;
|
|
1735
|
-
}, z$1.core.$strip>>;
|
|
1736
|
-
temperature: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1737
|
-
maxTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1738
|
-
topP: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1739
|
-
frequencyPenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1740
|
-
presencePenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1741
|
-
}, z$1.core.$strip>>>>;
|
|
1742
|
-
}, z$1.core.$strip>;
|
|
1743
|
-
declare const updatePlayground: z$1.ZodObject<{
|
|
1744
|
-
playgroundId: z$1.ZodUUID;
|
|
1745
|
-
name: z$1.ZodOptional<z$1.ZodString>;
|
|
1746
|
-
datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1747
|
-
columns: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
|
|
1748
|
-
id: z$1.ZodString;
|
|
1749
|
-
name: z$1.ZodString;
|
|
1750
|
-
position: z$1.ZodNumber;
|
|
1751
|
-
providerConfigId: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
1752
|
-
providerSlug: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1753
|
-
modelName: z$1.ZodString;
|
|
1754
|
-
messages: z$1.ZodArray<z$1.ZodObject<{
|
|
1755
|
-
role: z$1.ZodEnum<{
|
|
1756
|
-
system: "system";
|
|
1757
|
-
user: "user";
|
|
1758
|
-
assistant: "assistant";
|
|
1759
|
-
}>;
|
|
1760
|
-
content: z$1.ZodString;
|
|
1761
|
-
}, z$1.core.$strip>>;
|
|
1762
|
-
temperature: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1763
|
-
maxTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1764
|
-
topP: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1765
|
-
frequencyPenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1766
|
-
presencePenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1767
|
-
}, z$1.core.$strip>>>>;
|
|
1768
|
-
}, z$1.core.$strip>;
|
|
1769
|
-
declare const getPlaygroundById: z$1.ZodObject<{
|
|
1770
|
-
playgroundId: z$1.ZodUUID;
|
|
1771
|
-
}, z$1.core.$strip>;
|
|
1772
|
-
declare const deletePlayground: z$1.ZodObject<{
|
|
1773
|
-
playgroundId: z$1.ZodUUID;
|
|
1774
|
-
}, z$1.core.$strip>;
|
|
1775
|
-
declare const listPlaygrounds: z$1.ZodObject<{
|
|
1776
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1777
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1778
|
-
}, z$1.core.$strip>;
|
|
1779
|
-
declare const createPlaygroundDataLayer: (db: Kysely<Database>) => {
|
|
1780
|
-
createNewPlayground: (params: z$1.infer<typeof createNewPlayground>) => Promise<{
|
|
1781
|
-
name: string;
|
|
1782
|
-
id: string;
|
|
1783
|
-
createdAt: Date;
|
|
1784
|
-
updatedAt: Date;
|
|
1785
|
-
datasetId: string | null;
|
|
1786
|
-
columns: {
|
|
1787
|
-
id: string;
|
|
1788
|
-
name: string;
|
|
1789
|
-
position: number;
|
|
1790
|
-
modelName: string;
|
|
1791
|
-
messages: {
|
|
1792
|
-
role: "system" | "user" | "assistant";
|
|
1793
|
-
content: string;
|
|
1794
|
-
}[];
|
|
1795
|
-
providerConfigId?: string | null | undefined;
|
|
1796
|
-
providerSlug?: string | null | undefined;
|
|
1797
|
-
temperature?: number | null | undefined;
|
|
1798
|
-
maxTokens?: number | null | undefined;
|
|
1799
|
-
topP?: number | null | undefined;
|
|
1800
|
-
frequencyPenalty?: number | null | undefined;
|
|
1801
|
-
presencePenalty?: number | null | undefined;
|
|
1802
|
-
}[] | null;
|
|
1803
|
-
} | undefined>;
|
|
1804
|
-
updatePlayground: (params: z$1.infer<typeof updatePlayground>) => Promise<{
|
|
1805
|
-
name: string;
|
|
1806
|
-
id: string;
|
|
1807
|
-
createdAt: Date;
|
|
1808
|
-
updatedAt: Date;
|
|
1809
|
-
datasetId: string | null;
|
|
1810
|
-
columns: {
|
|
1811
|
-
id: string;
|
|
1812
|
-
name: string;
|
|
1813
|
-
position: number;
|
|
1814
|
-
modelName: string;
|
|
1815
|
-
messages: {
|
|
1816
|
-
role: "system" | "user" | "assistant";
|
|
1817
|
-
content: string;
|
|
1818
|
-
}[];
|
|
1819
|
-
providerConfigId?: string | null | undefined;
|
|
1820
|
-
providerSlug?: string | null | undefined;
|
|
1821
|
-
temperature?: number | null | undefined;
|
|
1822
|
-
maxTokens?: number | null | undefined;
|
|
1823
|
-
topP?: number | null | undefined;
|
|
1824
|
-
frequencyPenalty?: number | null | undefined;
|
|
1825
|
-
presencePenalty?: number | null | undefined;
|
|
1826
|
-
}[] | null;
|
|
1827
|
-
} | undefined>;
|
|
1828
|
-
getPlaygroundById: (params: z$1.infer<typeof getPlaygroundById>) => Promise<{
|
|
1829
|
-
name: string;
|
|
1830
|
-
id: string;
|
|
1831
|
-
createdAt: Date;
|
|
1832
|
-
updatedAt: Date;
|
|
1833
|
-
datasetId: string | null;
|
|
1834
|
-
columns: {
|
|
1835
|
-
id: string;
|
|
1836
|
-
name: string;
|
|
1837
|
-
position: number;
|
|
1838
|
-
modelName: string;
|
|
1839
|
-
messages: {
|
|
1840
|
-
role: "system" | "user" | "assistant";
|
|
1841
|
-
content: string;
|
|
1842
|
-
}[];
|
|
1843
|
-
providerConfigId?: string | null | undefined;
|
|
1844
|
-
providerSlug?: string | null | undefined;
|
|
1845
|
-
temperature?: number | null | undefined;
|
|
1846
|
-
maxTokens?: number | null | undefined;
|
|
1847
|
-
topP?: number | null | undefined;
|
|
1848
|
-
frequencyPenalty?: number | null | undefined;
|
|
1849
|
-
presencePenalty?: number | null | undefined;
|
|
1850
|
-
}[] | null;
|
|
1851
|
-
} | undefined>;
|
|
1852
|
-
deletePlayground: (params: z$1.infer<typeof deletePlayground>) => Promise<{
|
|
1853
|
-
name: string;
|
|
1854
|
-
id: string;
|
|
1855
|
-
createdAt: Date;
|
|
1856
|
-
updatedAt: Date;
|
|
1857
|
-
datasetId: string | null;
|
|
1858
|
-
columns: {
|
|
1859
|
-
id: string;
|
|
1860
|
-
name: string;
|
|
1861
|
-
position: number;
|
|
1862
|
-
modelName: string;
|
|
1863
|
-
messages: {
|
|
1864
|
-
role: "system" | "user" | "assistant";
|
|
1865
|
-
content: string;
|
|
1866
|
-
}[];
|
|
1867
|
-
providerConfigId?: string | null | undefined;
|
|
1868
|
-
providerSlug?: string | null | undefined;
|
|
1869
|
-
temperature?: number | null | undefined;
|
|
1870
|
-
maxTokens?: number | null | undefined;
|
|
1871
|
-
topP?: number | null | undefined;
|
|
1872
|
-
frequencyPenalty?: number | null | undefined;
|
|
1873
|
-
presencePenalty?: number | null | undefined;
|
|
1874
|
-
}[] | null;
|
|
1875
|
-
} | undefined>;
|
|
1876
|
-
listPlaygrounds: (params?: z$1.infer<typeof listPlaygrounds>) => Promise<{
|
|
1877
|
-
name: string;
|
|
1878
|
-
id: string;
|
|
1879
|
-
createdAt: Date;
|
|
1880
|
-
updatedAt: Date;
|
|
1881
|
-
datasetId: string | null;
|
|
1882
|
-
columns: {
|
|
1883
|
-
id: string;
|
|
1884
|
-
name: string;
|
|
1885
|
-
position: number;
|
|
1886
|
-
modelName: string;
|
|
1887
|
-
messages: {
|
|
1888
|
-
role: "system" | "user" | "assistant";
|
|
1889
|
-
content: string;
|
|
1890
|
-
}[];
|
|
1891
|
-
providerConfigId?: string | null | undefined;
|
|
1892
|
-
providerSlug?: string | null | undefined;
|
|
1893
|
-
temperature?: number | null | undefined;
|
|
1894
|
-
maxTokens?: number | null | undefined;
|
|
1895
|
-
topP?: number | null | undefined;
|
|
1896
|
-
frequencyPenalty?: number | null | undefined;
|
|
1897
|
-
presencePenalty?: number | null | undefined;
|
|
1898
|
-
}[] | null;
|
|
1899
|
-
}[]>;
|
|
1900
|
-
countPlaygrounds: () => Promise<number>;
|
|
1901
|
-
};
|
|
1902
|
-
//#endregion
|
|
1903
|
-
//#region src/datalayer/playgroundResults.d.ts
|
|
1904
|
-
declare const createPlaygroundResult: z$1.ZodObject<{
|
|
1905
|
-
runId: z$1.ZodString;
|
|
1906
|
-
columnId: z$1.ZodString;
|
|
1907
|
-
datasetRecordId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1908
|
-
inputVariables: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1909
|
-
status: z$1.ZodDefault<z$1.ZodEnum<{
|
|
1910
|
-
pending: "pending";
|
|
1911
|
-
running: "running";
|
|
1912
|
-
completed: "completed";
|
|
1913
|
-
failed: "failed";
|
|
1914
|
-
}>>;
|
|
1915
|
-
}, z$1.core.$strip>;
|
|
1916
|
-
declare const createPlaygroundResultsBatch: z$1.ZodObject<{
|
|
1917
|
-
results: z$1.ZodArray<z$1.ZodObject<{
|
|
1918
|
-
runId: z$1.ZodString;
|
|
1919
|
-
columnId: z$1.ZodString;
|
|
1920
|
-
datasetRecordId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1921
|
-
inputVariables: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1922
|
-
status: z$1.ZodDefault<z$1.ZodEnum<{
|
|
1923
|
-
pending: "pending";
|
|
1924
|
-
running: "running";
|
|
1925
|
-
completed: "completed";
|
|
1926
|
-
failed: "failed";
|
|
1927
|
-
}>>;
|
|
1928
|
-
}, z$1.core.$strip>>;
|
|
1929
|
-
}, z$1.core.$strip>;
|
|
1930
|
-
declare const updatePlaygroundResult: z$1.ZodObject<{
|
|
1931
|
-
resultId: z$1.ZodString;
|
|
1932
|
-
outputContent: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1933
|
-
status: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1934
|
-
pending: "pending";
|
|
1935
|
-
running: "running";
|
|
1936
|
-
completed: "completed";
|
|
1937
|
-
failed: "failed";
|
|
1938
|
-
}>>;
|
|
1939
|
-
error: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1940
|
-
latencyMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1941
|
-
promptTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1942
|
-
completionTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1943
|
-
totalTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1944
|
-
cost: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1945
|
-
}, z$1.core.$strip>;
|
|
1946
|
-
declare const getPlaygroundResultById: z$1.ZodObject<{
|
|
1947
|
-
resultId: z$1.ZodString;
|
|
1948
|
-
}, z$1.core.$strip>;
|
|
1949
|
-
declare const listPlaygroundResults: z$1.ZodObject<{
|
|
1950
|
-
runId: z$1.ZodString;
|
|
1951
|
-
columnId: z$1.ZodOptional<z$1.ZodString>;
|
|
1952
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1953
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1954
|
-
}, z$1.core.$strip>;
|
|
1955
|
-
declare const deletePlaygroundResultsByRunId: z$1.ZodObject<{
|
|
1956
|
-
runId: z$1.ZodString;
|
|
1957
|
-
}, z$1.core.$strip>;
|
|
1958
|
-
declare const createPlaygroundResultsDataLayer: (db: Kysely<Database>) => {
|
|
1959
|
-
createPlaygroundResult: (params: z$1.infer<typeof createPlaygroundResult>) => Promise<{
|
|
1960
|
-
error: string | null;
|
|
1961
|
-
id: string;
|
|
1962
|
-
createdAt: Date;
|
|
1963
|
-
updatedAt: Date;
|
|
1964
|
-
status: string;
|
|
1965
|
-
runId: string;
|
|
1966
|
-
columnId: string;
|
|
1967
|
-
datasetRecordId: string | null;
|
|
1968
|
-
inputVariables: Record<string, unknown>;
|
|
1969
|
-
outputContent: string | null;
|
|
1970
|
-
latencyMs: number | null;
|
|
1971
|
-
promptTokens: number | null;
|
|
1972
|
-
completionTokens: number | null;
|
|
1973
|
-
totalTokens: number | null;
|
|
1974
|
-
cost: number | null;
|
|
1975
|
-
} | undefined>;
|
|
1976
|
-
createPlaygroundResultsBatch: (params: z$1.infer<typeof createPlaygroundResultsBatch>) => Promise<{
|
|
1977
|
-
error: string | null;
|
|
1978
|
-
id: string;
|
|
1979
|
-
createdAt: Date;
|
|
1980
|
-
updatedAt: Date;
|
|
1981
|
-
status: string;
|
|
1982
|
-
runId: string;
|
|
1983
|
-
columnId: string;
|
|
1984
|
-
datasetRecordId: string | null;
|
|
1985
|
-
inputVariables: Record<string, unknown>;
|
|
1986
|
-
outputContent: string | null;
|
|
1987
|
-
latencyMs: number | null;
|
|
1988
|
-
promptTokens: number | null;
|
|
1989
|
-
completionTokens: number | null;
|
|
1990
|
-
totalTokens: number | null;
|
|
1991
|
-
cost: number | null;
|
|
1992
|
-
}[]>;
|
|
1993
|
-
updatePlaygroundResult: (params: z$1.infer<typeof updatePlaygroundResult>) => Promise<{
|
|
1994
|
-
error: string | null;
|
|
1995
|
-
id: string;
|
|
1996
|
-
createdAt: Date;
|
|
1997
|
-
updatedAt: Date;
|
|
1998
|
-
status: string;
|
|
1999
|
-
runId: string;
|
|
2000
|
-
columnId: string;
|
|
2001
|
-
datasetRecordId: string | null;
|
|
2002
|
-
inputVariables: Record<string, unknown>;
|
|
2003
|
-
outputContent: string | null;
|
|
2004
|
-
latencyMs: number | null;
|
|
2005
|
-
promptTokens: number | null;
|
|
2006
|
-
completionTokens: number | null;
|
|
2007
|
-
totalTokens: number | null;
|
|
2008
|
-
cost: number | null;
|
|
2009
|
-
} | undefined>;
|
|
2010
|
-
getPlaygroundResultById: (params: z$1.infer<typeof getPlaygroundResultById>) => Promise<{
|
|
2011
|
-
error: string | null;
|
|
2012
|
-
id: string;
|
|
2013
|
-
createdAt: Date;
|
|
2014
|
-
updatedAt: Date;
|
|
2015
|
-
status: string;
|
|
2016
|
-
runId: string;
|
|
2017
|
-
columnId: string;
|
|
2018
|
-
datasetRecordId: string | null;
|
|
2019
|
-
inputVariables: Record<string, unknown>;
|
|
2020
|
-
outputContent: string | null;
|
|
2021
|
-
latencyMs: number | null;
|
|
2022
|
-
promptTokens: number | null;
|
|
2023
|
-
completionTokens: number | null;
|
|
2024
|
-
totalTokens: number | null;
|
|
2025
|
-
cost: number | null;
|
|
2026
|
-
} | undefined>;
|
|
2027
|
-
listPlaygroundResults: (params: z$1.infer<typeof listPlaygroundResults>) => Promise<{
|
|
2028
|
-
error: string | null;
|
|
2029
|
-
id: string;
|
|
2030
|
-
createdAt: Date;
|
|
2031
|
-
updatedAt: Date;
|
|
2032
|
-
status: string;
|
|
2033
|
-
runId: string;
|
|
2034
|
-
columnId: string;
|
|
2035
|
-
datasetRecordId: string | null;
|
|
2036
|
-
inputVariables: Record<string, unknown>;
|
|
2037
|
-
outputContent: string | null;
|
|
2038
|
-
latencyMs: number | null;
|
|
2039
|
-
promptTokens: number | null;
|
|
2040
|
-
completionTokens: number | null;
|
|
2041
|
-
totalTokens: number | null;
|
|
2042
|
-
cost: number | null;
|
|
2043
|
-
}[]>;
|
|
2044
|
-
deletePlaygroundResultsByRunId: (params: z$1.infer<typeof deletePlaygroundResultsByRunId>) => Promise<{
|
|
2045
|
-
error: string | null;
|
|
2046
|
-
id: string;
|
|
2047
|
-
createdAt: Date;
|
|
2048
|
-
updatedAt: Date;
|
|
2049
|
-
status: string;
|
|
2050
|
-
runId: string;
|
|
2051
|
-
columnId: string;
|
|
2052
|
-
datasetRecordId: string | null;
|
|
2053
|
-
inputVariables: Record<string, unknown>;
|
|
2054
|
-
outputContent: string | null;
|
|
2055
|
-
latencyMs: number | null;
|
|
2056
|
-
promptTokens: number | null;
|
|
2057
|
-
completionTokens: number | null;
|
|
2058
|
-
totalTokens: number | null;
|
|
2059
|
-
cost: number | null;
|
|
2060
|
-
}[]>;
|
|
2061
|
-
countPlaygroundResults: (runId: string) => Promise<number>;
|
|
2062
|
-
countCompletedPlaygroundResults: (runId: string) => Promise<number>;
|
|
2063
|
-
};
|
|
2064
|
-
//#endregion
|
|
2065
|
-
//#region src/datalayer/playgroundRuns.d.ts
|
|
2066
|
-
declare const createPlaygroundRun: z$1.ZodObject<{
|
|
2067
|
-
playgroundId: z$1.ZodString;
|
|
2068
|
-
datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2069
|
-
datasetVersionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2070
|
-
status: z$1.ZodDefault<z$1.ZodEnum<{
|
|
2071
|
-
pending: "pending";
|
|
2072
|
-
running: "running";
|
|
2073
|
-
completed: "completed";
|
|
2074
|
-
failed: "failed";
|
|
2075
|
-
cancelled: "cancelled";
|
|
2076
|
-
}>>;
|
|
2077
|
-
totalRecords: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2078
|
-
}, z$1.core.$strip>;
|
|
2079
|
-
declare const updatePlaygroundRun: z$1.ZodObject<{
|
|
2080
|
-
runId: z$1.ZodString;
|
|
2081
|
-
status: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2082
|
-
pending: "pending";
|
|
2083
|
-
running: "running";
|
|
2084
|
-
completed: "completed";
|
|
2085
|
-
failed: "failed";
|
|
2086
|
-
cancelled: "cancelled";
|
|
2087
|
-
}>>;
|
|
2088
|
-
startedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
2089
|
-
completedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
2090
|
-
completedRecords: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2091
|
-
}, z$1.core.$strip>;
|
|
2092
|
-
declare const getPlaygroundRunById: z$1.ZodObject<{
|
|
2093
|
-
runId: z$1.ZodString;
|
|
2094
|
-
}, z$1.core.$strip>;
|
|
2095
|
-
declare const listPlaygroundRuns: z$1.ZodObject<{
|
|
2096
|
-
playgroundId: z$1.ZodString;
|
|
2097
|
-
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2098
|
-
offset: z$1.ZodOptional<z$1.ZodNumber>;
|
|
2099
|
-
}, z$1.core.$strip>;
|
|
2100
|
-
declare const deletePlaygroundRun: z$1.ZodObject<{
|
|
2101
|
-
runId: z$1.ZodString;
|
|
2102
|
-
}, z$1.core.$strip>;
|
|
2103
|
-
declare const createPlaygroundRunsDataLayer: (db: Kysely<Database>) => {
|
|
2104
|
-
createPlaygroundRun: (params: z$1.infer<typeof createPlaygroundRun>) => Promise<{
|
|
2105
|
-
id: string;
|
|
2106
|
-
createdAt: Date;
|
|
2107
|
-
updatedAt: Date;
|
|
2108
|
-
datasetId: string | null;
|
|
2109
|
-
playgroundId: string;
|
|
2110
|
-
datasetVersionId: string | null;
|
|
2111
|
-
status: string;
|
|
2112
|
-
startedAt: Date | null;
|
|
2113
|
-
completedAt: Date | null;
|
|
2114
|
-
totalRecords: number;
|
|
2115
|
-
completedRecords: number;
|
|
2116
|
-
} | undefined>;
|
|
2117
|
-
updatePlaygroundRun: (params: z$1.infer<typeof updatePlaygroundRun>) => Promise<{
|
|
2118
|
-
id: string;
|
|
2119
|
-
createdAt: Date;
|
|
2120
|
-
updatedAt: Date;
|
|
2121
|
-
datasetId: string | null;
|
|
2122
|
-
playgroundId: string;
|
|
2123
|
-
datasetVersionId: string | null;
|
|
2124
|
-
status: string;
|
|
2125
|
-
startedAt: Date | null;
|
|
2126
|
-
completedAt: Date | null;
|
|
2127
|
-
totalRecords: number;
|
|
2128
|
-
completedRecords: number;
|
|
2129
|
-
} | undefined>;
|
|
2130
|
-
getPlaygroundRunById: (params: z$1.infer<typeof getPlaygroundRunById>) => Promise<{
|
|
2131
|
-
id: string;
|
|
2132
|
-
createdAt: Date;
|
|
2133
|
-
updatedAt: Date;
|
|
2134
|
-
datasetId: string | null;
|
|
2135
|
-
playgroundId: string;
|
|
2136
|
-
datasetVersionId: string | null;
|
|
2137
|
-
status: string;
|
|
2138
|
-
startedAt: Date | null;
|
|
2139
|
-
completedAt: Date | null;
|
|
2140
|
-
totalRecords: number;
|
|
2141
|
-
completedRecords: number;
|
|
2142
|
-
} | undefined>;
|
|
2143
|
-
listPlaygroundRuns: (params: z$1.infer<typeof listPlaygroundRuns>) => Promise<{
|
|
2144
|
-
id: string;
|
|
2145
|
-
createdAt: Date;
|
|
2146
|
-
updatedAt: Date;
|
|
2147
|
-
datasetId: string | null;
|
|
2148
|
-
playgroundId: string;
|
|
2149
|
-
datasetVersionId: string | null;
|
|
2150
|
-
status: string;
|
|
2151
|
-
startedAt: Date | null;
|
|
2152
|
-
completedAt: Date | null;
|
|
2153
|
-
totalRecords: number;
|
|
2154
|
-
completedRecords: number;
|
|
2155
|
-
}[]>;
|
|
2156
|
-
deletePlaygroundRun: (params: z$1.infer<typeof deletePlaygroundRun>) => Promise<{
|
|
2157
|
-
id: string;
|
|
2158
|
-
createdAt: Date;
|
|
2159
|
-
updatedAt: Date;
|
|
2160
|
-
datasetId: string | null;
|
|
2161
|
-
playgroundId: string;
|
|
2162
|
-
datasetVersionId: string | null;
|
|
2163
|
-
status: string;
|
|
2164
|
-
startedAt: Date | null;
|
|
2165
|
-
completedAt: Date | null;
|
|
2166
|
-
totalRecords: number;
|
|
2167
|
-
completedRecords: number;
|
|
2168
|
-
} | undefined>;
|
|
2169
|
-
countPlaygroundRuns: (playgroundId: string) => Promise<number>;
|
|
2170
|
-
};
|
|
2171
|
-
//#endregion
|
|
2172
|
-
//#region src/datalayer/traces.d.ts
|
|
2173
|
-
/**
|
|
2174
|
-
* Schema for upserting a trace
|
|
2175
|
-
*/
|
|
2176
|
-
declare const upsertTraceSchema: z$1.ZodObject<{
|
|
2177
|
-
traceId: z$1.ZodString;
|
|
2178
|
-
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2179
|
-
sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2180
|
-
userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2181
|
-
status: z$1.ZodDefault<z$1.ZodEnum<{
|
|
2182
|
-
error: "error";
|
|
2183
|
-
unset: "unset";
|
|
2184
|
-
ok: "ok";
|
|
2185
|
-
}>>;
|
|
2186
|
-
startTime: z$1.ZodDate;
|
|
2187
|
-
endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
2188
|
-
durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
2189
|
-
spanCount: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2190
|
-
totalInputTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2191
|
-
totalOutputTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2192
|
-
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2193
|
-
totalCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2194
|
-
tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
2195
|
-
metadata: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
2196
|
-
}, z$1.core.$strip>;
|
|
2197
|
-
type TraceUpsert = z$1.infer<typeof upsertTraceSchema>;
|
|
2198
|
-
/**
|
|
2199
|
-
* Schema for inserting spans
|
|
2200
|
-
*/
|
|
2201
|
-
declare const insertSpanSchema: z$1.ZodObject<{
|
|
2202
|
-
traceId: z$1.ZodString;
|
|
2203
|
-
spanId: z$1.ZodString;
|
|
2204
|
-
parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2205
|
-
name: z$1.ZodString;
|
|
2206
|
-
kind: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2207
|
-
status: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2208
|
-
statusMessage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2209
|
-
startTime: z$1.ZodDate;
|
|
2210
|
-
endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
2211
|
-
durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
2212
|
-
provider: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2213
|
-
model: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2214
|
-
promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2215
|
-
completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2216
|
-
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2217
|
-
cost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2218
|
-
configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2219
|
-
variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2220
|
-
environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2221
|
-
providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2222
|
-
requestId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2223
|
-
source: z$1.ZodDefault<z$1.ZodEnum<{
|
|
2224
|
-
gateway: "gateway";
|
|
2225
|
-
otlp: "otlp";
|
|
2226
|
-
langsmith: "langsmith";
|
|
2227
|
-
}>>;
|
|
2228
|
-
input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
|
|
2229
|
-
output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
|
|
2230
|
-
attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
2231
|
-
}, z$1.core.$strip>;
|
|
2232
|
-
type SpanInsert = z$1.infer<typeof insertSpanSchema>;
|
|
2233
|
-
/**
|
|
2234
|
-
* Schema for inserting span events
|
|
2235
|
-
*/
|
|
2236
|
-
declare const insertSpanEventSchema: z$1.ZodObject<{
|
|
2237
|
-
traceId: z$1.ZodString;
|
|
2238
|
-
spanId: z$1.ZodString;
|
|
2239
|
-
name: z$1.ZodString;
|
|
2240
|
-
timestamp: z$1.ZodDate;
|
|
2241
|
-
attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
2242
|
-
}, z$1.core.$strip>;
|
|
2243
|
-
type SpanEventInsert = z$1.infer<typeof insertSpanEventSchema>;
|
|
2244
|
-
/**
|
|
2245
|
-
* Schema for listing traces
|
|
2246
|
-
*/
|
|
2247
|
-
declare const listTracesSchema: z$1.ZodObject<{
|
|
2248
|
-
limit: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2249
|
-
offset: z$1.ZodDefault<z$1.ZodNumber>;
|
|
2250
|
-
sessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
2251
|
-
userId: z$1.ZodOptional<z$1.ZodString>;
|
|
2252
|
-
status: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2253
|
-
error: "error";
|
|
2254
|
-
unset: "unset";
|
|
2255
|
-
ok: "ok";
|
|
2256
|
-
}>>;
|
|
2257
|
-
name: z$1.ZodOptional<z$1.ZodString>;
|
|
2258
|
-
startDate: z$1.ZodOptional<z$1.ZodDate>;
|
|
2259
|
-
endDate: z$1.ZodOptional<z$1.ZodDate>;
|
|
2260
|
-
tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
|
|
2261
|
-
}, z$1.core.$strip>;
|
|
2262
|
-
/**
|
|
2263
|
-
* Schema for trace stats query
|
|
2264
|
-
*/
|
|
2265
|
-
declare const traceStatsSchema: z$1.ZodObject<{
|
|
2266
|
-
startDate: z$1.ZodDate;
|
|
2267
|
-
endDate: z$1.ZodDate;
|
|
2268
|
-
sessionId: z$1.ZodOptional<z$1.ZodString>;
|
|
2269
|
-
userId: z$1.ZodOptional<z$1.ZodString>;
|
|
2270
|
-
}, z$1.core.$strip>;
|
|
2271
|
-
declare const createTracesDataLayer: (db: Kysely<Database>) => {
|
|
2272
|
-
/**
|
|
2273
|
-
* Upsert a trace — insert or update aggregates on conflict
|
|
2274
|
-
*/
|
|
2275
|
-
upsertTrace: (data: TraceUpsert) => Promise<void>;
|
|
2276
|
-
/**
|
|
2277
|
-
* Batch insert spans
|
|
2278
|
-
*/
|
|
2279
|
-
batchInsertSpans: (spans: SpanInsert[]) => Promise<{
|
|
2280
|
-
count: number;
|
|
2281
|
-
}>;
|
|
2282
|
-
/**
|
|
2283
|
-
* Batch insert span events
|
|
2284
|
-
*/
|
|
2285
|
-
batchInsertSpanEvents: (events: SpanEventInsert[]) => Promise<{
|
|
2286
|
-
count: number;
|
|
2287
|
-
}>;
|
|
2288
|
-
/**
|
|
2289
|
-
* List traces with filtering and pagination
|
|
2290
|
-
*/
|
|
2291
|
-
listTraces: (params?: z$1.infer<typeof listTracesSchema>) => Promise<{
|
|
2292
|
-
data: {
|
|
2293
|
-
name: string | null;
|
|
2294
|
-
id: string;
|
|
2295
|
-
createdAt: Date;
|
|
2296
|
-
updatedAt: Date;
|
|
2297
|
-
status: string;
|
|
2298
|
-
totalTokens: number;
|
|
2299
|
-
metadata: Record<string, unknown>;
|
|
2300
|
-
userId: string | null;
|
|
2301
|
-
tags: Record<string, string>;
|
|
2302
|
-
traceId: string;
|
|
2303
|
-
sessionId: string | null;
|
|
2304
|
-
startTime: Date;
|
|
2305
|
-
endTime: Date | null;
|
|
2306
|
-
durationMs: number | null;
|
|
2307
|
-
spanCount: number;
|
|
2308
|
-
totalInputTokens: number;
|
|
2309
|
-
totalOutputTokens: number;
|
|
2310
|
-
totalCost: number;
|
|
2311
|
-
}[];
|
|
2312
|
-
total: number;
|
|
2313
|
-
limit: number;
|
|
2314
|
-
offset: number;
|
|
2315
|
-
}>;
|
|
2316
|
-
/**
|
|
2317
|
-
* Get a single trace with all its spans and events
|
|
2318
|
-
*/
|
|
2319
|
-
getTraceWithSpans: (traceId: string) => Promise<{
|
|
2320
|
-
trace: {
|
|
2321
|
-
name: string | null;
|
|
2322
|
-
id: string;
|
|
2323
|
-
createdAt: Date;
|
|
2324
|
-
updatedAt: Date;
|
|
2325
|
-
status: string;
|
|
2326
|
-
totalTokens: number;
|
|
2327
|
-
metadata: Record<string, unknown>;
|
|
2328
|
-
userId: string | null;
|
|
2329
|
-
tags: Record<string, string>;
|
|
2330
|
-
traceId: string;
|
|
2331
|
-
sessionId: string | null;
|
|
2332
|
-
startTime: Date;
|
|
2333
|
-
endTime: Date | null;
|
|
2334
|
-
durationMs: number | null;
|
|
2335
|
-
spanCount: number;
|
|
2336
|
-
totalInputTokens: number;
|
|
2337
|
-
totalOutputTokens: number;
|
|
2338
|
-
totalCost: number;
|
|
2339
|
-
};
|
|
2340
|
-
spans: {
|
|
2341
|
-
name: string;
|
|
2342
|
-
id: string;
|
|
2343
|
-
createdAt: Date;
|
|
2344
|
-
updatedAt: Date;
|
|
2345
|
-
variantId: string | null;
|
|
2346
|
-
provider: string | null;
|
|
2347
|
-
input: unknown;
|
|
2348
|
-
output: unknown;
|
|
2349
|
-
environmentId: string | null;
|
|
2350
|
-
configId: string | null;
|
|
2351
|
-
providerConfigId: string | null;
|
|
2352
|
-
status: number;
|
|
2353
|
-
promptTokens: number;
|
|
2354
|
-
completionTokens: number;
|
|
2355
|
-
totalTokens: number;
|
|
2356
|
-
cost: number;
|
|
2357
|
-
requestId: string | null;
|
|
2358
|
-
model: string | null;
|
|
2359
|
-
traceId: string;
|
|
2360
|
-
spanId: string;
|
|
2361
|
-
parentSpanId: string | null;
|
|
2362
|
-
startTime: Date;
|
|
2363
|
-
endTime: Date | null;
|
|
2364
|
-
durationMs: number | null;
|
|
2365
|
-
kind: number;
|
|
2366
|
-
statusMessage: string | null;
|
|
2367
|
-
source: string;
|
|
2368
|
-
attributes: Record<string, unknown>;
|
|
2369
|
-
}[];
|
|
2370
|
-
events: {
|
|
2371
|
-
name: string;
|
|
2372
|
-
id: string;
|
|
2373
|
-
createdAt: Date;
|
|
2374
|
-
traceId: string;
|
|
2375
|
-
spanId: string;
|
|
2376
|
-
attributes: Record<string, unknown>;
|
|
2377
|
-
timestamp: Date;
|
|
2378
|
-
}[];
|
|
2379
|
-
} | undefined>;
|
|
2380
|
-
/**
|
|
2381
|
-
* Get aggregate trace statistics for a date range
|
|
2382
|
-
*/
|
|
2383
|
-
getTraceStats: (params: z$1.infer<typeof traceStatsSchema>) => Promise<{
|
|
2384
|
-
totalCost: number;
|
|
2385
|
-
totalTokens: number;
|
|
2386
|
-
totalTraces: number;
|
|
2387
|
-
avgDurationMs: number;
|
|
2388
|
-
errorCount: number;
|
|
2389
|
-
totalSpans: number;
|
|
2390
|
-
} | undefined>;
|
|
2391
|
-
};
|
|
2392
|
-
//#endregion
|
|
2393
|
-
//#region src/datalayer/workspaceSettings.d.ts
|
|
2394
|
-
declare const updateWorkspaceSettings: z$1.ZodObject<{
|
|
2395
|
-
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2396
|
-
setupComplete: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
2397
|
-
superAdminId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
2398
|
-
}, z$1.core.$strip>;
|
|
2399
|
-
declare const createWorkspaceSettingsDataLayer: (db: Kysely<Database>) => {
|
|
2400
|
-
/**
|
|
2401
|
-
* Get workspace settings (creates default if not exists)
|
|
2402
|
-
*/
|
|
2403
|
-
getWorkspaceSettings: () => Promise<{
|
|
2404
|
-
name: string | null;
|
|
2405
|
-
id: string;
|
|
2406
|
-
createdAt: Date;
|
|
2407
|
-
updatedAt: Date;
|
|
2408
|
-
setupComplete: boolean;
|
|
2409
|
-
superAdminId: string | null;
|
|
2410
|
-
} | undefined>;
|
|
2411
|
-
/**
|
|
2412
|
-
* Update workspace settings
|
|
2413
|
-
*/
|
|
2414
|
-
updateWorkspaceSettings: (params: z$1.infer<typeof updateWorkspaceSettings>) => Promise<{
|
|
2415
|
-
name: string | null;
|
|
2416
|
-
id: string;
|
|
2417
|
-
createdAt: Date;
|
|
2418
|
-
updatedAt: Date;
|
|
2419
|
-
setupComplete: boolean;
|
|
2420
|
-
superAdminId: string | null;
|
|
2421
|
-
} | undefined>;
|
|
2422
|
-
/**
|
|
2423
|
-
* Get the super admin user ID
|
|
2424
|
-
*/
|
|
2425
|
-
getSuperAdminId: () => Promise<string | null>;
|
|
2426
|
-
/**
|
|
2427
|
-
* Set the super admin user ID (only if not already set)
|
|
2428
|
-
*/
|
|
2429
|
-
setSuperAdminId: (userId: string) => Promise<boolean>;
|
|
2430
|
-
/**
|
|
2431
|
-
* Check if initial setup has been completed
|
|
2432
|
-
*/
|
|
2433
|
-
isSetupComplete: () => Promise<boolean>;
|
|
2434
|
-
/**
|
|
2435
|
-
* Mark initial setup as complete
|
|
2436
|
-
*/
|
|
2437
|
-
markSetupComplete: () => Promise<{
|
|
2438
|
-
name: string | null;
|
|
2439
|
-
id: string;
|
|
2440
|
-
createdAt: Date;
|
|
2441
|
-
updatedAt: Date;
|
|
2442
|
-
setupComplete: boolean;
|
|
2443
|
-
superAdminId: string | null;
|
|
2444
|
-
} | undefined>;
|
|
2445
|
-
};
|
|
2446
|
-
//#endregion
|
|
2447
|
-
//#region src/datalayer/interface.d.ts
|
|
2448
|
-
type DatasetsDataLayer = ReturnType<typeof createDatasetsDataLayer>;
|
|
2449
|
-
type LLMRequestsDataLayer = ReturnType<typeof createLLMRequestsDataLayer>;
|
|
2450
|
-
type PlaygroundsDataLayer = ReturnType<typeof createPlaygroundDataLayer>;
|
|
2451
|
-
type PlaygroundResultsDataLayer = ReturnType<typeof createPlaygroundResultsDataLayer>;
|
|
2452
|
-
type PlaygroundRunsDataLayer = ReturnType<typeof createPlaygroundRunsDataLayer>;
|
|
2453
|
-
type TracesDataLayer = ReturnType<typeof createTracesDataLayer>;
|
|
2454
|
-
type WorkspaceSettingsDataLayer = ReturnType<typeof createWorkspaceSettingsDataLayer>;
|
|
2455
|
-
type DataLayer = DatasetsDataLayer & LLMRequestsDataLayer & PlaygroundsDataLayer & PlaygroundResultsDataLayer & PlaygroundRunsDataLayer & TracesDataLayer & WorkspaceSettingsDataLayer;
|
|
2456
|
-
//#endregion
|
|
2457
|
-
//#region src/datalayer/create.d.ts
|
|
2458
|
-
/**
|
|
2459
|
-
* Create all datalayers from a Kysely database instance.
|
|
2460
|
-
* Returns a flat object with all datalayer methods spread together.
|
|
2461
|
-
*/
|
|
2462
|
-
declare function createDataLayer(db: Kysely<Database>): DataLayer;
|
|
2463
|
-
//#endregion
|
|
2464
1188
|
//#region src/pricing/types.d.ts
|
|
2465
1189
|
/**
|
|
2466
1190
|
* Pricing types for cost tracking
|
|
@@ -2666,26 +1390,229 @@ declare class LLMOpsPricingProvider implements PricingProvider {
|
|
|
2666
1390
|
*/
|
|
2667
1391
|
declare function getDefaultPricingProvider(): LLMOpsPricingProvider;
|
|
2668
1392
|
//#endregion
|
|
2669
|
-
//#region src/telemetry/interface.d.ts
|
|
2670
|
-
type LLMRequestsStore = ReturnType<typeof createLLMRequestsDataLayer>;
|
|
2671
|
-
type TracesStore = ReturnType<typeof createTracesDataLayer>;
|
|
2672
|
-
/**
|
|
2673
|
-
* TelemetryStore provides read + write access to telemetry data.
|
|
2674
|
-
* Implemented by pgStore (and future sqliteStore, etc.)
|
|
2675
|
-
*/
|
|
2676
|
-
type TelemetryStore = LLMRequestsStore & TracesStore;
|
|
2677
|
-
//#endregion
|
|
2678
1393
|
//#region src/telemetry/postgres.d.ts
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
1394
|
+
declare const insertLLMRequestSchema: z$1.ZodObject<{
|
|
1395
|
+
requestId: z$1.ZodString;
|
|
1396
|
+
configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1397
|
+
variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1398
|
+
environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1399
|
+
providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1400
|
+
provider: z$1.ZodString;
|
|
1401
|
+
model: z$1.ZodString;
|
|
1402
|
+
promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1403
|
+
completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1404
|
+
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1405
|
+
cachedTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1406
|
+
cacheCreationTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1407
|
+
cost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1408
|
+
cacheSavings: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1409
|
+
inputCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1410
|
+
outputCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1411
|
+
endpoint: z$1.ZodString;
|
|
1412
|
+
statusCode: z$1.ZodNumber;
|
|
1413
|
+
latencyMs: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1414
|
+
isStreaming: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1415
|
+
userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1416
|
+
tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
1417
|
+
guardrailResults: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
1418
|
+
results: z$1.ZodArray<z$1.ZodObject<{
|
|
1419
|
+
checkId: z$1.ZodString;
|
|
1420
|
+
functionId: z$1.ZodString;
|
|
1421
|
+
hookType: z$1.ZodEnum<{
|
|
1422
|
+
beforeRequestHook: "beforeRequestHook";
|
|
1423
|
+
afterRequestHook: "afterRequestHook";
|
|
1424
|
+
}>;
|
|
1425
|
+
verdict: z$1.ZodBoolean;
|
|
1426
|
+
latencyMs: z$1.ZodNumber;
|
|
1427
|
+
}, z$1.core.$strip>>;
|
|
1428
|
+
action: z$1.ZodEnum<{
|
|
1429
|
+
allowed: "allowed";
|
|
1430
|
+
blocked: "blocked";
|
|
1431
|
+
logged: "logged";
|
|
1432
|
+
}>;
|
|
1433
|
+
totalLatencyMs: z$1.ZodNumber;
|
|
1434
|
+
}, z$1.core.$strip>>>;
|
|
1435
|
+
traceId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1436
|
+
spanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1437
|
+
parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1438
|
+
sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1439
|
+
}, z$1.core.$strip>;
|
|
1440
|
+
type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
|
|
1441
|
+
declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
|
|
1442
|
+
type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
|
|
1443
|
+
declare const upsertTraceSchema: z$1.ZodObject<{
|
|
1444
|
+
traceId: z$1.ZodString;
|
|
1445
|
+
name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1446
|
+
sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1447
|
+
userId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1448
|
+
status: z$1.ZodDefault<z$1.ZodEnum<{
|
|
1449
|
+
error: "error";
|
|
1450
|
+
unset: "unset";
|
|
1451
|
+
ok: "ok";
|
|
1452
|
+
}>>;
|
|
1453
|
+
startTime: z$1.ZodDate;
|
|
1454
|
+
endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
1455
|
+
durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1456
|
+
spanCount: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1457
|
+
totalInputTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1458
|
+
totalOutputTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1459
|
+
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1460
|
+
totalCost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1461
|
+
tags: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
1462
|
+
metadata: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1463
|
+
}, z$1.core.$strip>;
|
|
1464
|
+
type TraceUpsert = z$1.infer<typeof upsertTraceSchema>;
|
|
1465
|
+
declare const insertSpanSchema: z$1.ZodObject<{
|
|
1466
|
+
traceId: z$1.ZodString;
|
|
1467
|
+
spanId: z$1.ZodString;
|
|
1468
|
+
parentSpanId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1469
|
+
name: z$1.ZodString;
|
|
1470
|
+
kind: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1471
|
+
status: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1472
|
+
statusMessage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1473
|
+
startTime: z$1.ZodDate;
|
|
1474
|
+
endTime: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
1475
|
+
durationMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
|
|
1476
|
+
provider: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1477
|
+
model: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1478
|
+
promptTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1479
|
+
completionTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1480
|
+
totalTokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1481
|
+
cost: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1482
|
+
configId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1483
|
+
variantId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1484
|
+
environmentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1485
|
+
providerConfigId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1486
|
+
requestId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1487
|
+
source: z$1.ZodDefault<z$1.ZodEnum<{
|
|
1488
|
+
gateway: "gateway";
|
|
1489
|
+
otlp: "otlp";
|
|
1490
|
+
langsmith: "langsmith";
|
|
1491
|
+
}>>;
|
|
1492
|
+
input: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
|
|
1493
|
+
output: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnknown>>;
|
|
1494
|
+
attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1495
|
+
}, z$1.core.$strip>;
|
|
1496
|
+
type SpanInsert = z$1.infer<typeof insertSpanSchema>;
|
|
1497
|
+
declare const insertSpanEventSchema: z$1.ZodObject<{
|
|
1498
|
+
traceId: z$1.ZodString;
|
|
1499
|
+
spanId: z$1.ZodString;
|
|
1500
|
+
name: z$1.ZodString;
|
|
1501
|
+
timestamp: z$1.ZodDate;
|
|
1502
|
+
attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
|
|
1503
|
+
}, z$1.core.$strip>;
|
|
1504
|
+
type SpanEventInsert = z$1.infer<typeof insertSpanEventSchema>;
|
|
1505
|
+
declare function createLLMRequestsStore(pool: any): {
|
|
1506
|
+
batchInsertRequests: (requests: LLMRequestInsert[]) => Promise<{
|
|
1507
|
+
count: number;
|
|
1508
|
+
}>;
|
|
1509
|
+
insertRequest: (request: LLMRequestInsert) => Promise<any>;
|
|
1510
|
+
listRequests: (params?: {
|
|
1511
|
+
limit?: number;
|
|
1512
|
+
offset?: number;
|
|
1513
|
+
configId?: string;
|
|
1514
|
+
variantId?: string;
|
|
1515
|
+
environmentId?: string;
|
|
1516
|
+
providerConfigId?: string;
|
|
1517
|
+
provider?: string;
|
|
1518
|
+
model?: string;
|
|
1519
|
+
startDate?: Date;
|
|
1520
|
+
endDate?: Date;
|
|
1521
|
+
tags?: Record<string, string[]>;
|
|
1522
|
+
}) => Promise<{
|
|
1523
|
+
data: any;
|
|
1524
|
+
total: any;
|
|
1525
|
+
limit: number;
|
|
1526
|
+
offset: number;
|
|
1527
|
+
}>;
|
|
1528
|
+
getRequestByRequestId: (requestId: string) => Promise<any>;
|
|
1529
|
+
getTotalCost: (params: {
|
|
1530
|
+
startDate: Date;
|
|
1531
|
+
endDate: Date;
|
|
1532
|
+
configId?: string;
|
|
1533
|
+
variantId?: string;
|
|
1534
|
+
environmentId?: string;
|
|
1535
|
+
tags?: Record<string, string[]>;
|
|
1536
|
+
}) => Promise<any>;
|
|
1537
|
+
getCostByModel: (params: {
|
|
1538
|
+
startDate: Date;
|
|
1539
|
+
endDate: Date;
|
|
1540
|
+
}) => Promise<any>;
|
|
1541
|
+
getCostByProvider: (params: {
|
|
1542
|
+
startDate: Date;
|
|
1543
|
+
endDate: Date;
|
|
1544
|
+
}) => Promise<any>;
|
|
1545
|
+
getDailyCosts: (params: {
|
|
1546
|
+
startDate: Date;
|
|
1547
|
+
endDate: Date;
|
|
1548
|
+
}) => Promise<any>;
|
|
1549
|
+
getCostSummary: (params: {
|
|
1550
|
+
startDate: Date;
|
|
1551
|
+
endDate: Date;
|
|
1552
|
+
configId?: string;
|
|
1553
|
+
variantId?: string;
|
|
1554
|
+
environmentId?: string;
|
|
1555
|
+
groupBy?: CostSummaryGroupBy;
|
|
1556
|
+
tags?: Record<string, string[]>;
|
|
1557
|
+
tagKeys?: string[];
|
|
1558
|
+
}) => Promise<any>;
|
|
1559
|
+
getRequestStats: (params: {
|
|
1560
|
+
startDate: Date;
|
|
1561
|
+
endDate: Date;
|
|
1562
|
+
configId?: string;
|
|
1563
|
+
variantId?: string;
|
|
1564
|
+
environmentId?: string;
|
|
1565
|
+
tags?: Record<string, string[]>;
|
|
1566
|
+
}) => Promise<any>;
|
|
1567
|
+
getDistinctTags: () => Promise<any>;
|
|
1568
|
+
};
|
|
1569
|
+
declare function createTracesStore(pool: any): {
|
|
1570
|
+
upsertTrace: (data: TraceUpsert) => Promise<void>;
|
|
1571
|
+
batchInsertSpans: (spans: SpanInsert[]) => Promise<{
|
|
1572
|
+
count: number;
|
|
1573
|
+
}>;
|
|
1574
|
+
batchInsertSpanEvents: (events: SpanEventInsert[]) => Promise<{
|
|
1575
|
+
count: number;
|
|
1576
|
+
}>;
|
|
1577
|
+
listTraces: (params?: {
|
|
1578
|
+
limit?: number;
|
|
1579
|
+
offset?: number;
|
|
1580
|
+
sessionId?: string;
|
|
1581
|
+
userId?: string;
|
|
1582
|
+
status?: string;
|
|
1583
|
+
name?: string;
|
|
1584
|
+
startDate?: Date;
|
|
1585
|
+
endDate?: Date;
|
|
1586
|
+
tags?: Record<string, string[]>;
|
|
1587
|
+
}) => Promise<{
|
|
1588
|
+
data: any;
|
|
1589
|
+
total: any;
|
|
1590
|
+
limit: number;
|
|
1591
|
+
offset: number;
|
|
1592
|
+
}>;
|
|
1593
|
+
getTraceWithSpans: (traceId: string) => Promise<{
|
|
1594
|
+
trace: any;
|
|
1595
|
+
spans: any;
|
|
1596
|
+
events: any;
|
|
1597
|
+
} | undefined>;
|
|
1598
|
+
getTraceStats: (params: {
|
|
1599
|
+
startDate: Date;
|
|
1600
|
+
endDate: Date;
|
|
1601
|
+
sessionId?: string;
|
|
1602
|
+
userId?: string;
|
|
1603
|
+
}) => Promise<any>;
|
|
1604
|
+
};
|
|
1605
|
+
type PgStore = ReturnType<typeof createLLMRequestsStore> & ReturnType<typeof createTracesStore> & {
|
|
1606
|
+
_pool: unknown;
|
|
1607
|
+
_schema: string;
|
|
2682
1608
|
};
|
|
2683
1609
|
/**
|
|
2684
1610
|
* Create a PostgreSQL-backed telemetry store.
|
|
2685
1611
|
*
|
|
2686
1612
|
* Usage:
|
|
2687
1613
|
* ```ts
|
|
2688
|
-
* import { llmops
|
|
1614
|
+
* import { llmops } from '@llmops/sdk'
|
|
1615
|
+
* import { pgStore } from '@llmops/sdk/store/pg'
|
|
2689
1616
|
*
|
|
2690
1617
|
* const ops = llmops({
|
|
2691
1618
|
* telemetry: pgStore(process.env.DATABASE_URL),
|
|
@@ -2696,4 +1623,11 @@ declare function createPgStore(connectionString: string, options?: {
|
|
|
2696
1623
|
schema?: string;
|
|
2697
1624
|
}): PgStore;
|
|
2698
1625
|
//#endregion
|
|
2699
|
-
|
|
1626
|
+
//#region src/telemetry/interface.d.ts
|
|
1627
|
+
/**
|
|
1628
|
+
* TelemetryStore provides read + write access to telemetry data.
|
|
1629
|
+
* Implemented by pgStore (and future sqliteStore, etc.)
|
|
1630
|
+
*/
|
|
1631
|
+
type TelemetryStore = Omit<PgStore, '_pool' | '_schema'>;
|
|
1632
|
+
//#endregion
|
|
1633
|
+
export { type AnthropicProviderConfig, type AnyProviderConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, COST_SUMMARY_GROUP_BY, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, type CortexProviderConfig, CostResult, CostSummaryGroupBy, DEFAULT_PROVIDER_ENV_VARS, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, LLMOPS_INTERNAL_HEADER, LLMOPS_REQUEST_ID_HEADER, LLMOPS_SESSION_ID_HEADER, LLMOPS_SPAN_ID_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER, LLMOPS_USER_ID_HEADER, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMOpsPricingProvider, LLMRequestInsert, MS, MemoryCacheBackend, MemoryCacheConfig, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, PgStore, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, type SagemakerProviderConfig, SpanEventInsert, SpanInsert, type StabilityAIProviderConfig, SupportedProviders, TelemetryStore, TraceUpsert, UsageData, type ValidatedLLMOpsConfig, VariantJsonData, type VertexAIProviderConfig, type WorkersAIProviderConfig, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, createPgStore, dollarsToMicroDollars, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, llmopsConfigSchema, logger, mergeWithDefaultProviders, microDollarsToDollars, validateLLMOpsConfig, variantJsonDataSchema };
|