@llmops/core 1.0.0-beta.3 → 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.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,725 +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/playgrounds.d.ts
1386
- declare const createNewPlayground: z$1.ZodObject<{
1387
- name: z$1.ZodString;
1388
- datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1389
- columns: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
1390
- id: z$1.ZodString;
1391
- name: z$1.ZodString;
1392
- position: z$1.ZodNumber;
1393
- providerConfigId: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
1394
- providerSlug: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1395
- modelName: z$1.ZodString;
1396
- messages: z$1.ZodArray<z$1.ZodObject<{
1397
- role: z$1.ZodEnum<{
1398
- system: "system";
1399
- user: "user";
1400
- assistant: "assistant";
1401
- }>;
1402
- content: z$1.ZodString;
1403
- }, z$1.core.$strip>>;
1404
- temperature: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1405
- maxTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1406
- topP: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1407
- frequencyPenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1408
- presencePenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1409
- }, z$1.core.$strip>>>>;
1410
- }, z$1.core.$strip>;
1411
- declare const updatePlayground: z$1.ZodObject<{
1412
- playgroundId: z$1.ZodUUID;
1413
- name: z$1.ZodOptional<z$1.ZodString>;
1414
- datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1415
- columns: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodArray<z$1.ZodObject<{
1416
- id: z$1.ZodString;
1417
- name: z$1.ZodString;
1418
- position: z$1.ZodNumber;
1419
- providerConfigId: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
1420
- providerSlug: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1421
- modelName: z$1.ZodString;
1422
- messages: z$1.ZodArray<z$1.ZodObject<{
1423
- role: z$1.ZodEnum<{
1424
- system: "system";
1425
- user: "user";
1426
- assistant: "assistant";
1427
- }>;
1428
- content: z$1.ZodString;
1429
- }, z$1.core.$strip>>;
1430
- temperature: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1431
- maxTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1432
- topP: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1433
- frequencyPenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1434
- presencePenalty: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1435
- }, z$1.core.$strip>>>>;
1436
- }, z$1.core.$strip>;
1437
- declare const getPlaygroundById: z$1.ZodObject<{
1438
- playgroundId: z$1.ZodUUID;
1439
- }, z$1.core.$strip>;
1440
- declare const deletePlayground: z$1.ZodObject<{
1441
- playgroundId: z$1.ZodUUID;
1442
- }, z$1.core.$strip>;
1443
- declare const listPlaygrounds: z$1.ZodObject<{
1444
- limit: z$1.ZodOptional<z$1.ZodNumber>;
1445
- offset: z$1.ZodOptional<z$1.ZodNumber>;
1446
- }, z$1.core.$strip>;
1447
- declare const createPlaygroundDataLayer: (db: Kysely<Database>) => {
1448
- createNewPlayground: (params: z$1.infer<typeof createNewPlayground>) => Promise<{
1449
- name: string;
1450
- id: string;
1451
- createdAt: Date;
1452
- updatedAt: Date;
1453
- datasetId: string | null;
1454
- columns: {
1455
- id: string;
1456
- name: string;
1457
- position: number;
1458
- modelName: string;
1459
- messages: {
1460
- role: "system" | "user" | "assistant";
1461
- content: string;
1462
- }[];
1463
- providerConfigId?: string | null | undefined;
1464
- providerSlug?: string | null | undefined;
1465
- temperature?: number | null | undefined;
1466
- maxTokens?: number | null | undefined;
1467
- topP?: number | null | undefined;
1468
- frequencyPenalty?: number | null | undefined;
1469
- presencePenalty?: number | null | undefined;
1470
- }[] | null;
1471
- } | undefined>;
1472
- updatePlayground: (params: z$1.infer<typeof updatePlayground>) => Promise<{
1473
- name: string;
1474
- id: string;
1475
- createdAt: Date;
1476
- updatedAt: Date;
1477
- datasetId: string | null;
1478
- columns: {
1479
- id: string;
1480
- name: string;
1481
- position: number;
1482
- modelName: string;
1483
- messages: {
1484
- role: "system" | "user" | "assistant";
1485
- content: string;
1486
- }[];
1487
- providerConfigId?: string | null | undefined;
1488
- providerSlug?: string | null | undefined;
1489
- temperature?: number | null | undefined;
1490
- maxTokens?: number | null | undefined;
1491
- topP?: number | null | undefined;
1492
- frequencyPenalty?: number | null | undefined;
1493
- presencePenalty?: number | null | undefined;
1494
- }[] | null;
1495
- } | undefined>;
1496
- getPlaygroundById: (params: z$1.infer<typeof getPlaygroundById>) => Promise<{
1497
- name: string;
1498
- id: string;
1499
- createdAt: Date;
1500
- updatedAt: Date;
1501
- datasetId: string | null;
1502
- columns: {
1503
- id: string;
1504
- name: string;
1505
- position: number;
1506
- modelName: string;
1507
- messages: {
1508
- role: "system" | "user" | "assistant";
1509
- content: string;
1510
- }[];
1511
- providerConfigId?: string | null | undefined;
1512
- providerSlug?: string | null | undefined;
1513
- temperature?: number | null | undefined;
1514
- maxTokens?: number | null | undefined;
1515
- topP?: number | null | undefined;
1516
- frequencyPenalty?: number | null | undefined;
1517
- presencePenalty?: number | null | undefined;
1518
- }[] | null;
1519
- } | undefined>;
1520
- deletePlayground: (params: z$1.infer<typeof deletePlayground>) => Promise<{
1521
- name: string;
1522
- id: string;
1523
- createdAt: Date;
1524
- updatedAt: Date;
1525
- datasetId: string | null;
1526
- columns: {
1527
- id: string;
1528
- name: string;
1529
- position: number;
1530
- modelName: string;
1531
- messages: {
1532
- role: "system" | "user" | "assistant";
1533
- content: string;
1534
- }[];
1535
- providerConfigId?: string | null | undefined;
1536
- providerSlug?: string | null | undefined;
1537
- temperature?: number | null | undefined;
1538
- maxTokens?: number | null | undefined;
1539
- topP?: number | null | undefined;
1540
- frequencyPenalty?: number | null | undefined;
1541
- presencePenalty?: number | null | undefined;
1542
- }[] | null;
1543
- } | undefined>;
1544
- listPlaygrounds: (params?: z$1.infer<typeof listPlaygrounds>) => Promise<{
1545
- name: string;
1546
- id: string;
1547
- createdAt: Date;
1548
- updatedAt: Date;
1549
- datasetId: string | null;
1550
- columns: {
1551
- id: string;
1552
- name: string;
1553
- position: number;
1554
- modelName: string;
1555
- messages: {
1556
- role: "system" | "user" | "assistant";
1557
- content: string;
1558
- }[];
1559
- providerConfigId?: string | null | undefined;
1560
- providerSlug?: string | null | undefined;
1561
- temperature?: number | null | undefined;
1562
- maxTokens?: number | null | undefined;
1563
- topP?: number | null | undefined;
1564
- frequencyPenalty?: number | null | undefined;
1565
- presencePenalty?: number | null | undefined;
1566
- }[] | null;
1567
- }[]>;
1568
- countPlaygrounds: () => Promise<number>;
1569
- };
1570
- //#endregion
1571
- //#region src/datalayer/playgroundResults.d.ts
1572
- declare const createPlaygroundResult: z$1.ZodObject<{
1573
- runId: z$1.ZodString;
1574
- columnId: z$1.ZodString;
1575
- datasetRecordId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1576
- inputVariables: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1577
- status: z$1.ZodDefault<z$1.ZodEnum<{
1578
- pending: "pending";
1579
- running: "running";
1580
- completed: "completed";
1581
- failed: "failed";
1582
- }>>;
1583
- }, z$1.core.$strip>;
1584
- declare const createPlaygroundResultsBatch: z$1.ZodObject<{
1585
- results: z$1.ZodArray<z$1.ZodObject<{
1586
- runId: z$1.ZodString;
1587
- columnId: z$1.ZodString;
1588
- datasetRecordId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1589
- inputVariables: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1590
- status: z$1.ZodDefault<z$1.ZodEnum<{
1591
- pending: "pending";
1592
- running: "running";
1593
- completed: "completed";
1594
- failed: "failed";
1595
- }>>;
1596
- }, z$1.core.$strip>>;
1597
- }, z$1.core.$strip>;
1598
- declare const updatePlaygroundResult: z$1.ZodObject<{
1599
- resultId: z$1.ZodString;
1600
- outputContent: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1601
- status: z$1.ZodOptional<z$1.ZodEnum<{
1602
- pending: "pending";
1603
- running: "running";
1604
- completed: "completed";
1605
- failed: "failed";
1606
- }>>;
1607
- error: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1608
- latencyMs: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1609
- promptTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1610
- completionTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1611
- totalTokens: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1612
- cost: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodNumber>>;
1613
- }, z$1.core.$strip>;
1614
- declare const getPlaygroundResultById: z$1.ZodObject<{
1615
- resultId: z$1.ZodString;
1616
- }, z$1.core.$strip>;
1617
- declare const listPlaygroundResults: z$1.ZodObject<{
1618
- runId: z$1.ZodString;
1619
- columnId: z$1.ZodOptional<z$1.ZodString>;
1620
- limit: z$1.ZodOptional<z$1.ZodNumber>;
1621
- offset: z$1.ZodOptional<z$1.ZodNumber>;
1622
- }, z$1.core.$strip>;
1623
- declare const deletePlaygroundResultsByRunId: z$1.ZodObject<{
1624
- runId: z$1.ZodString;
1625
- }, z$1.core.$strip>;
1626
- declare const createPlaygroundResultsDataLayer: (db: Kysely<Database>) => {
1627
- createPlaygroundResult: (params: z$1.infer<typeof createPlaygroundResult>) => Promise<{
1628
- error: string | null;
1629
- id: string;
1630
- createdAt: Date;
1631
- updatedAt: Date;
1632
- status: string;
1633
- runId: string;
1634
- columnId: string;
1635
- datasetRecordId: string | null;
1636
- inputVariables: Record<string, unknown>;
1637
- outputContent: string | null;
1638
- latencyMs: number | null;
1639
- promptTokens: number | null;
1640
- completionTokens: number | null;
1641
- totalTokens: number | null;
1642
- cost: number | null;
1643
- } | undefined>;
1644
- createPlaygroundResultsBatch: (params: z$1.infer<typeof createPlaygroundResultsBatch>) => Promise<{
1645
- error: string | null;
1646
- id: string;
1647
- createdAt: Date;
1648
- updatedAt: Date;
1649
- status: string;
1650
- runId: string;
1651
- columnId: string;
1652
- datasetRecordId: string | null;
1653
- inputVariables: Record<string, unknown>;
1654
- outputContent: string | null;
1655
- latencyMs: number | null;
1656
- promptTokens: number | null;
1657
- completionTokens: number | null;
1658
- totalTokens: number | null;
1659
- cost: number | null;
1660
- }[]>;
1661
- updatePlaygroundResult: (params: z$1.infer<typeof updatePlaygroundResult>) => Promise<{
1662
- error: string | null;
1663
- id: string;
1664
- createdAt: Date;
1665
- updatedAt: Date;
1666
- status: string;
1667
- runId: string;
1668
- columnId: string;
1669
- datasetRecordId: string | null;
1670
- inputVariables: Record<string, unknown>;
1671
- outputContent: string | null;
1672
- latencyMs: number | null;
1673
- promptTokens: number | null;
1674
- completionTokens: number | null;
1675
- totalTokens: number | null;
1676
- cost: number | null;
1677
- } | undefined>;
1678
- getPlaygroundResultById: (params: z$1.infer<typeof getPlaygroundResultById>) => Promise<{
1679
- error: string | null;
1680
- id: string;
1681
- createdAt: Date;
1682
- updatedAt: Date;
1683
- status: string;
1684
- runId: string;
1685
- columnId: string;
1686
- datasetRecordId: string | null;
1687
- inputVariables: Record<string, unknown>;
1688
- outputContent: string | null;
1689
- latencyMs: number | null;
1690
- promptTokens: number | null;
1691
- completionTokens: number | null;
1692
- totalTokens: number | null;
1693
- cost: number | null;
1694
- } | undefined>;
1695
- listPlaygroundResults: (params: z$1.infer<typeof listPlaygroundResults>) => Promise<{
1696
- error: string | null;
1697
- id: string;
1698
- createdAt: Date;
1699
- updatedAt: Date;
1700
- status: string;
1701
- runId: string;
1702
- columnId: string;
1703
- datasetRecordId: string | null;
1704
- inputVariables: Record<string, unknown>;
1705
- outputContent: string | null;
1706
- latencyMs: number | null;
1707
- promptTokens: number | null;
1708
- completionTokens: number | null;
1709
- totalTokens: number | null;
1710
- cost: number | null;
1711
- }[]>;
1712
- deletePlaygroundResultsByRunId: (params: z$1.infer<typeof deletePlaygroundResultsByRunId>) => Promise<{
1713
- error: string | null;
1714
- id: string;
1715
- createdAt: Date;
1716
- updatedAt: Date;
1717
- status: string;
1718
- runId: string;
1719
- columnId: string;
1720
- datasetRecordId: string | null;
1721
- inputVariables: Record<string, unknown>;
1722
- outputContent: string | null;
1723
- latencyMs: number | null;
1724
- promptTokens: number | null;
1725
- completionTokens: number | null;
1726
- totalTokens: number | null;
1727
- cost: number | null;
1728
- }[]>;
1729
- countPlaygroundResults: (runId: string) => Promise<number>;
1730
- countCompletedPlaygroundResults: (runId: string) => Promise<number>;
1731
- };
1732
- //#endregion
1733
- //#region src/datalayer/playgroundRuns.d.ts
1734
- declare const createPlaygroundRun: z$1.ZodObject<{
1735
- playgroundId: z$1.ZodString;
1736
- datasetId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1737
- datasetVersionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1738
- status: z$1.ZodDefault<z$1.ZodEnum<{
1739
- pending: "pending";
1740
- running: "running";
1741
- completed: "completed";
1742
- failed: "failed";
1743
- cancelled: "cancelled";
1744
- }>>;
1745
- totalRecords: z$1.ZodDefault<z$1.ZodNumber>;
1746
- }, z$1.core.$strip>;
1747
- declare const updatePlaygroundRun: z$1.ZodObject<{
1748
- runId: z$1.ZodString;
1749
- status: z$1.ZodOptional<z$1.ZodEnum<{
1750
- pending: "pending";
1751
- running: "running";
1752
- completed: "completed";
1753
- failed: "failed";
1754
- cancelled: "cancelled";
1755
- }>>;
1756
- startedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1757
- completedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
1758
- completedRecords: z$1.ZodOptional<z$1.ZodNumber>;
1759
- }, z$1.core.$strip>;
1760
- declare const getPlaygroundRunById: z$1.ZodObject<{
1761
- runId: z$1.ZodString;
1762
- }, z$1.core.$strip>;
1763
- declare const listPlaygroundRuns: z$1.ZodObject<{
1764
- playgroundId: z$1.ZodString;
1765
- limit: z$1.ZodOptional<z$1.ZodNumber>;
1766
- offset: z$1.ZodOptional<z$1.ZodNumber>;
1767
- }, z$1.core.$strip>;
1768
- declare const deletePlaygroundRun: z$1.ZodObject<{
1769
- runId: z$1.ZodString;
1770
- }, z$1.core.$strip>;
1771
- declare const createPlaygroundRunsDataLayer: (db: Kysely<Database>) => {
1772
- createPlaygroundRun: (params: z$1.infer<typeof createPlaygroundRun>) => Promise<{
1773
- id: string;
1774
- createdAt: Date;
1775
- updatedAt: Date;
1776
- datasetId: string | null;
1777
- playgroundId: string;
1778
- datasetVersionId: string | null;
1779
- status: string;
1780
- startedAt: Date | null;
1781
- completedAt: Date | null;
1782
- totalRecords: number;
1783
- completedRecords: number;
1784
- } | undefined>;
1785
- updatePlaygroundRun: (params: z$1.infer<typeof updatePlaygroundRun>) => Promise<{
1786
- id: string;
1787
- createdAt: Date;
1788
- updatedAt: Date;
1789
- datasetId: string | null;
1790
- playgroundId: string;
1791
- datasetVersionId: string | null;
1792
- status: string;
1793
- startedAt: Date | null;
1794
- completedAt: Date | null;
1795
- totalRecords: number;
1796
- completedRecords: number;
1797
- } | undefined>;
1798
- getPlaygroundRunById: (params: z$1.infer<typeof getPlaygroundRunById>) => Promise<{
1799
- id: string;
1800
- createdAt: Date;
1801
- updatedAt: Date;
1802
- datasetId: string | null;
1803
- playgroundId: string;
1804
- datasetVersionId: string | null;
1805
- status: string;
1806
- startedAt: Date | null;
1807
- completedAt: Date | null;
1808
- totalRecords: number;
1809
- completedRecords: number;
1810
- } | undefined>;
1811
- listPlaygroundRuns: (params: z$1.infer<typeof listPlaygroundRuns>) => Promise<{
1812
- id: string;
1813
- createdAt: Date;
1814
- updatedAt: Date;
1815
- datasetId: string | null;
1816
- playgroundId: string;
1817
- datasetVersionId: string | null;
1818
- status: string;
1819
- startedAt: Date | null;
1820
- completedAt: Date | null;
1821
- totalRecords: number;
1822
- completedRecords: number;
1823
- }[]>;
1824
- deletePlaygroundRun: (params: z$1.infer<typeof deletePlaygroundRun>) => Promise<{
1825
- id: string;
1826
- createdAt: Date;
1827
- updatedAt: Date;
1828
- datasetId: string | null;
1829
- playgroundId: string;
1830
- datasetVersionId: string | null;
1831
- status: string;
1832
- startedAt: Date | null;
1833
- completedAt: Date | null;
1834
- totalRecords: number;
1835
- completedRecords: number;
1836
- } | undefined>;
1837
- countPlaygroundRuns: (playgroundId: string) => Promise<number>;
1838
- };
1839
- //#endregion
1840
- //#region src/datalayer/workspaceSettings.d.ts
1841
- declare const updateWorkspaceSettings: z$1.ZodObject<{
1842
- name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1843
- setupComplete: z$1.ZodOptional<z$1.ZodBoolean>;
1844
- superAdminId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1845
- }, z$1.core.$strip>;
1846
- declare const createWorkspaceSettingsDataLayer: (db: Kysely<Database>) => {
1847
- /**
1848
- * Get workspace settings (creates default if not exists)
1849
- */
1850
- getWorkspaceSettings: () => Promise<{
1851
- name: string | null;
1852
- id: string;
1853
- createdAt: Date;
1854
- updatedAt: Date;
1855
- setupComplete: boolean;
1856
- superAdminId: string | null;
1857
- } | undefined>;
1858
- /**
1859
- * Update workspace settings
1860
- */
1861
- updateWorkspaceSettings: (params: z$1.infer<typeof updateWorkspaceSettings>) => Promise<{
1862
- name: string | null;
1863
- id: string;
1864
- createdAt: Date;
1865
- updatedAt: Date;
1866
- setupComplete: boolean;
1867
- superAdminId: string | null;
1868
- } | undefined>;
1869
- /**
1870
- * Get the super admin user ID
1871
- */
1872
- getSuperAdminId: () => Promise<string | null>;
1873
- /**
1874
- * Set the super admin user ID (only if not already set)
1875
- */
1876
- setSuperAdminId: (userId: string) => Promise<boolean>;
1877
- /**
1878
- * Check if initial setup has been completed
1879
- */
1880
- isSetupComplete: () => Promise<boolean>;
1881
- /**
1882
- * Mark initial setup as complete
1883
- */
1884
- markSetupComplete: () => Promise<{
1885
- name: string | null;
1886
- id: string;
1887
- createdAt: Date;
1888
- updatedAt: Date;
1889
- setupComplete: boolean;
1890
- superAdminId: string | null;
1891
- } | undefined>;
1892
- };
1893
- //#endregion
1894
- //#region src/datalayer/interface.d.ts
1895
- type DatasetsDataLayer = ReturnType<typeof createDatasetsDataLayer>;
1896
- type PlaygroundsDataLayer = ReturnType<typeof createPlaygroundDataLayer>;
1897
- type PlaygroundResultsDataLayer = ReturnType<typeof createPlaygroundResultsDataLayer>;
1898
- type PlaygroundRunsDataLayer = ReturnType<typeof createPlaygroundRunsDataLayer>;
1899
- type WorkspaceSettingsDataLayer = ReturnType<typeof createWorkspaceSettingsDataLayer>;
1900
- type DataLayer = DatasetsDataLayer & PlaygroundsDataLayer & PlaygroundResultsDataLayer & PlaygroundRunsDataLayer & WorkspaceSettingsDataLayer;
1901
- //#endregion
1902
- //#region src/datalayer/create.d.ts
1903
- /**
1904
- * Create all datalayers from a Kysely database instance.
1905
- * Returns a flat object with all datalayer methods spread together.
1906
- */
1907
- declare function createDataLayer(db: Kysely<Database>): DataLayer;
1908
- //#endregion
1909
1188
  //#region src/pricing/types.d.ts
1910
1189
  /**
1911
1190
  * Pricing types for cost tracking
@@ -2159,46 +1438,8 @@ declare const insertLLMRequestSchema: z$1.ZodObject<{
2159
1438
  sessionId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
2160
1439
  }, z$1.core.$strip>;
2161
1440
  type LLMRequestInsert = z$1.infer<typeof insertLLMRequestSchema>;
2162
- declare const listRequestsSchema: z$1.ZodObject<{
2163
- limit: z$1.ZodDefault<z$1.ZodNumber>;
2164
- offset: z$1.ZodDefault<z$1.ZodNumber>;
2165
- configId: z$1.ZodOptional<z$1.ZodString>;
2166
- variantId: z$1.ZodOptional<z$1.ZodString>;
2167
- environmentId: z$1.ZodOptional<z$1.ZodString>;
2168
- providerConfigId: z$1.ZodOptional<z$1.ZodString>;
2169
- provider: z$1.ZodOptional<z$1.ZodString>;
2170
- model: z$1.ZodOptional<z$1.ZodString>;
2171
- startDate: z$1.ZodOptional<z$1.ZodDate>;
2172
- endDate: z$1.ZodOptional<z$1.ZodDate>;
2173
- tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
2174
- }, z$1.core.$strip>;
2175
- declare const dateRangeSchema: z$1.ZodObject<{
2176
- startDate: z$1.ZodDate;
2177
- endDate: z$1.ZodDate;
2178
- configId: z$1.ZodOptional<z$1.ZodString>;
2179
- variantId: z$1.ZodOptional<z$1.ZodString>;
2180
- environmentId: z$1.ZodOptional<z$1.ZodString>;
2181
- tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
2182
- }, z$1.core.$strip>;
2183
1441
  declare const COST_SUMMARY_GROUP_BY: readonly ["day", "hour", "model", "provider", "endpoint", "tags"];
2184
1442
  type CostSummaryGroupBy = (typeof COST_SUMMARY_GROUP_BY)[number];
2185
- declare const costSummarySchema: z$1.ZodObject<{
2186
- startDate: z$1.ZodDate;
2187
- endDate: z$1.ZodDate;
2188
- configId: z$1.ZodOptional<z$1.ZodString>;
2189
- variantId: z$1.ZodOptional<z$1.ZodString>;
2190
- environmentId: z$1.ZodOptional<z$1.ZodString>;
2191
- tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
2192
- groupBy: z$1.ZodOptional<z$1.ZodEnum<{
2193
- provider: "provider";
2194
- model: "model";
2195
- endpoint: "endpoint";
2196
- tags: "tags";
2197
- day: "day";
2198
- hour: "hour";
2199
- }>>;
2200
- tagKeys: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
2201
- }, z$1.core.$strip>;
2202
1443
  declare const upsertTraceSchema: z$1.ZodObject<{
2203
1444
  traceId: z$1.ZodString;
2204
1445
  name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
@@ -2261,220 +1502,71 @@ declare const insertSpanEventSchema: z$1.ZodObject<{
2261
1502
  attributes: z$1.ZodDefault<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
2262
1503
  }, z$1.core.$strip>;
2263
1504
  type SpanEventInsert = z$1.infer<typeof insertSpanEventSchema>;
2264
- declare const listTracesSchema: z$1.ZodObject<{
2265
- limit: z$1.ZodDefault<z$1.ZodNumber>;
2266
- offset: z$1.ZodDefault<z$1.ZodNumber>;
2267
- sessionId: z$1.ZodOptional<z$1.ZodString>;
2268
- userId: z$1.ZodOptional<z$1.ZodString>;
2269
- status: z$1.ZodOptional<z$1.ZodEnum<{
2270
- error: "error";
2271
- unset: "unset";
2272
- ok: "ok";
2273
- }>>;
2274
- name: z$1.ZodOptional<z$1.ZodString>;
2275
- startDate: z$1.ZodOptional<z$1.ZodDate>;
2276
- endDate: z$1.ZodOptional<z$1.ZodDate>;
2277
- tags: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodArray<z$1.ZodString>>>;
2278
- }, z$1.core.$strip>;
2279
- declare const traceStatsSchema: z$1.ZodObject<{
2280
- startDate: z$1.ZodDate;
2281
- endDate: z$1.ZodDate;
2282
- sessionId: z$1.ZodOptional<z$1.ZodString>;
2283
- userId: z$1.ZodOptional<z$1.ZodString>;
2284
- }, z$1.core.$strip>;
2285
- declare function createLLMRequestsStore(db: Kysely<Database>): {
1505
+ declare function createLLMRequestsStore(pool: any): {
2286
1506
  batchInsertRequests: (requests: LLMRequestInsert[]) => Promise<{
2287
1507
  count: number;
2288
1508
  }>;
2289
- insertRequest: (request: LLMRequestInsert) => Promise<{
2290
- id: string;
2291
- createdAt: Date;
2292
- updatedAt: Date;
2293
- variantId: string | null;
2294
- provider: string;
2295
- environmentId: string | null;
2296
- configId: string | null;
2297
- providerConfigId: string | null;
2298
- latencyMs: number;
2299
- promptTokens: number;
2300
- completionTokens: number;
2301
- totalTokens: number;
2302
- cost: number;
2303
- requestId: string;
2304
- model: string;
2305
- cachedTokens: number;
2306
- cacheCreationTokens: number;
2307
- cacheSavings: number;
2308
- inputCost: number;
2309
- outputCost: number;
2310
- endpoint: string;
2311
- statusCode: number;
2312
- isStreaming: boolean;
2313
- userId: string | null;
2314
- tags: Record<string, string>;
2315
- guardrailResults: {
2316
- results: {
2317
- checkId: string;
2318
- functionId: string;
2319
- hookType: "beforeRequestHook" | "afterRequestHook";
2320
- verdict: boolean;
2321
- latencyMs: number;
2322
- }[];
2323
- action: "allowed" | "blocked" | "logged";
2324
- totalLatencyMs: number;
2325
- } | null;
2326
- traceId: string | null;
2327
- spanId: string | null;
2328
- parentSpanId: string | null;
2329
- sessionId: string | null;
2330
- } | undefined>;
2331
- listRequests: (params?: z$1.infer<typeof listRequestsSchema>) => Promise<{
2332
- data: {
2333
- id: string;
2334
- createdAt: Date;
2335
- updatedAt: Date;
2336
- variantId: string | null;
2337
- provider: string;
2338
- environmentId: string | null;
2339
- configId: string | null;
2340
- providerConfigId: string | null;
2341
- latencyMs: number;
2342
- promptTokens: number;
2343
- completionTokens: number;
2344
- totalTokens: number;
2345
- cost: number;
2346
- requestId: string;
2347
- model: string;
2348
- cachedTokens: number;
2349
- cacheCreationTokens: number;
2350
- cacheSavings: number;
2351
- inputCost: number;
2352
- outputCost: number;
2353
- endpoint: string;
2354
- statusCode: number;
2355
- isStreaming: boolean;
2356
- userId: string | null;
2357
- tags: Record<string, string>;
2358
- guardrailResults: {
2359
- results: {
2360
- checkId: string;
2361
- functionId: string;
2362
- hookType: "beforeRequestHook" | "afterRequestHook";
2363
- verdict: boolean;
2364
- latencyMs: number;
2365
- }[];
2366
- action: "allowed" | "blocked" | "logged";
2367
- totalLatencyMs: number;
2368
- } | null;
2369
- traceId: string | null;
2370
- spanId: string | null;
2371
- parentSpanId: string | null;
2372
- sessionId: string | null;
2373
- }[];
2374
- total: number;
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;
2375
1525
  limit: number;
2376
1526
  offset: number;
2377
1527
  }>;
2378
- getRequestByRequestId: (requestId: string) => Promise<{
2379
- id: string;
2380
- createdAt: Date;
2381
- updatedAt: Date;
2382
- variantId: string | null;
2383
- provider: string;
2384
- environmentId: string | null;
2385
- configId: string | null;
2386
- providerConfigId: string | null;
2387
- latencyMs: number;
2388
- promptTokens: number;
2389
- completionTokens: number;
2390
- totalTokens: number;
2391
- cost: number;
2392
- requestId: string;
2393
- model: string;
2394
- cachedTokens: number;
2395
- cacheCreationTokens: number;
2396
- cacheSavings: number;
2397
- inputCost: number;
2398
- outputCost: number;
2399
- endpoint: string;
2400
- statusCode: number;
2401
- isStreaming: boolean;
2402
- userId: string | null;
2403
- tags: Record<string, string>;
2404
- guardrailResults: {
2405
- results: {
2406
- checkId: string;
2407
- functionId: string;
2408
- hookType: "beforeRequestHook" | "afterRequestHook";
2409
- verdict: boolean;
2410
- latencyMs: number;
2411
- }[];
2412
- action: "allowed" | "blocked" | "logged";
2413
- totalLatencyMs: number;
2414
- } | null;
2415
- traceId: string | null;
2416
- spanId: string | null;
2417
- parentSpanId: string | null;
2418
- sessionId: string | null;
2419
- } | undefined>;
2420
- getTotalCost: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
2421
- totalCost: number;
2422
- totalInputCost: number;
2423
- totalOutputCost: number;
2424
- totalPromptTokens: number;
2425
- totalCompletionTokens: number;
2426
- totalTokens: number;
2427
- totalCachedTokens: number;
2428
- totalCacheSavings: number;
2429
- requestCount: number;
2430
- } | undefined>;
2431
- getCostByModel: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
2432
- provider: string;
2433
- model: string;
2434
- totalCost: number;
2435
- totalInputCost: number;
2436
- totalOutputCost: number;
2437
- totalTokens: number;
2438
- requestCount: number;
2439
- avgLatencyMs: number;
2440
- }[]>;
2441
- getCostByProvider: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
2442
- provider: string;
2443
- totalCost: number;
2444
- totalInputCost: number;
2445
- totalOutputCost: number;
2446
- totalTokens: number;
2447
- requestCount: number;
2448
- avgLatencyMs: number;
2449
- }[]>;
2450
- getDailyCosts: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
2451
- totalCost: number;
2452
- totalInputCost: number;
2453
- totalOutputCost: number;
2454
- totalTokens: number;
2455
- requestCount: number;
2456
- date: string;
2457
- }[]>;
2458
- getCostSummary: (params: z$1.infer<typeof costSummarySchema>) => Promise<{
2459
- totalCost: number;
2460
- requestCount: number;
2461
- groupKey: string;
2462
- }[]>;
2463
- getRequestStats: (params: z$1.infer<typeof dateRangeSchema>) => Promise<{
2464
- avgLatencyMs: number;
2465
- totalRequests: number;
2466
- successfulRequests: number;
2467
- failedRequests: number;
2468
- streamingRequests: number;
2469
- maxLatencyMs: number;
2470
- minLatencyMs: number;
2471
- } | undefined>;
2472
- getDistinctTags: () => Promise<{
2473
- key: string;
2474
- value: string;
2475
- }[]>;
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>;
2476
1568
  };
2477
- declare function createTracesStore(db: Kysely<Database>): {
1569
+ declare function createTracesStore(pool: any): {
2478
1570
  upsertTrace: (data: TraceUpsert) => Promise<void>;
2479
1571
  batchInsertSpans: (spans: SpanInsert[]) => Promise<{
2480
1572
  count: number;
@@ -2482,103 +1574,37 @@ declare function createTracesStore(db: Kysely<Database>): {
2482
1574
  batchInsertSpanEvents: (events: SpanEventInsert[]) => Promise<{
2483
1575
  count: number;
2484
1576
  }>;
2485
- listTraces: (params?: z$1.infer<typeof listTracesSchema>) => Promise<{
2486
- data: {
2487
- name: string | null;
2488
- id: string;
2489
- createdAt: Date;
2490
- updatedAt: Date;
2491
- status: string;
2492
- totalTokens: number;
2493
- metadata: Record<string, unknown>;
2494
- userId: string | null;
2495
- tags: Record<string, string>;
2496
- traceId: string;
2497
- sessionId: string | null;
2498
- startTime: Date;
2499
- endTime: Date | null;
2500
- durationMs: number | null;
2501
- spanCount: number;
2502
- totalInputTokens: number;
2503
- totalOutputTokens: number;
2504
- totalCost: number;
2505
- }[];
2506
- total: number;
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;
2507
1590
  limit: number;
2508
1591
  offset: number;
2509
1592
  }>;
2510
1593
  getTraceWithSpans: (traceId: string) => Promise<{
2511
- trace: {
2512
- name: string | null;
2513
- id: string;
2514
- createdAt: Date;
2515
- updatedAt: Date;
2516
- status: string;
2517
- totalTokens: number;
2518
- metadata: Record<string, unknown>;
2519
- userId: string | null;
2520
- tags: Record<string, string>;
2521
- traceId: string;
2522
- sessionId: string | null;
2523
- startTime: Date;
2524
- endTime: Date | null;
2525
- durationMs: number | null;
2526
- spanCount: number;
2527
- totalInputTokens: number;
2528
- totalOutputTokens: number;
2529
- totalCost: number;
2530
- };
2531
- spans: {
2532
- name: string;
2533
- id: string;
2534
- createdAt: Date;
2535
- updatedAt: Date;
2536
- variantId: string | null;
2537
- provider: string | null;
2538
- input: unknown;
2539
- output: unknown;
2540
- environmentId: string | null;
2541
- configId: string | null;
2542
- providerConfigId: string | null;
2543
- status: number;
2544
- promptTokens: number;
2545
- completionTokens: number;
2546
- totalTokens: number;
2547
- cost: number;
2548
- requestId: string | null;
2549
- model: string | null;
2550
- traceId: string;
2551
- spanId: string;
2552
- parentSpanId: string | null;
2553
- startTime: Date;
2554
- endTime: Date | null;
2555
- durationMs: number | null;
2556
- kind: number;
2557
- statusMessage: string | null;
2558
- source: string;
2559
- attributes: Record<string, unknown>;
2560
- }[];
2561
- events: {
2562
- name: string;
2563
- id: string;
2564
- createdAt: Date;
2565
- traceId: string;
2566
- spanId: string;
2567
- attributes: Record<string, unknown>;
2568
- timestamp: Date;
2569
- }[];
2570
- } | undefined>;
2571
- getTraceStats: (params: z$1.infer<typeof traceStatsSchema>) => Promise<{
2572
- totalCost: number;
2573
- totalTokens: number;
2574
- totalTraces: number;
2575
- avgDurationMs: number;
2576
- errorCount: number;
2577
- totalSpans: number;
1594
+ trace: any;
1595
+ spans: any;
1596
+ events: any;
2578
1597
  } | undefined>;
1598
+ getTraceStats: (params: {
1599
+ startDate: Date;
1600
+ endDate: Date;
1601
+ sessionId?: string;
1602
+ userId?: string;
1603
+ }) => Promise<any>;
2579
1604
  };
2580
1605
  type PgStore = ReturnType<typeof createLLMRequestsStore> & ReturnType<typeof createTracesStore> & {
2581
- _db: Kysely<Database>;
1606
+ _pool: unknown;
1607
+ _schema: string;
2582
1608
  };
2583
1609
  /**
2584
1610
  * Create a PostgreSQL-backed telemetry store.
@@ -2602,6 +1628,6 @@ declare function createPgStore(connectionString: string, options?: {
2602
1628
  * TelemetryStore provides read + write access to telemetry data.
2603
1629
  * Implemented by pgStore (and future sqliteStore, etc.)
2604
1630
  */
2605
- type TelemetryStore = Omit<PgStore, '_db'>;
1631
+ type TelemetryStore = Omit<PgStore, '_pool' | '_schema'>;
2606
1632
  //#endregion
2607
- 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 Config, type ConfigVariant, type ConfigVariantsTable, type ConfigsTable, type CortexProviderConfig, CostResult, type CostSummaryGroupBy, DEFAULT_PROVIDER_ENV_VARS, type DataLayer, type Database, DatabaseConnection, DatabaseOptions, DatabaseType, type Dataset, type DatasetRecord, DatasetRecordsTable, type DatasetVersion, type DatasetVersionRecord, DatasetVersionRecordsTable, DatasetVersionsTable, type DatasetsDataLayer, DatasetsTable, type Environment, type EnvironmentSecret, type EnvironmentSecretsTable, type EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type GuardrailConfig, GuardrailConfigsTable, type GuardrailResult, type GuardrailResults, type HuggingFaceProviderConfig, type InlineProviderConfig, type InlineProvidersConfig, Insertable, 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, type LLMRequest, type LLMRequestInsert, LLMRequestsTable, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, ModelPricing, type OpenAIProviderConfig, type OracleProviderConfig, type PgStore, type Playground, type PlaygroundColumn, type PlaygroundResult, type PlaygroundResultsDataLayer, PlaygroundResultsTable, type PlaygroundRun, type PlaygroundRunsDataLayer, PlaygroundRunsTable, type PlaygroundsDataLayer, PlaygroundsTable, Prettify, PricingProvider, type ProviderConfig, type ProviderConfigMap, ProviderConfigsTable, type ProviderGuardrailOverride, ProviderGuardrailOverridesTable, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, Span, SpanEvent, type SpanEventInsert, SpanEventsTable, type SpanInsert, SpansTable, type StabilityAIProviderConfig, SupportedProviders, type TableName, type TargetingRule, type TargetingRulesTable, type TelemetryStore, Trace, type TraceUpsert, TracesTable, Updateable, UsageData, type ValidatedLLMOpsConfig, type Variant, VariantJsonData, type VariantVersion, VariantVersionsTable, type VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, type WorkspaceSettings, type WorkspaceSettingsDataLayer, WorkspaceSettingsTable, calculateCacheAwareCost, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createDatasetsDataLayer, createNeonDialect, createPgStore, createPlaygroundDataLayer, createPlaygroundResultsDataLayer, createPlaygroundRunsDataLayer, createWorkspaceSettingsDataLayer, datasetRecordsSchema, datasetVersionRecordsSchema, datasetVersionsSchema, datasetsSchema, detectDatabaseType, dollarsToMicroDollars, environmentSecretsSchema, environmentsSchema, executeWithSchema, formatCost, gateway, generateId, getDefaultPricingProvider, getDefaultProviders, getMigrations, guardrailConfigsSchema, llmRequestsSchema, llmopsConfigSchema, logger, matchType, mergeWithDefaultProviders, microDollarsToDollars, parsePartialTableData, parseTableData, playgroundColumnSchema, playgroundResultsSchema, playgroundRunsSchema, playgroundsSchema, providerConfigsSchema, providerGuardrailOverridesSchema, runAutoMigrations, schemas, spanEventsSchema, spansSchema, targetingRulesSchema, tracesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
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 };