braintrust 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/dist/index.d.mts +21 -2
- package/dev/dist/index.d.ts +21 -2
- package/dev/dist/index.js +385 -123
- package/dev/dist/index.mjs +1291 -1029
- package/dist/browser.d.mts +23 -2
- package/dist/browser.d.ts +23 -2
- package/dist/browser.js +204 -110
- package/dist/browser.mjs +1079 -985
- package/dist/cli.js +1336 -1073
- package/dist/index.d.mts +86 -4
- package/dist/index.d.ts +86 -4
- package/dist/index.js +580 -186
- package/dist/index.mjs +1436 -1042
- package/package.json +4 -3
- package/util/dist/index.d.mts +66 -3
- package/util/dist/index.d.ts +66 -3
- package/util/dist/index.js +229 -17
- package/util/dist/index.mjs +230 -18
package/dev/dist/index.mjs
CHANGED
|
@@ -245,7 +245,7 @@ function getCallerLocation() {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// src/logger.ts
|
|
248
|
-
import { v4 as
|
|
248
|
+
import { v4 as uuidv42 } from "uuid";
|
|
249
249
|
|
|
250
250
|
// src/queue.ts
|
|
251
251
|
var DEFAULT_QUEUE_SIZE = 15e3;
|
|
@@ -303,6 +303,44 @@ var Queue = class {
|
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
|
|
306
|
+
// src/id-gen.ts
|
|
307
|
+
import { v4 as uuidv4 } from "uuid";
|
|
308
|
+
function generateHexId(bytes) {
|
|
309
|
+
let result = "";
|
|
310
|
+
for (let i = 0; i < bytes; i++) {
|
|
311
|
+
result += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
|
|
312
|
+
}
|
|
313
|
+
return result;
|
|
314
|
+
}
|
|
315
|
+
var IDGenerator = class {
|
|
316
|
+
};
|
|
317
|
+
var UUIDGenerator = class extends IDGenerator {
|
|
318
|
+
getSpanId() {
|
|
319
|
+
return uuidv4();
|
|
320
|
+
}
|
|
321
|
+
getTraceId() {
|
|
322
|
+
return uuidv4();
|
|
323
|
+
}
|
|
324
|
+
shareRootSpanId() {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
var OTELIDGenerator = class extends IDGenerator {
|
|
329
|
+
getSpanId() {
|
|
330
|
+
return generateHexId(8);
|
|
331
|
+
}
|
|
332
|
+
getTraceId() {
|
|
333
|
+
return generateHexId(16);
|
|
334
|
+
}
|
|
335
|
+
shareRootSpanId() {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
function getIdGenerator() {
|
|
340
|
+
const useOtel = typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true";
|
|
341
|
+
return useOtel ? new OTELIDGenerator() : new UUIDGenerator();
|
|
342
|
+
}
|
|
343
|
+
|
|
306
344
|
// util/db_fields.ts
|
|
307
345
|
var TRANSACTION_ID_FIELD = "_xact_id";
|
|
308
346
|
var IS_MERGE_FIELD = "_is_merge";
|
|
@@ -908,22 +946,6 @@ var SpanComponentsV3 = class _SpanComponentsV3 {
|
|
|
908
946
|
return new _SpanComponentsV3(spanComponentsV3Schema.parse(jsonObj));
|
|
909
947
|
}
|
|
910
948
|
};
|
|
911
|
-
function parseParent(parent) {
|
|
912
|
-
return typeof parent === "string" ? parent : parent ? new SpanComponentsV3({
|
|
913
|
-
object_type: parent.object_type === "experiment" ? 1 /* EXPERIMENT */ : parent.object_type === "playground_logs" ? 3 /* PLAYGROUND_LOGS */ : 2 /* PROJECT_LOGS */,
|
|
914
|
-
object_id: parent.object_id,
|
|
915
|
-
...parent.row_ids ? {
|
|
916
|
-
row_id: parent.row_ids.id,
|
|
917
|
-
span_id: parent.row_ids.span_id,
|
|
918
|
-
root_span_id: parent.row_ids.root_span_id
|
|
919
|
-
} : {
|
|
920
|
-
row_id: void 0,
|
|
921
|
-
span_id: void 0,
|
|
922
|
-
root_span_id: void 0
|
|
923
|
-
},
|
|
924
|
-
propagated_event: parent.propagated_event
|
|
925
|
-
}).toStr() : void 0;
|
|
926
|
-
}
|
|
927
949
|
|
|
928
950
|
// util/http_headers.ts
|
|
929
951
|
var BT_FOUND_EXISTING_HEADER = "x-bt-found-existing";
|
|
@@ -1270,6 +1292,232 @@ function _urljoin(...parts) {
|
|
|
1270
1292
|
).filter((x) => x.trim() !== "").join("/");
|
|
1271
1293
|
}
|
|
1272
1294
|
|
|
1295
|
+
// util/span_identifier_v4.ts
|
|
1296
|
+
import { z as z4 } from "zod/v3";
|
|
1297
|
+
var ENCODING_VERSION_NUMBER_V4 = 4;
|
|
1298
|
+
function tryMakeHexTraceId(s) {
|
|
1299
|
+
try {
|
|
1300
|
+
if (typeof s === "string" && s.length === 32) {
|
|
1301
|
+
const bytes = new Uint8Array(16);
|
|
1302
|
+
for (let i = 0; i < 16; i++) {
|
|
1303
|
+
const hex = s.substr(i * 2, 2);
|
|
1304
|
+
const byte = parseInt(hex, 16);
|
|
1305
|
+
if (isNaN(byte)) throw new Error();
|
|
1306
|
+
bytes[i] = byte;
|
|
1307
|
+
}
|
|
1308
|
+
return { bytes, isHex: true };
|
|
1309
|
+
}
|
|
1310
|
+
} catch {
|
|
1311
|
+
}
|
|
1312
|
+
return { bytes: void 0, isHex: false };
|
|
1313
|
+
}
|
|
1314
|
+
function tryMakeHexSpanId(s) {
|
|
1315
|
+
try {
|
|
1316
|
+
if (typeof s === "string" && s.length === 16) {
|
|
1317
|
+
const bytes = new Uint8Array(8);
|
|
1318
|
+
for (let i = 0; i < 8; i++) {
|
|
1319
|
+
const hex = s.substr(i * 2, 2);
|
|
1320
|
+
const byte = parseInt(hex, 16);
|
|
1321
|
+
if (isNaN(byte)) throw new Error();
|
|
1322
|
+
bytes[i] = byte;
|
|
1323
|
+
}
|
|
1324
|
+
return { bytes, isHex: true };
|
|
1325
|
+
}
|
|
1326
|
+
} catch {
|
|
1327
|
+
}
|
|
1328
|
+
return { bytes: void 0, isHex: false };
|
|
1329
|
+
}
|
|
1330
|
+
var INVALID_ENCODING_ERRMSG_V4 = `SpanComponents string is not properly encoded. This library only supports encoding versions up to ${ENCODING_VERSION_NUMBER_V4}. Please make sure the SDK library used to decode the SpanComponents is at least as new as any library used to encode it.`;
|
|
1331
|
+
var FIELDS_ID_TO_NAME = {
|
|
1332
|
+
[1 /* OBJECT_ID */]: "object_id",
|
|
1333
|
+
[2 /* ROW_ID */]: "row_id",
|
|
1334
|
+
[3 /* SPAN_ID */]: "span_id",
|
|
1335
|
+
[4 /* ROOT_SPAN_ID */]: "root_span_id"
|
|
1336
|
+
};
|
|
1337
|
+
var spanComponentsV4Schema = z4.object({
|
|
1338
|
+
object_type: spanObjectTypeV3EnumSchema,
|
|
1339
|
+
propagated_event: z4.record(z4.unknown()).nullish()
|
|
1340
|
+
}).and(
|
|
1341
|
+
z4.union([
|
|
1342
|
+
// Must provide one or the other.
|
|
1343
|
+
z4.object({
|
|
1344
|
+
object_id: z4.string().nullish(),
|
|
1345
|
+
compute_object_metadata_args: z4.optional(z4.null())
|
|
1346
|
+
}),
|
|
1347
|
+
z4.object({
|
|
1348
|
+
object_id: z4.optional(z4.null()),
|
|
1349
|
+
compute_object_metadata_args: z4.record(z4.unknown())
|
|
1350
|
+
})
|
|
1351
|
+
])
|
|
1352
|
+
).and(
|
|
1353
|
+
z4.union([
|
|
1354
|
+
// Either all of these must be provided or none.
|
|
1355
|
+
z4.object({
|
|
1356
|
+
row_id: z4.string(),
|
|
1357
|
+
span_id: z4.string(),
|
|
1358
|
+
root_span_id: z4.string()
|
|
1359
|
+
}),
|
|
1360
|
+
z4.object({
|
|
1361
|
+
row_id: z4.optional(z4.null()),
|
|
1362
|
+
span_id: z4.optional(z4.null()),
|
|
1363
|
+
root_span_id: z4.optional(z4.null())
|
|
1364
|
+
})
|
|
1365
|
+
])
|
|
1366
|
+
);
|
|
1367
|
+
var SpanComponentsV4 = class _SpanComponentsV4 {
|
|
1368
|
+
constructor(data) {
|
|
1369
|
+
this.data = data;
|
|
1370
|
+
}
|
|
1371
|
+
toStr() {
|
|
1372
|
+
const jsonObj = {
|
|
1373
|
+
compute_object_metadata_args: this.data.compute_object_metadata_args || void 0,
|
|
1374
|
+
propagated_event: this.data.propagated_event || void 0
|
|
1375
|
+
};
|
|
1376
|
+
Object.keys(jsonObj).forEach((key) => {
|
|
1377
|
+
if (jsonObj[key] === void 0) {
|
|
1378
|
+
delete jsonObj[key];
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
const allBuffers = [];
|
|
1382
|
+
allBuffers.push(
|
|
1383
|
+
new Uint8Array([ENCODING_VERSION_NUMBER_V4, this.data.object_type])
|
|
1384
|
+
);
|
|
1385
|
+
const hexEntries = [];
|
|
1386
|
+
function addHexField(origVal, fieldId) {
|
|
1387
|
+
let hexResult;
|
|
1388
|
+
if (fieldId === 3 /* SPAN_ID */) {
|
|
1389
|
+
hexResult = tryMakeHexSpanId(origVal);
|
|
1390
|
+
} else if (fieldId === 4 /* ROOT_SPAN_ID */) {
|
|
1391
|
+
hexResult = tryMakeHexTraceId(origVal);
|
|
1392
|
+
} else {
|
|
1393
|
+
hexResult = { bytes: void 0, isHex: false };
|
|
1394
|
+
}
|
|
1395
|
+
if (hexResult.isHex) {
|
|
1396
|
+
hexEntries.push(
|
|
1397
|
+
concatUint8Arrays(new Uint8Array([fieldId]), hexResult.bytes)
|
|
1398
|
+
);
|
|
1399
|
+
} else {
|
|
1400
|
+
jsonObj[FIELDS_ID_TO_NAME[fieldId]] = origVal;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
if (this.data.object_id) {
|
|
1404
|
+
addHexField(this.data.object_id, 1 /* OBJECT_ID */);
|
|
1405
|
+
}
|
|
1406
|
+
if (this.data.row_id) {
|
|
1407
|
+
addHexField(this.data.row_id, 2 /* ROW_ID */);
|
|
1408
|
+
}
|
|
1409
|
+
if (this.data.span_id) {
|
|
1410
|
+
addHexField(this.data.span_id, 3 /* SPAN_ID */);
|
|
1411
|
+
}
|
|
1412
|
+
if (this.data.root_span_id) {
|
|
1413
|
+
addHexField(this.data.root_span_id, 4 /* ROOT_SPAN_ID */);
|
|
1414
|
+
}
|
|
1415
|
+
if (hexEntries.length > 255) {
|
|
1416
|
+
throw new Error("Impossible: too many hex entries to encode");
|
|
1417
|
+
}
|
|
1418
|
+
allBuffers.push(new Uint8Array([hexEntries.length]));
|
|
1419
|
+
allBuffers.push(...hexEntries);
|
|
1420
|
+
if (Object.keys(jsonObj).length > 0) {
|
|
1421
|
+
allBuffers.push(stringToUint8Array(JSON.stringify(jsonObj)));
|
|
1422
|
+
}
|
|
1423
|
+
return uint8ArrayToBase64(concatUint8Arrays(...allBuffers));
|
|
1424
|
+
}
|
|
1425
|
+
static fromStr(s) {
|
|
1426
|
+
try {
|
|
1427
|
+
const rawBytes = base64ToUint8Array(s);
|
|
1428
|
+
const jsonObj = {};
|
|
1429
|
+
if (rawBytes[0] < ENCODING_VERSION_NUMBER_V4) {
|
|
1430
|
+
const v3Components = SpanComponentsV3.fromStr(s);
|
|
1431
|
+
jsonObj["object_type"] = v3Components.data.object_type;
|
|
1432
|
+
jsonObj["object_id"] = v3Components.data.object_id;
|
|
1433
|
+
jsonObj["compute_object_metadata_args"] = v3Components.data.compute_object_metadata_args;
|
|
1434
|
+
jsonObj["row_id"] = v3Components.data.row_id;
|
|
1435
|
+
jsonObj["span_id"] = v3Components.data.span_id;
|
|
1436
|
+
jsonObj["root_span_id"] = v3Components.data.root_span_id;
|
|
1437
|
+
jsonObj["propagated_event"] = v3Components.data.propagated_event;
|
|
1438
|
+
} else {
|
|
1439
|
+
jsonObj["object_type"] = rawBytes[1];
|
|
1440
|
+
const numHexEntries = rawBytes[2];
|
|
1441
|
+
let byteOffset = 3;
|
|
1442
|
+
for (let i = 0; i < numHexEntries; i++) {
|
|
1443
|
+
const fieldId = rawBytes[byteOffset];
|
|
1444
|
+
if (fieldId === 3 /* SPAN_ID */) {
|
|
1445
|
+
const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 9);
|
|
1446
|
+
byteOffset += 9;
|
|
1447
|
+
jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
|
|
1448
|
+
hexBytes,
|
|
1449
|
+
(b) => b.toString(16).padStart(2, "0")
|
|
1450
|
+
).join("");
|
|
1451
|
+
} else if (fieldId === 4 /* ROOT_SPAN_ID */) {
|
|
1452
|
+
const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 17);
|
|
1453
|
+
byteOffset += 17;
|
|
1454
|
+
jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
|
|
1455
|
+
hexBytes,
|
|
1456
|
+
(b) => b.toString(16).padStart(2, "0")
|
|
1457
|
+
).join("");
|
|
1458
|
+
} else {
|
|
1459
|
+
const hexBytes = rawBytes.subarray(byteOffset + 1, byteOffset + 17);
|
|
1460
|
+
byteOffset += 17;
|
|
1461
|
+
jsonObj[FIELDS_ID_TO_NAME[fieldId]] = Array.from(
|
|
1462
|
+
hexBytes,
|
|
1463
|
+
(b) => b.toString(16).padStart(2, "0")
|
|
1464
|
+
).join("");
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
if (byteOffset < rawBytes.length) {
|
|
1468
|
+
const remainingJsonObj = JSON.parse(
|
|
1469
|
+
uint8ArrayToString(rawBytes.subarray(byteOffset))
|
|
1470
|
+
);
|
|
1471
|
+
Object.assign(jsonObj, remainingJsonObj);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
return _SpanComponentsV4.fromJsonObj(jsonObj);
|
|
1475
|
+
} catch {
|
|
1476
|
+
throw new Error(INVALID_ENCODING_ERRMSG_V4);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
objectIdFields() {
|
|
1480
|
+
if (!this.data.object_id) {
|
|
1481
|
+
throw new Error(
|
|
1482
|
+
"Impossible: cannot invoke `objectIdFields` unless SpanComponentsV4 is initialized with an `object_id`"
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
switch (this.data.object_type) {
|
|
1486
|
+
case 1 /* EXPERIMENT */:
|
|
1487
|
+
return { experiment_id: this.data.object_id };
|
|
1488
|
+
case 2 /* PROJECT_LOGS */:
|
|
1489
|
+
return { project_id: this.data.object_id, log_id: "g" };
|
|
1490
|
+
case 3 /* PLAYGROUND_LOGS */:
|
|
1491
|
+
return { prompt_session_id: this.data.object_id, log_id: "x" };
|
|
1492
|
+
default:
|
|
1493
|
+
const _ = this.data.object_type;
|
|
1494
|
+
throw new Error(`Invalid object_type ${this.data.object_type}`);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
async export() {
|
|
1498
|
+
return this.toStr();
|
|
1499
|
+
}
|
|
1500
|
+
static fromJsonObj(jsonObj) {
|
|
1501
|
+
return new _SpanComponentsV4(spanComponentsV4Schema.parse(jsonObj));
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
function parseParent(parent) {
|
|
1505
|
+
return typeof parent === "string" ? parent : parent ? new SpanComponentsV4({
|
|
1506
|
+
object_type: parent.object_type === "experiment" ? 1 /* EXPERIMENT */ : parent.object_type === "playground_logs" ? 3 /* PLAYGROUND_LOGS */ : 2 /* PROJECT_LOGS */,
|
|
1507
|
+
object_id: parent.object_id,
|
|
1508
|
+
...parent.row_ids ? {
|
|
1509
|
+
row_id: parent.row_ids.id,
|
|
1510
|
+
span_id: parent.row_ids.span_id,
|
|
1511
|
+
root_span_id: parent.row_ids.root_span_id
|
|
1512
|
+
} : {
|
|
1513
|
+
row_id: void 0,
|
|
1514
|
+
span_id: void 0,
|
|
1515
|
+
root_span_id: void 0
|
|
1516
|
+
},
|
|
1517
|
+
propagated_event: parent.propagated_event
|
|
1518
|
+
}).toStr() : void 0;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1273
1521
|
// util/git_fields.ts
|
|
1274
1522
|
function mergeGitMetadataSettings(s1, s2) {
|
|
1275
1523
|
if (s1.collect === "all") {
|
|
@@ -1305,12 +1553,12 @@ function loadPrettyXact(encodedHex) {
|
|
|
1305
1553
|
}
|
|
1306
1554
|
|
|
1307
1555
|
// util/zod_util.ts
|
|
1308
|
-
import { z as
|
|
1556
|
+
import { z as z5 } from "zod/v3";
|
|
1309
1557
|
|
|
1310
1558
|
// src/generated_types.ts
|
|
1311
|
-
import { z as
|
|
1312
|
-
var AclObjectType =
|
|
1313
|
-
|
|
1559
|
+
import { z as z6 } from "zod/v3";
|
|
1560
|
+
var AclObjectType = z6.union([
|
|
1561
|
+
z6.enum([
|
|
1314
1562
|
"organization",
|
|
1315
1563
|
"project",
|
|
1316
1564
|
"experiment",
|
|
@@ -1323,9 +1571,9 @@ var AclObjectType = z5.union([
|
|
|
1323
1571
|
"project_log",
|
|
1324
1572
|
"org_project"
|
|
1325
1573
|
]),
|
|
1326
|
-
|
|
1574
|
+
z6.null()
|
|
1327
1575
|
]);
|
|
1328
|
-
var Permission =
|
|
1576
|
+
var Permission = z6.enum([
|
|
1329
1577
|
"create",
|
|
1330
1578
|
"read",
|
|
1331
1579
|
"update",
|
|
@@ -1335,310 +1583,310 @@ var Permission = z5.enum([
|
|
|
1335
1583
|
"update_acls",
|
|
1336
1584
|
"delete_acls"
|
|
1337
1585
|
]);
|
|
1338
|
-
var Acl =
|
|
1339
|
-
id:
|
|
1340
|
-
object_type: AclObjectType.and(
|
|
1341
|
-
object_id:
|
|
1342
|
-
user_id:
|
|
1343
|
-
group_id:
|
|
1344
|
-
permission: Permission.and(
|
|
1345
|
-
restrict_object_type: AclObjectType.and(
|
|
1346
|
-
role_id:
|
|
1347
|
-
_object_org_id:
|
|
1348
|
-
created:
|
|
1586
|
+
var Acl = z6.object({
|
|
1587
|
+
id: z6.string().uuid(),
|
|
1588
|
+
object_type: AclObjectType.and(z6.string()),
|
|
1589
|
+
object_id: z6.string().uuid(),
|
|
1590
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1591
|
+
group_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1592
|
+
permission: Permission.and(z6.union([z6.string(), z6.null()])).optional(),
|
|
1593
|
+
restrict_object_type: AclObjectType.and(z6.unknown()).optional(),
|
|
1594
|
+
role_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1595
|
+
_object_org_id: z6.string().uuid(),
|
|
1596
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1349
1597
|
});
|
|
1350
|
-
var AISecret =
|
|
1351
|
-
id:
|
|
1352
|
-
created:
|
|
1353
|
-
updated_at:
|
|
1354
|
-
org_id:
|
|
1355
|
-
name:
|
|
1356
|
-
type:
|
|
1357
|
-
metadata:
|
|
1358
|
-
preview_secret:
|
|
1598
|
+
var AISecret = z6.object({
|
|
1599
|
+
id: z6.string().uuid(),
|
|
1600
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1601
|
+
updated_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1602
|
+
org_id: z6.string().uuid(),
|
|
1603
|
+
name: z6.string(),
|
|
1604
|
+
type: z6.union([z6.string(), z6.null()]).optional(),
|
|
1605
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1606
|
+
preview_secret: z6.union([z6.string(), z6.null()]).optional()
|
|
1359
1607
|
});
|
|
1360
|
-
var ResponseFormatJsonSchema =
|
|
1361
|
-
name:
|
|
1362
|
-
description:
|
|
1363
|
-
schema:
|
|
1364
|
-
strict:
|
|
1608
|
+
var ResponseFormatJsonSchema = z6.object({
|
|
1609
|
+
name: z6.string(),
|
|
1610
|
+
description: z6.string().optional(),
|
|
1611
|
+
schema: z6.union([z6.object({}).partial().passthrough(), z6.string()]).optional(),
|
|
1612
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1365
1613
|
});
|
|
1366
|
-
var ResponseFormatNullish =
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
type:
|
|
1614
|
+
var ResponseFormatNullish = z6.union([
|
|
1615
|
+
z6.object({ type: z6.literal("json_object") }),
|
|
1616
|
+
z6.object({
|
|
1617
|
+
type: z6.literal("json_schema"),
|
|
1370
1618
|
json_schema: ResponseFormatJsonSchema
|
|
1371
1619
|
}),
|
|
1372
|
-
|
|
1373
|
-
|
|
1620
|
+
z6.object({ type: z6.literal("text") }),
|
|
1621
|
+
z6.null()
|
|
1374
1622
|
]);
|
|
1375
|
-
var AnyModelParams =
|
|
1376
|
-
temperature:
|
|
1377
|
-
top_p:
|
|
1378
|
-
max_tokens:
|
|
1379
|
-
max_completion_tokens:
|
|
1380
|
-
frequency_penalty:
|
|
1381
|
-
presence_penalty:
|
|
1623
|
+
var AnyModelParams = z6.object({
|
|
1624
|
+
temperature: z6.number().optional(),
|
|
1625
|
+
top_p: z6.number().optional(),
|
|
1626
|
+
max_tokens: z6.number(),
|
|
1627
|
+
max_completion_tokens: z6.number().optional(),
|
|
1628
|
+
frequency_penalty: z6.number().optional(),
|
|
1629
|
+
presence_penalty: z6.number().optional(),
|
|
1382
1630
|
response_format: ResponseFormatNullish.optional(),
|
|
1383
|
-
tool_choice:
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
type:
|
|
1389
|
-
function:
|
|
1631
|
+
tool_choice: z6.union([
|
|
1632
|
+
z6.literal("auto"),
|
|
1633
|
+
z6.literal("none"),
|
|
1634
|
+
z6.literal("required"),
|
|
1635
|
+
z6.object({
|
|
1636
|
+
type: z6.literal("function"),
|
|
1637
|
+
function: z6.object({ name: z6.string() })
|
|
1390
1638
|
})
|
|
1391
1639
|
]).optional(),
|
|
1392
|
-
function_call:
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1640
|
+
function_call: z6.union([
|
|
1641
|
+
z6.literal("auto"),
|
|
1642
|
+
z6.literal("none"),
|
|
1643
|
+
z6.object({ name: z6.string() })
|
|
1396
1644
|
]).optional(),
|
|
1397
|
-
n:
|
|
1398
|
-
stop:
|
|
1399
|
-
reasoning_effort:
|
|
1400
|
-
verbosity:
|
|
1401
|
-
top_k:
|
|
1402
|
-
stop_sequences:
|
|
1403
|
-
max_tokens_to_sample:
|
|
1404
|
-
maxOutputTokens:
|
|
1405
|
-
topP:
|
|
1406
|
-
topK:
|
|
1407
|
-
use_cache:
|
|
1645
|
+
n: z6.number().optional(),
|
|
1646
|
+
stop: z6.array(z6.string()).optional(),
|
|
1647
|
+
reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]).optional(),
|
|
1648
|
+
verbosity: z6.enum(["low", "medium", "high"]).optional(),
|
|
1649
|
+
top_k: z6.number().optional(),
|
|
1650
|
+
stop_sequences: z6.array(z6.string()).optional(),
|
|
1651
|
+
max_tokens_to_sample: z6.number().optional(),
|
|
1652
|
+
maxOutputTokens: z6.number().optional(),
|
|
1653
|
+
topP: z6.number().optional(),
|
|
1654
|
+
topK: z6.number().optional(),
|
|
1655
|
+
use_cache: z6.boolean().optional()
|
|
1408
1656
|
});
|
|
1409
|
-
var ApiKey =
|
|
1410
|
-
id:
|
|
1411
|
-
created:
|
|
1412
|
-
name:
|
|
1413
|
-
preview_name:
|
|
1414
|
-
user_id:
|
|
1415
|
-
user_email:
|
|
1416
|
-
user_given_name:
|
|
1417
|
-
user_family_name:
|
|
1418
|
-
org_id:
|
|
1657
|
+
var ApiKey = z6.object({
|
|
1658
|
+
id: z6.string().uuid(),
|
|
1659
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1660
|
+
name: z6.string(),
|
|
1661
|
+
preview_name: z6.string(),
|
|
1662
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1663
|
+
user_email: z6.union([z6.string(), z6.null()]).optional(),
|
|
1664
|
+
user_given_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
1665
|
+
user_family_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
1666
|
+
org_id: z6.union([z6.string(), z6.null()]).optional()
|
|
1419
1667
|
});
|
|
1420
|
-
var AsyncScoringState =
|
|
1421
|
-
|
|
1422
|
-
status:
|
|
1423
|
-
token:
|
|
1424
|
-
function_ids:
|
|
1425
|
-
skip_logging:
|
|
1668
|
+
var AsyncScoringState = z6.union([
|
|
1669
|
+
z6.object({
|
|
1670
|
+
status: z6.literal("enabled"),
|
|
1671
|
+
token: z6.string(),
|
|
1672
|
+
function_ids: z6.array(z6.unknown()).min(1),
|
|
1673
|
+
skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1426
1674
|
}),
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1675
|
+
z6.object({ status: z6.literal("disabled") }),
|
|
1676
|
+
z6.null(),
|
|
1677
|
+
z6.null()
|
|
1430
1678
|
]);
|
|
1431
|
-
var AsyncScoringControl =
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1679
|
+
var AsyncScoringControl = z6.union([
|
|
1680
|
+
z6.object({ kind: z6.literal("score_update"), token: z6.string() }),
|
|
1681
|
+
z6.object({ kind: z6.literal("state_override"), state: AsyncScoringState }),
|
|
1682
|
+
z6.object({ kind: z6.literal("state_force_reselect") }),
|
|
1683
|
+
z6.object({ kind: z6.literal("state_enabled_force_rescore") })
|
|
1436
1684
|
]);
|
|
1437
|
-
var BraintrustAttachmentReference =
|
|
1438
|
-
type:
|
|
1439
|
-
filename:
|
|
1440
|
-
content_type:
|
|
1441
|
-
key:
|
|
1685
|
+
var BraintrustAttachmentReference = z6.object({
|
|
1686
|
+
type: z6.literal("braintrust_attachment"),
|
|
1687
|
+
filename: z6.string().min(1),
|
|
1688
|
+
content_type: z6.string().min(1),
|
|
1689
|
+
key: z6.string().min(1)
|
|
1442
1690
|
});
|
|
1443
|
-
var ExternalAttachmentReference =
|
|
1444
|
-
type:
|
|
1445
|
-
filename:
|
|
1446
|
-
content_type:
|
|
1447
|
-
url:
|
|
1691
|
+
var ExternalAttachmentReference = z6.object({
|
|
1692
|
+
type: z6.literal("external_attachment"),
|
|
1693
|
+
filename: z6.string().min(1),
|
|
1694
|
+
content_type: z6.string().min(1),
|
|
1695
|
+
url: z6.string().min(1)
|
|
1448
1696
|
});
|
|
1449
|
-
var AttachmentReference =
|
|
1697
|
+
var AttachmentReference = z6.discriminatedUnion("type", [
|
|
1450
1698
|
BraintrustAttachmentReference,
|
|
1451
1699
|
ExternalAttachmentReference
|
|
1452
1700
|
]);
|
|
1453
|
-
var UploadStatus =
|
|
1454
|
-
var AttachmentStatus =
|
|
1701
|
+
var UploadStatus = z6.enum(["uploading", "done", "error"]);
|
|
1702
|
+
var AttachmentStatus = z6.object({
|
|
1455
1703
|
upload_status: UploadStatus,
|
|
1456
|
-
error_message:
|
|
1704
|
+
error_message: z6.string().optional()
|
|
1457
1705
|
});
|
|
1458
|
-
var BraintrustModelParams =
|
|
1459
|
-
var CallEvent =
|
|
1460
|
-
|
|
1461
|
-
id:
|
|
1462
|
-
data:
|
|
1463
|
-
event:
|
|
1706
|
+
var BraintrustModelParams = z6.object({ use_cache: z6.boolean() }).partial();
|
|
1707
|
+
var CallEvent = z6.union([
|
|
1708
|
+
z6.object({
|
|
1709
|
+
id: z6.string().optional(),
|
|
1710
|
+
data: z6.string(),
|
|
1711
|
+
event: z6.literal("text_delta")
|
|
1464
1712
|
}),
|
|
1465
|
-
|
|
1466
|
-
id:
|
|
1467
|
-
data:
|
|
1468
|
-
event:
|
|
1713
|
+
z6.object({
|
|
1714
|
+
id: z6.string().optional(),
|
|
1715
|
+
data: z6.string(),
|
|
1716
|
+
event: z6.literal("reasoning_delta")
|
|
1469
1717
|
}),
|
|
1470
|
-
|
|
1471
|
-
id:
|
|
1472
|
-
data:
|
|
1473
|
-
event:
|
|
1718
|
+
z6.object({
|
|
1719
|
+
id: z6.string().optional(),
|
|
1720
|
+
data: z6.string(),
|
|
1721
|
+
event: z6.literal("json_delta")
|
|
1474
1722
|
}),
|
|
1475
|
-
|
|
1476
|
-
id:
|
|
1477
|
-
data:
|
|
1478
|
-
event:
|
|
1723
|
+
z6.object({
|
|
1724
|
+
id: z6.string().optional(),
|
|
1725
|
+
data: z6.string(),
|
|
1726
|
+
event: z6.literal("progress")
|
|
1479
1727
|
}),
|
|
1480
|
-
|
|
1481
|
-
id:
|
|
1482
|
-
data:
|
|
1483
|
-
event:
|
|
1728
|
+
z6.object({
|
|
1729
|
+
id: z6.string().optional(),
|
|
1730
|
+
data: z6.string(),
|
|
1731
|
+
event: z6.literal("error")
|
|
1484
1732
|
}),
|
|
1485
|
-
|
|
1486
|
-
id:
|
|
1487
|
-
data:
|
|
1488
|
-
event:
|
|
1733
|
+
z6.object({
|
|
1734
|
+
id: z6.string().optional(),
|
|
1735
|
+
data: z6.string(),
|
|
1736
|
+
event: z6.literal("console")
|
|
1489
1737
|
}),
|
|
1490
|
-
|
|
1491
|
-
id:
|
|
1492
|
-
event:
|
|
1493
|
-
data:
|
|
1738
|
+
z6.object({
|
|
1739
|
+
id: z6.string().optional(),
|
|
1740
|
+
event: z6.literal("start"),
|
|
1741
|
+
data: z6.literal("")
|
|
1494
1742
|
}),
|
|
1495
|
-
|
|
1496
|
-
id:
|
|
1497
|
-
event:
|
|
1498
|
-
data:
|
|
1743
|
+
z6.object({
|
|
1744
|
+
id: z6.string().optional(),
|
|
1745
|
+
event: z6.literal("done"),
|
|
1746
|
+
data: z6.literal("")
|
|
1499
1747
|
})
|
|
1500
1748
|
]);
|
|
1501
|
-
var ChatCompletionContentPartTextWithTitle =
|
|
1502
|
-
text:
|
|
1503
|
-
type:
|
|
1504
|
-
cache_control:
|
|
1749
|
+
var ChatCompletionContentPartTextWithTitle = z6.object({
|
|
1750
|
+
text: z6.string().default(""),
|
|
1751
|
+
type: z6.literal("text"),
|
|
1752
|
+
cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
|
|
1505
1753
|
});
|
|
1506
|
-
var ChatCompletionContentPartImageWithTitle =
|
|
1507
|
-
image_url:
|
|
1508
|
-
url:
|
|
1509
|
-
detail:
|
|
1754
|
+
var ChatCompletionContentPartImageWithTitle = z6.object({
|
|
1755
|
+
image_url: z6.object({
|
|
1756
|
+
url: z6.string(),
|
|
1757
|
+
detail: z6.union([z6.literal("auto"), z6.literal("low"), z6.literal("high")]).optional()
|
|
1510
1758
|
}),
|
|
1511
|
-
type:
|
|
1759
|
+
type: z6.literal("image_url")
|
|
1512
1760
|
});
|
|
1513
|
-
var ChatCompletionContentPart =
|
|
1761
|
+
var ChatCompletionContentPart = z6.union([
|
|
1514
1762
|
ChatCompletionContentPartTextWithTitle,
|
|
1515
1763
|
ChatCompletionContentPartImageWithTitle
|
|
1516
1764
|
]);
|
|
1517
|
-
var ChatCompletionContentPartText =
|
|
1518
|
-
text:
|
|
1519
|
-
type:
|
|
1520
|
-
cache_control:
|
|
1765
|
+
var ChatCompletionContentPartText = z6.object({
|
|
1766
|
+
text: z6.string().default(""),
|
|
1767
|
+
type: z6.literal("text"),
|
|
1768
|
+
cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
|
|
1521
1769
|
});
|
|
1522
|
-
var ChatCompletionMessageToolCall =
|
|
1523
|
-
id:
|
|
1524
|
-
function:
|
|
1525
|
-
type:
|
|
1770
|
+
var ChatCompletionMessageToolCall = z6.object({
|
|
1771
|
+
id: z6.string(),
|
|
1772
|
+
function: z6.object({ arguments: z6.string(), name: z6.string() }),
|
|
1773
|
+
type: z6.literal("function")
|
|
1526
1774
|
});
|
|
1527
|
-
var ChatCompletionMessageReasoning =
|
|
1528
|
-
var ChatCompletionMessageParam =
|
|
1529
|
-
|
|
1530
|
-
content:
|
|
1531
|
-
role:
|
|
1532
|
-
name:
|
|
1775
|
+
var ChatCompletionMessageReasoning = z6.object({ id: z6.string(), content: z6.string() }).partial();
|
|
1776
|
+
var ChatCompletionMessageParam = z6.union([
|
|
1777
|
+
z6.object({
|
|
1778
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1779
|
+
role: z6.literal("system"),
|
|
1780
|
+
name: z6.string().optional()
|
|
1533
1781
|
}),
|
|
1534
|
-
|
|
1535
|
-
content:
|
|
1536
|
-
role:
|
|
1537
|
-
name:
|
|
1782
|
+
z6.object({
|
|
1783
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
|
|
1784
|
+
role: z6.literal("user"),
|
|
1785
|
+
name: z6.string().optional()
|
|
1538
1786
|
}),
|
|
1539
|
-
|
|
1540
|
-
role:
|
|
1541
|
-
content:
|
|
1542
|
-
function_call:
|
|
1543
|
-
name:
|
|
1544
|
-
tool_calls:
|
|
1545
|
-
reasoning:
|
|
1787
|
+
z6.object({
|
|
1788
|
+
role: z6.literal("assistant"),
|
|
1789
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
|
|
1790
|
+
function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
|
|
1791
|
+
name: z6.string().optional(),
|
|
1792
|
+
tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
|
|
1793
|
+
reasoning: z6.array(ChatCompletionMessageReasoning).optional()
|
|
1546
1794
|
}),
|
|
1547
|
-
|
|
1548
|
-
content:
|
|
1549
|
-
role:
|
|
1550
|
-
tool_call_id:
|
|
1795
|
+
z6.object({
|
|
1796
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1797
|
+
role: z6.literal("tool"),
|
|
1798
|
+
tool_call_id: z6.string().default("")
|
|
1551
1799
|
}),
|
|
1552
|
-
|
|
1553
|
-
content:
|
|
1554
|
-
name:
|
|
1555
|
-
role:
|
|
1800
|
+
z6.object({
|
|
1801
|
+
content: z6.union([z6.string(), z6.null()]),
|
|
1802
|
+
name: z6.string(),
|
|
1803
|
+
role: z6.literal("function")
|
|
1556
1804
|
}),
|
|
1557
|
-
|
|
1558
|
-
content:
|
|
1559
|
-
role:
|
|
1560
|
-
name:
|
|
1805
|
+
z6.object({
|
|
1806
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1807
|
+
role: z6.literal("developer"),
|
|
1808
|
+
name: z6.string().optional()
|
|
1561
1809
|
}),
|
|
1562
|
-
|
|
1563
|
-
role:
|
|
1564
|
-
content:
|
|
1810
|
+
z6.object({
|
|
1811
|
+
role: z6.literal("model"),
|
|
1812
|
+
content: z6.union([z6.string(), z6.null()]).optional()
|
|
1565
1813
|
})
|
|
1566
1814
|
]);
|
|
1567
|
-
var ChatCompletionOpenAIMessageParam =
|
|
1568
|
-
|
|
1569
|
-
content:
|
|
1570
|
-
role:
|
|
1571
|
-
name:
|
|
1815
|
+
var ChatCompletionOpenAIMessageParam = z6.union([
|
|
1816
|
+
z6.object({
|
|
1817
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1818
|
+
role: z6.literal("system"),
|
|
1819
|
+
name: z6.string().optional()
|
|
1572
1820
|
}),
|
|
1573
|
-
|
|
1574
|
-
content:
|
|
1575
|
-
role:
|
|
1576
|
-
name:
|
|
1821
|
+
z6.object({
|
|
1822
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
|
|
1823
|
+
role: z6.literal("user"),
|
|
1824
|
+
name: z6.string().optional()
|
|
1577
1825
|
}),
|
|
1578
|
-
|
|
1579
|
-
role:
|
|
1580
|
-
content:
|
|
1581
|
-
function_call:
|
|
1582
|
-
name:
|
|
1583
|
-
tool_calls:
|
|
1584
|
-
reasoning:
|
|
1826
|
+
z6.object({
|
|
1827
|
+
role: z6.literal("assistant"),
|
|
1828
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
|
|
1829
|
+
function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
|
|
1830
|
+
name: z6.string().optional(),
|
|
1831
|
+
tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
|
|
1832
|
+
reasoning: z6.array(ChatCompletionMessageReasoning).optional()
|
|
1585
1833
|
}),
|
|
1586
|
-
|
|
1587
|
-
content:
|
|
1588
|
-
role:
|
|
1589
|
-
tool_call_id:
|
|
1834
|
+
z6.object({
|
|
1835
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1836
|
+
role: z6.literal("tool"),
|
|
1837
|
+
tool_call_id: z6.string().default("")
|
|
1590
1838
|
}),
|
|
1591
|
-
|
|
1592
|
-
content:
|
|
1593
|
-
name:
|
|
1594
|
-
role:
|
|
1839
|
+
z6.object({
|
|
1840
|
+
content: z6.union([z6.string(), z6.null()]),
|
|
1841
|
+
name: z6.string(),
|
|
1842
|
+
role: z6.literal("function")
|
|
1595
1843
|
}),
|
|
1596
|
-
|
|
1597
|
-
content:
|
|
1598
|
-
role:
|
|
1599
|
-
name:
|
|
1844
|
+
z6.object({
|
|
1845
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1846
|
+
role: z6.literal("developer"),
|
|
1847
|
+
name: z6.string().optional()
|
|
1600
1848
|
})
|
|
1601
1849
|
]);
|
|
1602
|
-
var ChatCompletionTool =
|
|
1603
|
-
function:
|
|
1604
|
-
name:
|
|
1605
|
-
description:
|
|
1606
|
-
parameters:
|
|
1850
|
+
var ChatCompletionTool = z6.object({
|
|
1851
|
+
function: z6.object({
|
|
1852
|
+
name: z6.string(),
|
|
1853
|
+
description: z6.string().optional(),
|
|
1854
|
+
parameters: z6.object({}).partial().passthrough().optional()
|
|
1607
1855
|
}),
|
|
1608
|
-
type:
|
|
1856
|
+
type: z6.literal("function")
|
|
1609
1857
|
});
|
|
1610
|
-
var CodeBundle =
|
|
1611
|
-
runtime_context:
|
|
1612
|
-
runtime:
|
|
1613
|
-
version:
|
|
1858
|
+
var CodeBundle = z6.object({
|
|
1859
|
+
runtime_context: z6.object({
|
|
1860
|
+
runtime: z6.enum(["node", "python"]),
|
|
1861
|
+
version: z6.string()
|
|
1614
1862
|
}),
|
|
1615
|
-
location:
|
|
1616
|
-
|
|
1617
|
-
type:
|
|
1618
|
-
eval_name:
|
|
1619
|
-
position:
|
|
1620
|
-
|
|
1621
|
-
|
|
1863
|
+
location: z6.union([
|
|
1864
|
+
z6.object({
|
|
1865
|
+
type: z6.literal("experiment"),
|
|
1866
|
+
eval_name: z6.string(),
|
|
1867
|
+
position: z6.union([
|
|
1868
|
+
z6.object({ type: z6.literal("task") }),
|
|
1869
|
+
z6.object({ type: z6.literal("scorer"), index: z6.number().int().gte(0) })
|
|
1622
1870
|
])
|
|
1623
1871
|
}),
|
|
1624
|
-
|
|
1872
|
+
z6.object({ type: z6.literal("function"), index: z6.number().int().gte(0) })
|
|
1625
1873
|
]),
|
|
1626
|
-
bundle_id:
|
|
1627
|
-
preview:
|
|
1874
|
+
bundle_id: z6.string(),
|
|
1875
|
+
preview: z6.union([z6.string(), z6.null()]).optional()
|
|
1628
1876
|
});
|
|
1629
|
-
var Dataset =
|
|
1630
|
-
id:
|
|
1631
|
-
project_id:
|
|
1632
|
-
name:
|
|
1633
|
-
description:
|
|
1634
|
-
created:
|
|
1635
|
-
deleted_at:
|
|
1636
|
-
user_id:
|
|
1637
|
-
metadata:
|
|
1877
|
+
var Dataset = z6.object({
|
|
1878
|
+
id: z6.string().uuid(),
|
|
1879
|
+
project_id: z6.string().uuid(),
|
|
1880
|
+
name: z6.string(),
|
|
1881
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1882
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1883
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1884
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1885
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
1638
1886
|
});
|
|
1639
|
-
var ObjectReferenceNullish =
|
|
1640
|
-
|
|
1641
|
-
object_type:
|
|
1887
|
+
var ObjectReferenceNullish = z6.union([
|
|
1888
|
+
z6.object({
|
|
1889
|
+
object_type: z6.enum([
|
|
1642
1890
|
"project_logs",
|
|
1643
1891
|
"experiment",
|
|
1644
1892
|
"dataset",
|
|
@@ -1646,399 +1894,399 @@ var ObjectReferenceNullish = z5.union([
|
|
|
1646
1894
|
"function",
|
|
1647
1895
|
"prompt_session"
|
|
1648
1896
|
]),
|
|
1649
|
-
object_id:
|
|
1650
|
-
id:
|
|
1651
|
-
_xact_id:
|
|
1652
|
-
created:
|
|
1897
|
+
object_id: z6.string().uuid(),
|
|
1898
|
+
id: z6.string(),
|
|
1899
|
+
_xact_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1900
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1653
1901
|
}),
|
|
1654
|
-
|
|
1902
|
+
z6.null()
|
|
1655
1903
|
]);
|
|
1656
|
-
var DatasetEvent =
|
|
1657
|
-
id:
|
|
1658
|
-
_xact_id:
|
|
1659
|
-
created:
|
|
1660
|
-
_pagination_key:
|
|
1661
|
-
project_id:
|
|
1662
|
-
dataset_id:
|
|
1663
|
-
input:
|
|
1664
|
-
expected:
|
|
1665
|
-
metadata:
|
|
1666
|
-
|
|
1667
|
-
|
|
1904
|
+
var DatasetEvent = z6.object({
|
|
1905
|
+
id: z6.string(),
|
|
1906
|
+
_xact_id: z6.string(),
|
|
1907
|
+
created: z6.string().datetime({ offset: true }),
|
|
1908
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
1909
|
+
project_id: z6.string().uuid(),
|
|
1910
|
+
dataset_id: z6.string().uuid(),
|
|
1911
|
+
input: z6.unknown().optional(),
|
|
1912
|
+
expected: z6.unknown().optional(),
|
|
1913
|
+
metadata: z6.union([
|
|
1914
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
1915
|
+
z6.null()
|
|
1668
1916
|
]).optional(),
|
|
1669
|
-
tags:
|
|
1670
|
-
span_id:
|
|
1671
|
-
root_span_id:
|
|
1672
|
-
is_root:
|
|
1917
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1918
|
+
span_id: z6.string(),
|
|
1919
|
+
root_span_id: z6.string(),
|
|
1920
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1673
1921
|
origin: ObjectReferenceNullish.optional()
|
|
1674
1922
|
});
|
|
1675
|
-
var EnvVar =
|
|
1676
|
-
id:
|
|
1677
|
-
object_type:
|
|
1678
|
-
object_id:
|
|
1679
|
-
name:
|
|
1680
|
-
created:
|
|
1681
|
-
used:
|
|
1923
|
+
var EnvVar = z6.object({
|
|
1924
|
+
id: z6.string().uuid(),
|
|
1925
|
+
object_type: z6.enum(["organization", "project", "function"]),
|
|
1926
|
+
object_id: z6.string().uuid(),
|
|
1927
|
+
name: z6.string(),
|
|
1928
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1929
|
+
used: z6.union([z6.string(), z6.null()]).optional()
|
|
1682
1930
|
});
|
|
1683
|
-
var RepoInfo =
|
|
1684
|
-
|
|
1685
|
-
commit:
|
|
1686
|
-
branch:
|
|
1687
|
-
tag:
|
|
1688
|
-
dirty:
|
|
1689
|
-
author_name:
|
|
1690
|
-
author_email:
|
|
1691
|
-
commit_message:
|
|
1692
|
-
commit_time:
|
|
1693
|
-
git_diff:
|
|
1931
|
+
var RepoInfo = z6.union([
|
|
1932
|
+
z6.object({
|
|
1933
|
+
commit: z6.union([z6.string(), z6.null()]),
|
|
1934
|
+
branch: z6.union([z6.string(), z6.null()]),
|
|
1935
|
+
tag: z6.union([z6.string(), z6.null()]),
|
|
1936
|
+
dirty: z6.union([z6.boolean(), z6.null()]),
|
|
1937
|
+
author_name: z6.union([z6.string(), z6.null()]),
|
|
1938
|
+
author_email: z6.union([z6.string(), z6.null()]),
|
|
1939
|
+
commit_message: z6.union([z6.string(), z6.null()]),
|
|
1940
|
+
commit_time: z6.union([z6.string(), z6.null()]),
|
|
1941
|
+
git_diff: z6.union([z6.string(), z6.null()])
|
|
1694
1942
|
}).partial(),
|
|
1695
|
-
|
|
1943
|
+
z6.null()
|
|
1696
1944
|
]);
|
|
1697
|
-
var Experiment =
|
|
1698
|
-
id:
|
|
1699
|
-
project_id:
|
|
1700
|
-
name:
|
|
1701
|
-
description:
|
|
1702
|
-
created:
|
|
1945
|
+
var Experiment = z6.object({
|
|
1946
|
+
id: z6.string().uuid(),
|
|
1947
|
+
project_id: z6.string().uuid(),
|
|
1948
|
+
name: z6.string(),
|
|
1949
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1950
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1703
1951
|
repo_info: RepoInfo.optional(),
|
|
1704
|
-
commit:
|
|
1705
|
-
base_exp_id:
|
|
1706
|
-
deleted_at:
|
|
1707
|
-
dataset_id:
|
|
1708
|
-
dataset_version:
|
|
1709
|
-
public:
|
|
1710
|
-
user_id:
|
|
1711
|
-
metadata:
|
|
1712
|
-
tags:
|
|
1952
|
+
commit: z6.union([z6.string(), z6.null()]).optional(),
|
|
1953
|
+
base_exp_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1954
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1955
|
+
dataset_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1956
|
+
dataset_version: z6.union([z6.string(), z6.null()]).optional(),
|
|
1957
|
+
public: z6.boolean(),
|
|
1958
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1959
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1960
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
|
|
1713
1961
|
});
|
|
1714
|
-
var SpanType =
|
|
1715
|
-
|
|
1716
|
-
|
|
1962
|
+
var SpanType = z6.union([
|
|
1963
|
+
z6.enum(["llm", "score", "function", "eval", "task", "tool"]),
|
|
1964
|
+
z6.null()
|
|
1717
1965
|
]);
|
|
1718
|
-
var SpanAttributes =
|
|
1719
|
-
|
|
1720
|
-
|
|
1966
|
+
var SpanAttributes = z6.union([
|
|
1967
|
+
z6.object({ name: z6.union([z6.string(), z6.null()]), type: SpanType }).partial().passthrough(),
|
|
1968
|
+
z6.null()
|
|
1721
1969
|
]);
|
|
1722
|
-
var ExperimentEvent =
|
|
1723
|
-
id:
|
|
1724
|
-
_xact_id:
|
|
1725
|
-
created:
|
|
1726
|
-
_pagination_key:
|
|
1727
|
-
project_id:
|
|
1728
|
-
experiment_id:
|
|
1729
|
-
input:
|
|
1730
|
-
output:
|
|
1731
|
-
expected:
|
|
1732
|
-
error:
|
|
1733
|
-
scores:
|
|
1734
|
-
metadata:
|
|
1735
|
-
|
|
1736
|
-
|
|
1970
|
+
var ExperimentEvent = z6.object({
|
|
1971
|
+
id: z6.string(),
|
|
1972
|
+
_xact_id: z6.string(),
|
|
1973
|
+
created: z6.string().datetime({ offset: true }),
|
|
1974
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
1975
|
+
project_id: z6.string().uuid(),
|
|
1976
|
+
experiment_id: z6.string().uuid(),
|
|
1977
|
+
input: z6.unknown().optional(),
|
|
1978
|
+
output: z6.unknown().optional(),
|
|
1979
|
+
expected: z6.unknown().optional(),
|
|
1980
|
+
error: z6.unknown().optional(),
|
|
1981
|
+
scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
|
|
1982
|
+
metadata: z6.union([
|
|
1983
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
1984
|
+
z6.null()
|
|
1737
1985
|
]).optional(),
|
|
1738
|
-
tags:
|
|
1739
|
-
metrics:
|
|
1740
|
-
context:
|
|
1741
|
-
|
|
1742
|
-
caller_functionname:
|
|
1743
|
-
caller_filename:
|
|
1744
|
-
caller_lineno:
|
|
1986
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1987
|
+
metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
|
|
1988
|
+
context: z6.union([
|
|
1989
|
+
z6.object({
|
|
1990
|
+
caller_functionname: z6.union([z6.string(), z6.null()]),
|
|
1991
|
+
caller_filename: z6.union([z6.string(), z6.null()]),
|
|
1992
|
+
caller_lineno: z6.union([z6.number(), z6.null()])
|
|
1745
1993
|
}).partial().passthrough(),
|
|
1746
|
-
|
|
1994
|
+
z6.null()
|
|
1747
1995
|
]).optional(),
|
|
1748
|
-
span_id:
|
|
1749
|
-
span_parents:
|
|
1750
|
-
root_span_id:
|
|
1996
|
+
span_id: z6.string(),
|
|
1997
|
+
span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1998
|
+
root_span_id: z6.string(),
|
|
1751
1999
|
span_attributes: SpanAttributes.optional(),
|
|
1752
|
-
is_root:
|
|
2000
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1753
2001
|
origin: ObjectReferenceNullish.optional()
|
|
1754
2002
|
});
|
|
1755
|
-
var ExtendedSavedFunctionId =
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
type:
|
|
1760
|
-
project_id:
|
|
1761
|
-
slug:
|
|
2003
|
+
var ExtendedSavedFunctionId = z6.union([
|
|
2004
|
+
z6.object({ type: z6.literal("function"), id: z6.string() }),
|
|
2005
|
+
z6.object({ type: z6.literal("global"), name: z6.string() }),
|
|
2006
|
+
z6.object({
|
|
2007
|
+
type: z6.literal("slug"),
|
|
2008
|
+
project_id: z6.string(),
|
|
2009
|
+
slug: z6.string()
|
|
1762
2010
|
})
|
|
1763
2011
|
]);
|
|
1764
|
-
var PromptBlockDataNullish =
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
type:
|
|
1768
|
-
messages:
|
|
1769
|
-
tools:
|
|
2012
|
+
var PromptBlockDataNullish = z6.union([
|
|
2013
|
+
z6.object({ type: z6.literal("completion"), content: z6.string() }),
|
|
2014
|
+
z6.object({
|
|
2015
|
+
type: z6.literal("chat"),
|
|
2016
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
2017
|
+
tools: z6.string().optional()
|
|
1770
2018
|
}),
|
|
1771
|
-
|
|
2019
|
+
z6.null()
|
|
1772
2020
|
]);
|
|
1773
|
-
var ModelParams =
|
|
1774
|
-
|
|
1775
|
-
use_cache:
|
|
1776
|
-
temperature:
|
|
1777
|
-
top_p:
|
|
1778
|
-
max_tokens:
|
|
1779
|
-
max_completion_tokens:
|
|
1780
|
-
frequency_penalty:
|
|
1781
|
-
presence_penalty:
|
|
2021
|
+
var ModelParams = z6.union([
|
|
2022
|
+
z6.object({
|
|
2023
|
+
use_cache: z6.boolean(),
|
|
2024
|
+
temperature: z6.number(),
|
|
2025
|
+
top_p: z6.number(),
|
|
2026
|
+
max_tokens: z6.number(),
|
|
2027
|
+
max_completion_tokens: z6.number(),
|
|
2028
|
+
frequency_penalty: z6.number(),
|
|
2029
|
+
presence_penalty: z6.number(),
|
|
1782
2030
|
response_format: ResponseFormatNullish,
|
|
1783
|
-
tool_choice:
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
type:
|
|
1789
|
-
function:
|
|
2031
|
+
tool_choice: z6.union([
|
|
2032
|
+
z6.literal("auto"),
|
|
2033
|
+
z6.literal("none"),
|
|
2034
|
+
z6.literal("required"),
|
|
2035
|
+
z6.object({
|
|
2036
|
+
type: z6.literal("function"),
|
|
2037
|
+
function: z6.object({ name: z6.string() })
|
|
1790
2038
|
})
|
|
1791
2039
|
]),
|
|
1792
|
-
function_call:
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2040
|
+
function_call: z6.union([
|
|
2041
|
+
z6.literal("auto"),
|
|
2042
|
+
z6.literal("none"),
|
|
2043
|
+
z6.object({ name: z6.string() })
|
|
1796
2044
|
]),
|
|
1797
|
-
n:
|
|
1798
|
-
stop:
|
|
1799
|
-
reasoning_effort:
|
|
1800
|
-
verbosity:
|
|
2045
|
+
n: z6.number(),
|
|
2046
|
+
stop: z6.array(z6.string()),
|
|
2047
|
+
reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]),
|
|
2048
|
+
verbosity: z6.enum(["low", "medium", "high"])
|
|
1801
2049
|
}).partial().passthrough(),
|
|
1802
|
-
|
|
1803
|
-
use_cache:
|
|
1804
|
-
max_tokens:
|
|
1805
|
-
temperature:
|
|
1806
|
-
top_p:
|
|
1807
|
-
top_k:
|
|
1808
|
-
stop_sequences:
|
|
1809
|
-
max_tokens_to_sample:
|
|
2050
|
+
z6.object({
|
|
2051
|
+
use_cache: z6.boolean().optional(),
|
|
2052
|
+
max_tokens: z6.number(),
|
|
2053
|
+
temperature: z6.number(),
|
|
2054
|
+
top_p: z6.number().optional(),
|
|
2055
|
+
top_k: z6.number().optional(),
|
|
2056
|
+
stop_sequences: z6.array(z6.string()).optional(),
|
|
2057
|
+
max_tokens_to_sample: z6.number().optional()
|
|
1810
2058
|
}).passthrough(),
|
|
1811
|
-
|
|
1812
|
-
use_cache:
|
|
1813
|
-
temperature:
|
|
1814
|
-
maxOutputTokens:
|
|
1815
|
-
topP:
|
|
1816
|
-
topK:
|
|
2059
|
+
z6.object({
|
|
2060
|
+
use_cache: z6.boolean(),
|
|
2061
|
+
temperature: z6.number(),
|
|
2062
|
+
maxOutputTokens: z6.number(),
|
|
2063
|
+
topP: z6.number(),
|
|
2064
|
+
topK: z6.number()
|
|
1817
2065
|
}).partial().passthrough(),
|
|
1818
|
-
|
|
1819
|
-
use_cache:
|
|
1820
|
-
temperature:
|
|
1821
|
-
topK:
|
|
2066
|
+
z6.object({
|
|
2067
|
+
use_cache: z6.boolean(),
|
|
2068
|
+
temperature: z6.number(),
|
|
2069
|
+
topK: z6.number()
|
|
1822
2070
|
}).partial().passthrough(),
|
|
1823
|
-
|
|
2071
|
+
z6.object({ use_cache: z6.boolean() }).partial().passthrough()
|
|
1824
2072
|
]);
|
|
1825
|
-
var PromptOptionsNullish =
|
|
1826
|
-
|
|
1827
|
-
|
|
2073
|
+
var PromptOptionsNullish = z6.union([
|
|
2074
|
+
z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial(),
|
|
2075
|
+
z6.null()
|
|
1828
2076
|
]);
|
|
1829
|
-
var PromptParserNullish =
|
|
1830
|
-
|
|
1831
|
-
type:
|
|
1832
|
-
use_cot:
|
|
1833
|
-
choice_scores:
|
|
2077
|
+
var PromptParserNullish = z6.union([
|
|
2078
|
+
z6.object({
|
|
2079
|
+
type: z6.literal("llm_classifier"),
|
|
2080
|
+
use_cot: z6.boolean(),
|
|
2081
|
+
choice_scores: z6.record(z6.number().gte(0).lte(1))
|
|
1834
2082
|
}),
|
|
1835
|
-
|
|
2083
|
+
z6.null()
|
|
1836
2084
|
]);
|
|
1837
|
-
var SavedFunctionId =
|
|
1838
|
-
|
|
1839
|
-
|
|
2085
|
+
var SavedFunctionId = z6.union([
|
|
2086
|
+
z6.object({ type: z6.literal("function"), id: z6.string() }),
|
|
2087
|
+
z6.object({ type: z6.literal("global"), name: z6.string() })
|
|
1840
2088
|
]);
|
|
1841
|
-
var PromptDataNullish =
|
|
1842
|
-
|
|
2089
|
+
var PromptDataNullish = z6.union([
|
|
2090
|
+
z6.object({
|
|
1843
2091
|
prompt: PromptBlockDataNullish,
|
|
1844
2092
|
options: PromptOptionsNullish,
|
|
1845
2093
|
parser: PromptParserNullish,
|
|
1846
|
-
tool_functions:
|
|
1847
|
-
origin:
|
|
1848
|
-
|
|
1849
|
-
prompt_id:
|
|
1850
|
-
project_id:
|
|
1851
|
-
prompt_version:
|
|
2094
|
+
tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
|
|
2095
|
+
origin: z6.union([
|
|
2096
|
+
z6.object({
|
|
2097
|
+
prompt_id: z6.string(),
|
|
2098
|
+
project_id: z6.string(),
|
|
2099
|
+
prompt_version: z6.string()
|
|
1852
2100
|
}).partial(),
|
|
1853
|
-
|
|
2101
|
+
z6.null()
|
|
1854
2102
|
])
|
|
1855
2103
|
}).partial(),
|
|
1856
|
-
|
|
2104
|
+
z6.null()
|
|
1857
2105
|
]);
|
|
1858
|
-
var FunctionTypeEnumNullish =
|
|
1859
|
-
|
|
1860
|
-
|
|
2106
|
+
var FunctionTypeEnumNullish = z6.union([
|
|
2107
|
+
z6.enum(["llm", "scorer", "task", "tool"]),
|
|
2108
|
+
z6.null()
|
|
1861
2109
|
]);
|
|
1862
|
-
var FunctionIdRef =
|
|
1863
|
-
var PromptBlockData =
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
type:
|
|
1867
|
-
messages:
|
|
1868
|
-
tools:
|
|
2110
|
+
var FunctionIdRef = z6.object({}).partial().passthrough();
|
|
2111
|
+
var PromptBlockData = z6.union([
|
|
2112
|
+
z6.object({ type: z6.literal("completion"), content: z6.string() }),
|
|
2113
|
+
z6.object({
|
|
2114
|
+
type: z6.literal("chat"),
|
|
2115
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
2116
|
+
tools: z6.string().optional()
|
|
1869
2117
|
})
|
|
1870
2118
|
]);
|
|
1871
|
-
var GraphNode =
|
|
1872
|
-
|
|
1873
|
-
description:
|
|
1874
|
-
position:
|
|
1875
|
-
type:
|
|
2119
|
+
var GraphNode = z6.union([
|
|
2120
|
+
z6.object({
|
|
2121
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2122
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2123
|
+
type: z6.literal("function"),
|
|
1876
2124
|
function: FunctionIdRef
|
|
1877
2125
|
}),
|
|
1878
|
-
|
|
1879
|
-
description:
|
|
1880
|
-
position:
|
|
1881
|
-
type:
|
|
2126
|
+
z6.object({
|
|
2127
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2128
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2129
|
+
type: z6.literal("input")
|
|
1882
2130
|
}),
|
|
1883
|
-
|
|
1884
|
-
description:
|
|
1885
|
-
position:
|
|
1886
|
-
type:
|
|
2131
|
+
z6.object({
|
|
2132
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2133
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2134
|
+
type: z6.literal("output")
|
|
1887
2135
|
}),
|
|
1888
|
-
|
|
1889
|
-
description:
|
|
1890
|
-
position:
|
|
1891
|
-
type:
|
|
1892
|
-
value:
|
|
2136
|
+
z6.object({
|
|
2137
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2138
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2139
|
+
type: z6.literal("literal"),
|
|
2140
|
+
value: z6.unknown().optional()
|
|
1893
2141
|
}),
|
|
1894
|
-
|
|
1895
|
-
description:
|
|
1896
|
-
position:
|
|
1897
|
-
type:
|
|
1898
|
-
expr:
|
|
2142
|
+
z6.object({
|
|
2143
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2144
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2145
|
+
type: z6.literal("btql"),
|
|
2146
|
+
expr: z6.string()
|
|
1899
2147
|
}),
|
|
1900
|
-
|
|
1901
|
-
description:
|
|
1902
|
-
position:
|
|
1903
|
-
type:
|
|
1904
|
-
condition:
|
|
2148
|
+
z6.object({
|
|
2149
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2150
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2151
|
+
type: z6.literal("gate"),
|
|
2152
|
+
condition: z6.union([z6.string(), z6.null()]).optional()
|
|
1905
2153
|
}),
|
|
1906
|
-
|
|
1907
|
-
description:
|
|
1908
|
-
position:
|
|
1909
|
-
type:
|
|
2154
|
+
z6.object({
|
|
2155
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2156
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2157
|
+
type: z6.literal("aggregator")
|
|
1910
2158
|
}),
|
|
1911
|
-
|
|
1912
|
-
description:
|
|
1913
|
-
position:
|
|
1914
|
-
type:
|
|
2159
|
+
z6.object({
|
|
2160
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2161
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
2162
|
+
type: z6.literal("prompt_template"),
|
|
1915
2163
|
prompt: PromptBlockData
|
|
1916
2164
|
})
|
|
1917
2165
|
]);
|
|
1918
|
-
var GraphEdge =
|
|
1919
|
-
source:
|
|
1920
|
-
target:
|
|
1921
|
-
purpose:
|
|
2166
|
+
var GraphEdge = z6.object({
|
|
2167
|
+
source: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
|
|
2168
|
+
target: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
|
|
2169
|
+
purpose: z6.enum(["control", "data", "messages"])
|
|
1922
2170
|
});
|
|
1923
|
-
var GraphData =
|
|
1924
|
-
type:
|
|
1925
|
-
nodes:
|
|
1926
|
-
edges:
|
|
2171
|
+
var GraphData = z6.object({
|
|
2172
|
+
type: z6.literal("graph"),
|
|
2173
|
+
nodes: z6.record(GraphNode),
|
|
2174
|
+
edges: z6.record(GraphEdge)
|
|
1927
2175
|
});
|
|
1928
|
-
var FunctionData =
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
type:
|
|
1932
|
-
data:
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
type:
|
|
1936
|
-
runtime_context:
|
|
1937
|
-
runtime:
|
|
1938
|
-
version:
|
|
2176
|
+
var FunctionData = z6.union([
|
|
2177
|
+
z6.object({ type: z6.literal("prompt") }),
|
|
2178
|
+
z6.object({
|
|
2179
|
+
type: z6.literal("code"),
|
|
2180
|
+
data: z6.union([
|
|
2181
|
+
z6.object({ type: z6.literal("bundle") }).and(CodeBundle),
|
|
2182
|
+
z6.object({
|
|
2183
|
+
type: z6.literal("inline"),
|
|
2184
|
+
runtime_context: z6.object({
|
|
2185
|
+
runtime: z6.enum(["node", "python"]),
|
|
2186
|
+
version: z6.string()
|
|
1939
2187
|
}),
|
|
1940
|
-
code:
|
|
2188
|
+
code: z6.string()
|
|
1941
2189
|
})
|
|
1942
2190
|
])
|
|
1943
2191
|
}),
|
|
1944
2192
|
GraphData,
|
|
1945
|
-
|
|
1946
|
-
type:
|
|
1947
|
-
endpoint:
|
|
1948
|
-
eval_name:
|
|
1949
|
-
parameters:
|
|
2193
|
+
z6.object({
|
|
2194
|
+
type: z6.literal("remote_eval"),
|
|
2195
|
+
endpoint: z6.string(),
|
|
2196
|
+
eval_name: z6.string(),
|
|
2197
|
+
parameters: z6.object({}).partial().passthrough()
|
|
1950
2198
|
}),
|
|
1951
|
-
|
|
2199
|
+
z6.object({ type: z6.literal("global"), name: z6.string() })
|
|
1952
2200
|
]);
|
|
1953
|
-
var Function =
|
|
1954
|
-
id:
|
|
1955
|
-
_xact_id:
|
|
1956
|
-
project_id:
|
|
1957
|
-
log_id:
|
|
1958
|
-
org_id:
|
|
1959
|
-
name:
|
|
1960
|
-
slug:
|
|
1961
|
-
description:
|
|
1962
|
-
created:
|
|
2201
|
+
var Function = z6.object({
|
|
2202
|
+
id: z6.string().uuid(),
|
|
2203
|
+
_xact_id: z6.string(),
|
|
2204
|
+
project_id: z6.string().uuid(),
|
|
2205
|
+
log_id: z6.literal("p"),
|
|
2206
|
+
org_id: z6.string().uuid(),
|
|
2207
|
+
name: z6.string(),
|
|
2208
|
+
slug: z6.string(),
|
|
2209
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2210
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1963
2211
|
prompt_data: PromptDataNullish.optional(),
|
|
1964
|
-
tags:
|
|
1965
|
-
metadata:
|
|
2212
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2213
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1966
2214
|
function_type: FunctionTypeEnumNullish.optional(),
|
|
1967
2215
|
function_data: FunctionData,
|
|
1968
|
-
origin:
|
|
1969
|
-
|
|
1970
|
-
object_type: AclObjectType.and(
|
|
1971
|
-
object_id:
|
|
1972
|
-
internal:
|
|
2216
|
+
origin: z6.union([
|
|
2217
|
+
z6.object({
|
|
2218
|
+
object_type: AclObjectType.and(z6.string()),
|
|
2219
|
+
object_id: z6.string().uuid(),
|
|
2220
|
+
internal: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1973
2221
|
}),
|
|
1974
|
-
|
|
2222
|
+
z6.null()
|
|
1975
2223
|
]).optional(),
|
|
1976
|
-
function_schema:
|
|
1977
|
-
|
|
1978
|
-
|
|
2224
|
+
function_schema: z6.union([
|
|
2225
|
+
z6.object({ parameters: z6.unknown(), returns: z6.unknown() }).partial(),
|
|
2226
|
+
z6.null()
|
|
1979
2227
|
]).optional()
|
|
1980
2228
|
});
|
|
1981
|
-
var FunctionFormat =
|
|
1982
|
-
var PromptData =
|
|
2229
|
+
var FunctionFormat = z6.enum(["llm", "code", "global", "graph"]);
|
|
2230
|
+
var PromptData = z6.object({
|
|
1983
2231
|
prompt: PromptBlockDataNullish,
|
|
1984
2232
|
options: PromptOptionsNullish,
|
|
1985
2233
|
parser: PromptParserNullish,
|
|
1986
|
-
tool_functions:
|
|
1987
|
-
origin:
|
|
1988
|
-
|
|
1989
|
-
prompt_id:
|
|
1990
|
-
project_id:
|
|
1991
|
-
prompt_version:
|
|
2234
|
+
tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
|
|
2235
|
+
origin: z6.union([
|
|
2236
|
+
z6.object({
|
|
2237
|
+
prompt_id: z6.string(),
|
|
2238
|
+
project_id: z6.string(),
|
|
2239
|
+
prompt_version: z6.string()
|
|
1992
2240
|
}).partial(),
|
|
1993
|
-
|
|
2241
|
+
z6.null()
|
|
1994
2242
|
])
|
|
1995
2243
|
}).partial();
|
|
1996
|
-
var FunctionTypeEnum =
|
|
1997
|
-
var FunctionId =
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
project_name:
|
|
2001
|
-
slug:
|
|
2002
|
-
version:
|
|
2244
|
+
var FunctionTypeEnum = z6.enum(["llm", "scorer", "task", "tool"]);
|
|
2245
|
+
var FunctionId = z6.union([
|
|
2246
|
+
z6.object({ function_id: z6.string(), version: z6.string().optional() }),
|
|
2247
|
+
z6.object({
|
|
2248
|
+
project_name: z6.string(),
|
|
2249
|
+
slug: z6.string(),
|
|
2250
|
+
version: z6.string().optional()
|
|
2003
2251
|
}),
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
prompt_session_id:
|
|
2007
|
-
prompt_session_function_id:
|
|
2008
|
-
version:
|
|
2252
|
+
z6.object({ global_function: z6.string() }),
|
|
2253
|
+
z6.object({
|
|
2254
|
+
prompt_session_id: z6.string(),
|
|
2255
|
+
prompt_session_function_id: z6.string(),
|
|
2256
|
+
version: z6.string().optional()
|
|
2009
2257
|
}),
|
|
2010
|
-
|
|
2011
|
-
inline_context:
|
|
2012
|
-
runtime:
|
|
2013
|
-
version:
|
|
2258
|
+
z6.object({
|
|
2259
|
+
inline_context: z6.object({
|
|
2260
|
+
runtime: z6.enum(["node", "python"]),
|
|
2261
|
+
version: z6.string()
|
|
2014
2262
|
}),
|
|
2015
|
-
code:
|
|
2016
|
-
name:
|
|
2263
|
+
code: z6.string(),
|
|
2264
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
2017
2265
|
}),
|
|
2018
|
-
|
|
2266
|
+
z6.object({
|
|
2019
2267
|
inline_prompt: PromptData.optional(),
|
|
2020
|
-
inline_function:
|
|
2268
|
+
inline_function: z6.object({}).partial().passthrough(),
|
|
2021
2269
|
function_type: FunctionTypeEnum.optional(),
|
|
2022
|
-
name:
|
|
2270
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
2023
2271
|
}),
|
|
2024
|
-
|
|
2272
|
+
z6.object({
|
|
2025
2273
|
inline_prompt: PromptData,
|
|
2026
2274
|
function_type: FunctionTypeEnum.optional(),
|
|
2027
|
-
name:
|
|
2275
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
2028
2276
|
})
|
|
2029
2277
|
]);
|
|
2030
|
-
var FunctionObjectType =
|
|
2278
|
+
var FunctionObjectType = z6.enum([
|
|
2031
2279
|
"prompt",
|
|
2032
2280
|
"tool",
|
|
2033
2281
|
"scorer",
|
|
2034
2282
|
"task",
|
|
2035
2283
|
"agent"
|
|
2036
2284
|
]);
|
|
2037
|
-
var FunctionOutputType =
|
|
2038
|
-
var GitMetadataSettings =
|
|
2039
|
-
collect:
|
|
2040
|
-
fields:
|
|
2041
|
-
|
|
2285
|
+
var FunctionOutputType = z6.enum(["completion", "score", "any"]);
|
|
2286
|
+
var GitMetadataSettings = z6.object({
|
|
2287
|
+
collect: z6.enum(["all", "none", "some"]),
|
|
2288
|
+
fields: z6.array(
|
|
2289
|
+
z6.enum([
|
|
2042
2290
|
"commit",
|
|
2043
2291
|
"branch",
|
|
2044
2292
|
"tag",
|
|
@@ -2051,49 +2299,49 @@ var GitMetadataSettings = z5.object({
|
|
|
2051
2299
|
])
|
|
2052
2300
|
).optional()
|
|
2053
2301
|
});
|
|
2054
|
-
var Group =
|
|
2055
|
-
id:
|
|
2056
|
-
org_id:
|
|
2057
|
-
user_id:
|
|
2058
|
-
created:
|
|
2059
|
-
name:
|
|
2060
|
-
description:
|
|
2061
|
-
deleted_at:
|
|
2062
|
-
member_users:
|
|
2063
|
-
member_groups:
|
|
2302
|
+
var Group = z6.object({
|
|
2303
|
+
id: z6.string().uuid(),
|
|
2304
|
+
org_id: z6.string().uuid(),
|
|
2305
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2306
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2307
|
+
name: z6.string(),
|
|
2308
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2309
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2310
|
+
member_users: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional(),
|
|
2311
|
+
member_groups: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
|
|
2064
2312
|
});
|
|
2065
|
-
var IfExists =
|
|
2066
|
-
var InvokeParent =
|
|
2067
|
-
|
|
2068
|
-
object_type:
|
|
2069
|
-
object_id:
|
|
2070
|
-
row_ids:
|
|
2071
|
-
|
|
2072
|
-
id:
|
|
2073
|
-
span_id:
|
|
2074
|
-
root_span_id:
|
|
2313
|
+
var IfExists = z6.enum(["error", "ignore", "replace"]);
|
|
2314
|
+
var InvokeParent = z6.union([
|
|
2315
|
+
z6.object({
|
|
2316
|
+
object_type: z6.enum(["project_logs", "experiment", "playground_logs"]),
|
|
2317
|
+
object_id: z6.string(),
|
|
2318
|
+
row_ids: z6.union([
|
|
2319
|
+
z6.object({
|
|
2320
|
+
id: z6.string(),
|
|
2321
|
+
span_id: z6.string(),
|
|
2322
|
+
root_span_id: z6.string()
|
|
2075
2323
|
}),
|
|
2076
|
-
|
|
2324
|
+
z6.null()
|
|
2077
2325
|
]).optional(),
|
|
2078
|
-
propagated_event:
|
|
2326
|
+
propagated_event: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
2079
2327
|
}),
|
|
2080
|
-
|
|
2328
|
+
z6.string()
|
|
2081
2329
|
]);
|
|
2082
|
-
var StreamingMode =
|
|
2330
|
+
var StreamingMode = z6.union([z6.enum(["auto", "parallel"]), z6.null()]);
|
|
2083
2331
|
var InvokeFunction = FunctionId.and(
|
|
2084
|
-
|
|
2085
|
-
input:
|
|
2086
|
-
expected:
|
|
2087
|
-
metadata:
|
|
2088
|
-
tags:
|
|
2089
|
-
messages:
|
|
2332
|
+
z6.object({
|
|
2333
|
+
input: z6.unknown(),
|
|
2334
|
+
expected: z6.unknown(),
|
|
2335
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]),
|
|
2336
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]),
|
|
2337
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
2090
2338
|
parent: InvokeParent,
|
|
2091
|
-
stream:
|
|
2339
|
+
stream: z6.union([z6.boolean(), z6.null()]),
|
|
2092
2340
|
mode: StreamingMode,
|
|
2093
|
-
strict:
|
|
2341
|
+
strict: z6.union([z6.boolean(), z6.null()])
|
|
2094
2342
|
}).partial()
|
|
2095
2343
|
);
|
|
2096
|
-
var MessageRole =
|
|
2344
|
+
var MessageRole = z6.enum([
|
|
2097
2345
|
"system",
|
|
2098
2346
|
"user",
|
|
2099
2347
|
"assistant",
|
|
@@ -2102,8 +2350,8 @@ var MessageRole = z5.enum([
|
|
|
2102
2350
|
"model",
|
|
2103
2351
|
"developer"
|
|
2104
2352
|
]);
|
|
2105
|
-
var ObjectReference =
|
|
2106
|
-
object_type:
|
|
2353
|
+
var ObjectReference = z6.object({
|
|
2354
|
+
object_type: z6.enum([
|
|
2107
2355
|
"project_logs",
|
|
2108
2356
|
"experiment",
|
|
2109
2357
|
"dataset",
|
|
@@ -2111,146 +2359,146 @@ var ObjectReference = z5.object({
|
|
|
2111
2359
|
"function",
|
|
2112
2360
|
"prompt_session"
|
|
2113
2361
|
]),
|
|
2114
|
-
object_id:
|
|
2115
|
-
id:
|
|
2116
|
-
_xact_id:
|
|
2117
|
-
created:
|
|
2362
|
+
object_id: z6.string().uuid(),
|
|
2363
|
+
id: z6.string(),
|
|
2364
|
+
_xact_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2365
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
2118
2366
|
});
|
|
2119
|
-
var OnlineScoreConfig =
|
|
2120
|
-
|
|
2121
|
-
sampling_rate:
|
|
2122
|
-
scorers:
|
|
2123
|
-
btql_filter:
|
|
2124
|
-
apply_to_root_span:
|
|
2125
|
-
apply_to_span_names:
|
|
2126
|
-
skip_logging:
|
|
2367
|
+
var OnlineScoreConfig = z6.union([
|
|
2368
|
+
z6.object({
|
|
2369
|
+
sampling_rate: z6.number().gte(0).lte(1),
|
|
2370
|
+
scorers: z6.array(SavedFunctionId),
|
|
2371
|
+
btql_filter: z6.union([z6.string(), z6.null()]).optional(),
|
|
2372
|
+
apply_to_root_span: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2373
|
+
apply_to_span_names: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2374
|
+
skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
|
|
2127
2375
|
}),
|
|
2128
|
-
|
|
2376
|
+
z6.null()
|
|
2129
2377
|
]);
|
|
2130
|
-
var Organization =
|
|
2131
|
-
id:
|
|
2132
|
-
name:
|
|
2133
|
-
api_url:
|
|
2134
|
-
is_universal_api:
|
|
2135
|
-
proxy_url:
|
|
2136
|
-
realtime_url:
|
|
2137
|
-
created:
|
|
2378
|
+
var Organization = z6.object({
|
|
2379
|
+
id: z6.string().uuid(),
|
|
2380
|
+
name: z6.string(),
|
|
2381
|
+
api_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
2382
|
+
is_universal_api: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2383
|
+
proxy_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
2384
|
+
realtime_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
2385
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
2138
2386
|
});
|
|
2139
|
-
var ProjectSettings =
|
|
2140
|
-
|
|
2141
|
-
comparison_key:
|
|
2142
|
-
baseline_experiment_id:
|
|
2143
|
-
spanFieldOrder:
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
object_type:
|
|
2147
|
-
column_id:
|
|
2148
|
-
position:
|
|
2149
|
-
layout:
|
|
2387
|
+
var ProjectSettings = z6.union([
|
|
2388
|
+
z6.object({
|
|
2389
|
+
comparison_key: z6.union([z6.string(), z6.null()]),
|
|
2390
|
+
baseline_experiment_id: z6.union([z6.string(), z6.null()]),
|
|
2391
|
+
spanFieldOrder: z6.union([
|
|
2392
|
+
z6.array(
|
|
2393
|
+
z6.object({
|
|
2394
|
+
object_type: z6.string(),
|
|
2395
|
+
column_id: z6.string(),
|
|
2396
|
+
position: z6.string(),
|
|
2397
|
+
layout: z6.union([z6.literal("full"), z6.literal("two_column"), z6.null()]).optional()
|
|
2150
2398
|
})
|
|
2151
2399
|
),
|
|
2152
|
-
|
|
2400
|
+
z6.null()
|
|
2153
2401
|
]),
|
|
2154
|
-
remote_eval_sources:
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
url:
|
|
2158
|
-
name:
|
|
2159
|
-
description:
|
|
2402
|
+
remote_eval_sources: z6.union([
|
|
2403
|
+
z6.array(
|
|
2404
|
+
z6.object({
|
|
2405
|
+
url: z6.string(),
|
|
2406
|
+
name: z6.string(),
|
|
2407
|
+
description: z6.union([z6.string(), z6.null()]).optional()
|
|
2160
2408
|
})
|
|
2161
2409
|
),
|
|
2162
|
-
|
|
2410
|
+
z6.null()
|
|
2163
2411
|
])
|
|
2164
2412
|
}).partial(),
|
|
2165
|
-
|
|
2413
|
+
z6.null()
|
|
2166
2414
|
]);
|
|
2167
|
-
var Project =
|
|
2168
|
-
id:
|
|
2169
|
-
org_id:
|
|
2170
|
-
name:
|
|
2171
|
-
created:
|
|
2172
|
-
deleted_at:
|
|
2173
|
-
user_id:
|
|
2415
|
+
var Project = z6.object({
|
|
2416
|
+
id: z6.string().uuid(),
|
|
2417
|
+
org_id: z6.string().uuid(),
|
|
2418
|
+
name: z6.string(),
|
|
2419
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2420
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2421
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2174
2422
|
settings: ProjectSettings.optional()
|
|
2175
2423
|
});
|
|
2176
|
-
var RetentionObjectType =
|
|
2424
|
+
var RetentionObjectType = z6.enum([
|
|
2177
2425
|
"project_logs",
|
|
2178
2426
|
"experiment",
|
|
2179
2427
|
"dataset"
|
|
2180
2428
|
]);
|
|
2181
|
-
var ProjectAutomation =
|
|
2182
|
-
id:
|
|
2183
|
-
project_id:
|
|
2184
|
-
user_id:
|
|
2185
|
-
created:
|
|
2186
|
-
name:
|
|
2187
|
-
description:
|
|
2188
|
-
config:
|
|
2189
|
-
|
|
2190
|
-
event_type:
|
|
2191
|
-
btql_filter:
|
|
2192
|
-
interval_seconds:
|
|
2193
|
-
action:
|
|
2429
|
+
var ProjectAutomation = z6.object({
|
|
2430
|
+
id: z6.string().uuid(),
|
|
2431
|
+
project_id: z6.string().uuid(),
|
|
2432
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2433
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2434
|
+
name: z6.string(),
|
|
2435
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2436
|
+
config: z6.union([
|
|
2437
|
+
z6.object({
|
|
2438
|
+
event_type: z6.literal("logs"),
|
|
2439
|
+
btql_filter: z6.string(),
|
|
2440
|
+
interval_seconds: z6.number().gte(1).lte(2592e3),
|
|
2441
|
+
action: z6.object({ type: z6.literal("webhook"), url: z6.string() })
|
|
2194
2442
|
}),
|
|
2195
|
-
|
|
2196
|
-
event_type:
|
|
2197
|
-
export_definition:
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2443
|
+
z6.object({
|
|
2444
|
+
event_type: z6.literal("btql_export"),
|
|
2445
|
+
export_definition: z6.union([
|
|
2446
|
+
z6.object({ type: z6.literal("log_traces") }),
|
|
2447
|
+
z6.object({ type: z6.literal("log_spans") }),
|
|
2448
|
+
z6.object({ type: z6.literal("btql_query"), btql_query: z6.string() })
|
|
2201
2449
|
]),
|
|
2202
|
-
export_path:
|
|
2203
|
-
format:
|
|
2204
|
-
interval_seconds:
|
|
2205
|
-
credentials:
|
|
2206
|
-
type:
|
|
2207
|
-
role_arn:
|
|
2208
|
-
external_id:
|
|
2450
|
+
export_path: z6.string(),
|
|
2451
|
+
format: z6.enum(["jsonl", "parquet"]),
|
|
2452
|
+
interval_seconds: z6.number().gte(1).lte(2592e3),
|
|
2453
|
+
credentials: z6.object({
|
|
2454
|
+
type: z6.literal("aws_iam"),
|
|
2455
|
+
role_arn: z6.string(),
|
|
2456
|
+
external_id: z6.string()
|
|
2209
2457
|
}),
|
|
2210
|
-
batch_size:
|
|
2458
|
+
batch_size: z6.union([z6.number(), z6.null()]).optional()
|
|
2211
2459
|
}),
|
|
2212
|
-
|
|
2213
|
-
event_type:
|
|
2460
|
+
z6.object({
|
|
2461
|
+
event_type: z6.literal("retention"),
|
|
2214
2462
|
object_type: RetentionObjectType,
|
|
2215
|
-
retention_days:
|
|
2463
|
+
retention_days: z6.number().gte(0)
|
|
2216
2464
|
})
|
|
2217
2465
|
])
|
|
2218
2466
|
});
|
|
2219
|
-
var ProjectLogsEvent =
|
|
2220
|
-
id:
|
|
2221
|
-
_xact_id:
|
|
2222
|
-
_pagination_key:
|
|
2223
|
-
created:
|
|
2224
|
-
org_id:
|
|
2225
|
-
project_id:
|
|
2226
|
-
log_id:
|
|
2227
|
-
input:
|
|
2228
|
-
output:
|
|
2229
|
-
expected:
|
|
2230
|
-
error:
|
|
2231
|
-
scores:
|
|
2232
|
-
metadata:
|
|
2233
|
-
|
|
2234
|
-
|
|
2467
|
+
var ProjectLogsEvent = z6.object({
|
|
2468
|
+
id: z6.string(),
|
|
2469
|
+
_xact_id: z6.string(),
|
|
2470
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
2471
|
+
created: z6.string().datetime({ offset: true }),
|
|
2472
|
+
org_id: z6.string().uuid(),
|
|
2473
|
+
project_id: z6.string().uuid(),
|
|
2474
|
+
log_id: z6.literal("g"),
|
|
2475
|
+
input: z6.unknown().optional(),
|
|
2476
|
+
output: z6.unknown().optional(),
|
|
2477
|
+
expected: z6.unknown().optional(),
|
|
2478
|
+
error: z6.unknown().optional(),
|
|
2479
|
+
scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
|
|
2480
|
+
metadata: z6.union([
|
|
2481
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
2482
|
+
z6.null()
|
|
2235
2483
|
]).optional(),
|
|
2236
|
-
tags:
|
|
2237
|
-
metrics:
|
|
2238
|
-
context:
|
|
2239
|
-
|
|
2240
|
-
caller_functionname:
|
|
2241
|
-
caller_filename:
|
|
2242
|
-
caller_lineno:
|
|
2484
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2485
|
+
metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
|
|
2486
|
+
context: z6.union([
|
|
2487
|
+
z6.object({
|
|
2488
|
+
caller_functionname: z6.union([z6.string(), z6.null()]),
|
|
2489
|
+
caller_filename: z6.union([z6.string(), z6.null()]),
|
|
2490
|
+
caller_lineno: z6.union([z6.number(), z6.null()])
|
|
2243
2491
|
}).partial().passthrough(),
|
|
2244
|
-
|
|
2492
|
+
z6.null()
|
|
2245
2493
|
]).optional(),
|
|
2246
|
-
span_id:
|
|
2247
|
-
span_parents:
|
|
2248
|
-
root_span_id:
|
|
2249
|
-
is_root:
|
|
2494
|
+
span_id: z6.string(),
|
|
2495
|
+
span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2496
|
+
root_span_id: z6.string(),
|
|
2497
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2250
2498
|
span_attributes: SpanAttributes.optional(),
|
|
2251
2499
|
origin: ObjectReferenceNullish.optional()
|
|
2252
2500
|
});
|
|
2253
|
-
var ProjectScoreType =
|
|
2501
|
+
var ProjectScoreType = z6.enum([
|
|
2254
2502
|
"slider",
|
|
2255
2503
|
"categorical",
|
|
2256
2504
|
"weighted",
|
|
@@ -2259,172 +2507,172 @@ var ProjectScoreType = z5.enum([
|
|
|
2259
2507
|
"online",
|
|
2260
2508
|
"free-form"
|
|
2261
2509
|
]);
|
|
2262
|
-
var ProjectScoreCategory =
|
|
2263
|
-
name:
|
|
2264
|
-
value:
|
|
2510
|
+
var ProjectScoreCategory = z6.object({
|
|
2511
|
+
name: z6.string(),
|
|
2512
|
+
value: z6.number()
|
|
2265
2513
|
});
|
|
2266
|
-
var ProjectScoreCategories =
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2514
|
+
var ProjectScoreCategories = z6.union([
|
|
2515
|
+
z6.array(ProjectScoreCategory),
|
|
2516
|
+
z6.record(z6.number()),
|
|
2517
|
+
z6.array(z6.string()),
|
|
2518
|
+
z6.null()
|
|
2271
2519
|
]);
|
|
2272
|
-
var ProjectScoreConfig =
|
|
2273
|
-
|
|
2274
|
-
multi_select:
|
|
2275
|
-
destination:
|
|
2520
|
+
var ProjectScoreConfig = z6.union([
|
|
2521
|
+
z6.object({
|
|
2522
|
+
multi_select: z6.union([z6.boolean(), z6.null()]),
|
|
2523
|
+
destination: z6.union([z6.string(), z6.null()]),
|
|
2276
2524
|
online: OnlineScoreConfig
|
|
2277
2525
|
}).partial(),
|
|
2278
|
-
|
|
2526
|
+
z6.null()
|
|
2279
2527
|
]);
|
|
2280
|
-
var ProjectScore =
|
|
2281
|
-
id:
|
|
2282
|
-
project_id:
|
|
2283
|
-
user_id:
|
|
2284
|
-
created:
|
|
2285
|
-
name:
|
|
2286
|
-
description:
|
|
2528
|
+
var ProjectScore = z6.object({
|
|
2529
|
+
id: z6.string().uuid(),
|
|
2530
|
+
project_id: z6.string().uuid(),
|
|
2531
|
+
user_id: z6.string().uuid(),
|
|
2532
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2533
|
+
name: z6.string(),
|
|
2534
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2287
2535
|
score_type: ProjectScoreType,
|
|
2288
2536
|
categories: ProjectScoreCategories.optional(),
|
|
2289
2537
|
config: ProjectScoreConfig.optional(),
|
|
2290
|
-
position:
|
|
2538
|
+
position: z6.union([z6.string(), z6.null()]).optional()
|
|
2291
2539
|
});
|
|
2292
|
-
var ProjectTag =
|
|
2293
|
-
id:
|
|
2294
|
-
project_id:
|
|
2295
|
-
user_id:
|
|
2296
|
-
created:
|
|
2297
|
-
name:
|
|
2298
|
-
description:
|
|
2299
|
-
color:
|
|
2300
|
-
position:
|
|
2540
|
+
var ProjectTag = z6.object({
|
|
2541
|
+
id: z6.string().uuid(),
|
|
2542
|
+
project_id: z6.string().uuid(),
|
|
2543
|
+
user_id: z6.string().uuid(),
|
|
2544
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2545
|
+
name: z6.string(),
|
|
2546
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2547
|
+
color: z6.union([z6.string(), z6.null()]).optional(),
|
|
2548
|
+
position: z6.union([z6.string(), z6.null()]).optional()
|
|
2301
2549
|
});
|
|
2302
|
-
var Prompt =
|
|
2303
|
-
id:
|
|
2304
|
-
_xact_id:
|
|
2305
|
-
project_id:
|
|
2306
|
-
log_id:
|
|
2307
|
-
org_id:
|
|
2308
|
-
name:
|
|
2309
|
-
slug:
|
|
2310
|
-
description:
|
|
2311
|
-
created:
|
|
2550
|
+
var Prompt = z6.object({
|
|
2551
|
+
id: z6.string().uuid(),
|
|
2552
|
+
_xact_id: z6.string(),
|
|
2553
|
+
project_id: z6.string().uuid(),
|
|
2554
|
+
log_id: z6.literal("p"),
|
|
2555
|
+
org_id: z6.string().uuid(),
|
|
2556
|
+
name: z6.string(),
|
|
2557
|
+
slug: z6.string(),
|
|
2558
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2559
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2312
2560
|
prompt_data: PromptDataNullish.optional(),
|
|
2313
|
-
tags:
|
|
2314
|
-
metadata:
|
|
2561
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2562
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
2315
2563
|
function_type: FunctionTypeEnumNullish.optional()
|
|
2316
2564
|
});
|
|
2317
|
-
var PromptOptions =
|
|
2318
|
-
var PromptSessionEvent =
|
|
2319
|
-
id:
|
|
2320
|
-
_xact_id:
|
|
2321
|
-
created:
|
|
2322
|
-
_pagination_key:
|
|
2323
|
-
project_id:
|
|
2324
|
-
prompt_session_id:
|
|
2325
|
-
prompt_session_data:
|
|
2326
|
-
prompt_data:
|
|
2327
|
-
function_data:
|
|
2565
|
+
var PromptOptions = z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial();
|
|
2566
|
+
var PromptSessionEvent = z6.object({
|
|
2567
|
+
id: z6.string(),
|
|
2568
|
+
_xact_id: z6.string(),
|
|
2569
|
+
created: z6.string().datetime({ offset: true }),
|
|
2570
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
2571
|
+
project_id: z6.string().uuid(),
|
|
2572
|
+
prompt_session_id: z6.string().uuid(),
|
|
2573
|
+
prompt_session_data: z6.unknown().optional(),
|
|
2574
|
+
prompt_data: z6.unknown().optional(),
|
|
2575
|
+
function_data: z6.unknown().optional(),
|
|
2328
2576
|
function_type: FunctionTypeEnumNullish.optional(),
|
|
2329
|
-
object_data:
|
|
2330
|
-
completion:
|
|
2331
|
-
tags:
|
|
2577
|
+
object_data: z6.unknown().optional(),
|
|
2578
|
+
completion: z6.unknown().optional(),
|
|
2579
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
|
|
2332
2580
|
});
|
|
2333
|
-
var ResponseFormat =
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
type:
|
|
2581
|
+
var ResponseFormat = z6.union([
|
|
2582
|
+
z6.object({ type: z6.literal("json_object") }),
|
|
2583
|
+
z6.object({
|
|
2584
|
+
type: z6.literal("json_schema"),
|
|
2337
2585
|
json_schema: ResponseFormatJsonSchema
|
|
2338
2586
|
}),
|
|
2339
|
-
|
|
2587
|
+
z6.object({ type: z6.literal("text") })
|
|
2340
2588
|
]);
|
|
2341
|
-
var Role =
|
|
2342
|
-
id:
|
|
2343
|
-
org_id:
|
|
2344
|
-
user_id:
|
|
2345
|
-
created:
|
|
2346
|
-
name:
|
|
2347
|
-
description:
|
|
2348
|
-
deleted_at:
|
|
2349
|
-
member_permissions:
|
|
2350
|
-
|
|
2351
|
-
|
|
2589
|
+
var Role = z6.object({
|
|
2590
|
+
id: z6.string().uuid(),
|
|
2591
|
+
org_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2592
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2593
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2594
|
+
name: z6.string(),
|
|
2595
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2596
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2597
|
+
member_permissions: z6.union([
|
|
2598
|
+
z6.array(
|
|
2599
|
+
z6.object({
|
|
2352
2600
|
permission: Permission,
|
|
2353
2601
|
restrict_object_type: AclObjectType.optional()
|
|
2354
2602
|
})
|
|
2355
2603
|
),
|
|
2356
|
-
|
|
2604
|
+
z6.null()
|
|
2357
2605
|
]).optional(),
|
|
2358
|
-
member_roles:
|
|
2606
|
+
member_roles: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
|
|
2359
2607
|
});
|
|
2360
|
-
var RunEval =
|
|
2361
|
-
project_id:
|
|
2362
|
-
data:
|
|
2363
|
-
|
|
2364
|
-
dataset_id:
|
|
2365
|
-
_internal_btql:
|
|
2608
|
+
var RunEval = z6.object({
|
|
2609
|
+
project_id: z6.string(),
|
|
2610
|
+
data: z6.union([
|
|
2611
|
+
z6.object({
|
|
2612
|
+
dataset_id: z6.string(),
|
|
2613
|
+
_internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
2366
2614
|
}),
|
|
2367
|
-
|
|
2368
|
-
project_name:
|
|
2369
|
-
dataset_name:
|
|
2370
|
-
_internal_btql:
|
|
2615
|
+
z6.object({
|
|
2616
|
+
project_name: z6.string(),
|
|
2617
|
+
dataset_name: z6.string(),
|
|
2618
|
+
_internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
2371
2619
|
}),
|
|
2372
|
-
|
|
2620
|
+
z6.object({ data: z6.array(z6.unknown()) })
|
|
2373
2621
|
]),
|
|
2374
|
-
task: FunctionId.and(
|
|
2375
|
-
scores:
|
|
2376
|
-
experiment_name:
|
|
2377
|
-
metadata:
|
|
2378
|
-
parent: InvokeParent.and(
|
|
2379
|
-
stream:
|
|
2380
|
-
trial_count:
|
|
2381
|
-
is_public:
|
|
2382
|
-
timeout:
|
|
2383
|
-
max_concurrency:
|
|
2384
|
-
base_experiment_name:
|
|
2385
|
-
base_experiment_id:
|
|
2622
|
+
task: FunctionId.and(z6.unknown()),
|
|
2623
|
+
scores: z6.array(FunctionId),
|
|
2624
|
+
experiment_name: z6.string().optional(),
|
|
2625
|
+
metadata: z6.object({}).partial().passthrough().optional(),
|
|
2626
|
+
parent: InvokeParent.and(z6.unknown()).optional(),
|
|
2627
|
+
stream: z6.boolean().optional(),
|
|
2628
|
+
trial_count: z6.union([z6.number(), z6.null()]).optional(),
|
|
2629
|
+
is_public: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2630
|
+
timeout: z6.union([z6.number(), z6.null()]).optional(),
|
|
2631
|
+
max_concurrency: z6.union([z6.number(), z6.null()]).optional().default(10),
|
|
2632
|
+
base_experiment_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2633
|
+
base_experiment_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2386
2634
|
git_metadata_settings: GitMetadataSettings.and(
|
|
2387
|
-
|
|
2635
|
+
z6.union([z6.object({}).partial(), z6.null()])
|
|
2388
2636
|
).optional(),
|
|
2389
|
-
repo_info: RepoInfo.and(
|
|
2390
|
-
strict:
|
|
2391
|
-
stop_token:
|
|
2392
|
-
extra_messages:
|
|
2393
|
-
tags:
|
|
2637
|
+
repo_info: RepoInfo.and(z6.unknown()).optional(),
|
|
2638
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2639
|
+
stop_token: z6.union([z6.string(), z6.null()]).optional(),
|
|
2640
|
+
extra_messages: z6.string().optional(),
|
|
2641
|
+
tags: z6.array(z6.string()).optional()
|
|
2394
2642
|
});
|
|
2395
|
-
var ServiceToken =
|
|
2396
|
-
id:
|
|
2397
|
-
created:
|
|
2398
|
-
name:
|
|
2399
|
-
preview_name:
|
|
2400
|
-
service_account_id:
|
|
2401
|
-
service_account_email:
|
|
2402
|
-
service_account_name:
|
|
2403
|
-
org_id:
|
|
2643
|
+
var ServiceToken = z6.object({
|
|
2644
|
+
id: z6.string().uuid(),
|
|
2645
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2646
|
+
name: z6.string(),
|
|
2647
|
+
preview_name: z6.string(),
|
|
2648
|
+
service_account_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2649
|
+
service_account_email: z6.union([z6.string(), z6.null()]).optional(),
|
|
2650
|
+
service_account_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2651
|
+
org_id: z6.union([z6.string(), z6.null()]).optional()
|
|
2404
2652
|
});
|
|
2405
|
-
var SpanIFrame =
|
|
2406
|
-
id:
|
|
2407
|
-
project_id:
|
|
2408
|
-
user_id:
|
|
2409
|
-
created:
|
|
2410
|
-
deleted_at:
|
|
2411
|
-
name:
|
|
2412
|
-
description:
|
|
2413
|
-
url:
|
|
2414
|
-
post_message:
|
|
2653
|
+
var SpanIFrame = z6.object({
|
|
2654
|
+
id: z6.string().uuid(),
|
|
2655
|
+
project_id: z6.string().uuid(),
|
|
2656
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2657
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2658
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2659
|
+
name: z6.string(),
|
|
2660
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2661
|
+
url: z6.string(),
|
|
2662
|
+
post_message: z6.union([z6.boolean(), z6.null()]).optional()
|
|
2415
2663
|
});
|
|
2416
|
-
var SSEConsoleEventData =
|
|
2417
|
-
stream:
|
|
2418
|
-
message:
|
|
2664
|
+
var SSEConsoleEventData = z6.object({
|
|
2665
|
+
stream: z6.enum(["stderr", "stdout"]),
|
|
2666
|
+
message: z6.string()
|
|
2419
2667
|
});
|
|
2420
|
-
var SSEProgressEventData =
|
|
2421
|
-
id:
|
|
2668
|
+
var SSEProgressEventData = z6.object({
|
|
2669
|
+
id: z6.string(),
|
|
2422
2670
|
object_type: FunctionObjectType,
|
|
2423
|
-
origin: ObjectReferenceNullish.and(
|
|
2671
|
+
origin: ObjectReferenceNullish.and(z6.unknown()).optional(),
|
|
2424
2672
|
format: FunctionFormat,
|
|
2425
2673
|
output_type: FunctionOutputType,
|
|
2426
|
-
name:
|
|
2427
|
-
event:
|
|
2674
|
+
name: z6.string(),
|
|
2675
|
+
event: z6.enum([
|
|
2428
2676
|
"reasoning_delta",
|
|
2429
2677
|
"text_delta",
|
|
2430
2678
|
"json_delta",
|
|
@@ -2434,110 +2682,110 @@ var SSEProgressEventData = z5.object({
|
|
|
2434
2682
|
"done",
|
|
2435
2683
|
"progress"
|
|
2436
2684
|
]),
|
|
2437
|
-
data:
|
|
2685
|
+
data: z6.string()
|
|
2438
2686
|
});
|
|
2439
|
-
var ToolFunctionDefinition =
|
|
2440
|
-
type:
|
|
2441
|
-
function:
|
|
2442
|
-
name:
|
|
2443
|
-
description:
|
|
2444
|
-
parameters:
|
|
2445
|
-
strict:
|
|
2687
|
+
var ToolFunctionDefinition = z6.object({
|
|
2688
|
+
type: z6.literal("function"),
|
|
2689
|
+
function: z6.object({
|
|
2690
|
+
name: z6.string(),
|
|
2691
|
+
description: z6.string().optional(),
|
|
2692
|
+
parameters: z6.object({}).partial().passthrough().optional(),
|
|
2693
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional()
|
|
2446
2694
|
})
|
|
2447
2695
|
});
|
|
2448
|
-
var User =
|
|
2449
|
-
id:
|
|
2450
|
-
given_name:
|
|
2451
|
-
family_name:
|
|
2452
|
-
email:
|
|
2453
|
-
avatar_url:
|
|
2454
|
-
created:
|
|
2696
|
+
var User = z6.object({
|
|
2697
|
+
id: z6.string().uuid(),
|
|
2698
|
+
given_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2699
|
+
family_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2700
|
+
email: z6.union([z6.string(), z6.null()]).optional(),
|
|
2701
|
+
avatar_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
2702
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
2455
2703
|
});
|
|
2456
|
-
var ViewDataSearch =
|
|
2457
|
-
|
|
2458
|
-
filter:
|
|
2459
|
-
tag:
|
|
2460
|
-
match:
|
|
2461
|
-
sort:
|
|
2704
|
+
var ViewDataSearch = z6.union([
|
|
2705
|
+
z6.object({
|
|
2706
|
+
filter: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2707
|
+
tag: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2708
|
+
match: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2709
|
+
sort: z6.union([z6.array(z6.unknown()), z6.null()])
|
|
2462
2710
|
}).partial(),
|
|
2463
|
-
|
|
2711
|
+
z6.null()
|
|
2464
2712
|
]);
|
|
2465
|
-
var ViewData =
|
|
2466
|
-
|
|
2467
|
-
|
|
2713
|
+
var ViewData = z6.union([
|
|
2714
|
+
z6.object({ search: ViewDataSearch }).partial(),
|
|
2715
|
+
z6.null()
|
|
2468
2716
|
]);
|
|
2469
|
-
var ViewOptions =
|
|
2470
|
-
|
|
2471
|
-
viewType:
|
|
2472
|
-
options:
|
|
2473
|
-
spanType:
|
|
2474
|
-
rangeValue:
|
|
2475
|
-
frameStart:
|
|
2476
|
-
frameEnd:
|
|
2477
|
-
tzUTC:
|
|
2478
|
-
chartVisibility:
|
|
2479
|
-
projectId:
|
|
2480
|
-
type:
|
|
2481
|
-
groupBy:
|
|
2717
|
+
var ViewOptions = z6.union([
|
|
2718
|
+
z6.object({
|
|
2719
|
+
viewType: z6.literal("monitor"),
|
|
2720
|
+
options: z6.object({
|
|
2721
|
+
spanType: z6.union([z6.enum(["range", "frame"]), z6.null()]),
|
|
2722
|
+
rangeValue: z6.union([z6.string(), z6.null()]),
|
|
2723
|
+
frameStart: z6.union([z6.string(), z6.null()]),
|
|
2724
|
+
frameEnd: z6.union([z6.string(), z6.null()]),
|
|
2725
|
+
tzUTC: z6.union([z6.boolean(), z6.null()]),
|
|
2726
|
+
chartVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
|
|
2727
|
+
projectId: z6.union([z6.string(), z6.null()]),
|
|
2728
|
+
type: z6.union([z6.enum(["project", "experiment"]), z6.null()]),
|
|
2729
|
+
groupBy: z6.union([z6.string(), z6.null()])
|
|
2482
2730
|
}).partial()
|
|
2483
2731
|
}),
|
|
2484
|
-
|
|
2485
|
-
columnVisibility:
|
|
2486
|
-
columnOrder:
|
|
2487
|
-
columnSizing:
|
|
2488
|
-
grouping:
|
|
2489
|
-
rowHeight:
|
|
2490
|
-
tallGroupRows:
|
|
2491
|
-
layout:
|
|
2492
|
-
chartHeight:
|
|
2493
|
-
excludedMeasures:
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
type:
|
|
2497
|
-
value:
|
|
2732
|
+
z6.object({
|
|
2733
|
+
columnVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
|
|
2734
|
+
columnOrder: z6.union([z6.array(z6.string()), z6.null()]),
|
|
2735
|
+
columnSizing: z6.union([z6.record(z6.number()), z6.null()]),
|
|
2736
|
+
grouping: z6.union([z6.string(), z6.null()]),
|
|
2737
|
+
rowHeight: z6.union([z6.string(), z6.null()]),
|
|
2738
|
+
tallGroupRows: z6.union([z6.boolean(), z6.null()]),
|
|
2739
|
+
layout: z6.union([z6.string(), z6.null()]),
|
|
2740
|
+
chartHeight: z6.union([z6.number(), z6.null()]),
|
|
2741
|
+
excludedMeasures: z6.union([
|
|
2742
|
+
z6.array(
|
|
2743
|
+
z6.object({
|
|
2744
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2745
|
+
value: z6.string()
|
|
2498
2746
|
})
|
|
2499
2747
|
),
|
|
2500
|
-
|
|
2748
|
+
z6.null()
|
|
2501
2749
|
]),
|
|
2502
|
-
yMetric:
|
|
2503
|
-
|
|
2504
|
-
type:
|
|
2505
|
-
value:
|
|
2750
|
+
yMetric: z6.union([
|
|
2751
|
+
z6.object({
|
|
2752
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2753
|
+
value: z6.string()
|
|
2506
2754
|
}),
|
|
2507
|
-
|
|
2755
|
+
z6.null()
|
|
2508
2756
|
]),
|
|
2509
|
-
xAxis:
|
|
2510
|
-
|
|
2511
|
-
type:
|
|
2512
|
-
value:
|
|
2757
|
+
xAxis: z6.union([
|
|
2758
|
+
z6.object({
|
|
2759
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2760
|
+
value: z6.string()
|
|
2513
2761
|
}),
|
|
2514
|
-
|
|
2762
|
+
z6.null()
|
|
2515
2763
|
]),
|
|
2516
|
-
symbolGrouping:
|
|
2517
|
-
|
|
2518
|
-
type:
|
|
2519
|
-
value:
|
|
2764
|
+
symbolGrouping: z6.union([
|
|
2765
|
+
z6.object({
|
|
2766
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2767
|
+
value: z6.string()
|
|
2520
2768
|
}),
|
|
2521
|
-
|
|
2769
|
+
z6.null()
|
|
2522
2770
|
]),
|
|
2523
|
-
xAxisAggregation:
|
|
2524
|
-
chartAnnotations:
|
|
2525
|
-
|
|
2526
|
-
|
|
2771
|
+
xAxisAggregation: z6.union([z6.string(), z6.null()]),
|
|
2772
|
+
chartAnnotations: z6.union([
|
|
2773
|
+
z6.array(z6.object({ id: z6.string(), text: z6.string() })),
|
|
2774
|
+
z6.null()
|
|
2527
2775
|
]),
|
|
2528
|
-
timeRangeFilter:
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2776
|
+
timeRangeFilter: z6.union([
|
|
2777
|
+
z6.string(),
|
|
2778
|
+
z6.object({ from: z6.string(), to: z6.string() }),
|
|
2779
|
+
z6.null()
|
|
2532
2780
|
])
|
|
2533
2781
|
}).partial(),
|
|
2534
|
-
|
|
2782
|
+
z6.null()
|
|
2535
2783
|
]);
|
|
2536
|
-
var View =
|
|
2537
|
-
id:
|
|
2538
|
-
object_type: AclObjectType.and(
|
|
2539
|
-
object_id:
|
|
2540
|
-
view_type:
|
|
2784
|
+
var View = z6.object({
|
|
2785
|
+
id: z6.string().uuid(),
|
|
2786
|
+
object_type: AclObjectType.and(z6.string()),
|
|
2787
|
+
object_id: z6.string().uuid(),
|
|
2788
|
+
view_type: z6.enum([
|
|
2541
2789
|
"projects",
|
|
2542
2790
|
"experiments",
|
|
2543
2791
|
"experiment",
|
|
@@ -2552,56 +2800,56 @@ var View = z5.object({
|
|
|
2552
2800
|
"agents",
|
|
2553
2801
|
"monitor"
|
|
2554
2802
|
]),
|
|
2555
|
-
name:
|
|
2556
|
-
created:
|
|
2803
|
+
name: z6.string(),
|
|
2804
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2557
2805
|
view_data: ViewData.optional(),
|
|
2558
2806
|
options: ViewOptions.optional(),
|
|
2559
|
-
user_id:
|
|
2560
|
-
deleted_at:
|
|
2807
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2808
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional()
|
|
2561
2809
|
});
|
|
2562
2810
|
|
|
2563
2811
|
// src/logger.ts
|
|
2564
2812
|
import { waitUntil } from "@vercel/functions";
|
|
2565
2813
|
import Mustache2 from "mustache";
|
|
2566
|
-
import { z as
|
|
2814
|
+
import { z as z8, ZodError } from "zod";
|
|
2567
2815
|
|
|
2568
2816
|
// src/functions/stream.ts
|
|
2569
2817
|
import {
|
|
2570
2818
|
createParser
|
|
2571
2819
|
} from "eventsource-parser";
|
|
2572
|
-
import { z as
|
|
2573
|
-
var braintrustStreamChunkSchema =
|
|
2574
|
-
|
|
2575
|
-
type:
|
|
2576
|
-
data:
|
|
2820
|
+
import { z as z7 } from "zod/v3";
|
|
2821
|
+
var braintrustStreamChunkSchema = z7.union([
|
|
2822
|
+
z7.object({
|
|
2823
|
+
type: z7.literal("text_delta"),
|
|
2824
|
+
data: z7.string()
|
|
2577
2825
|
}),
|
|
2578
|
-
|
|
2579
|
-
type:
|
|
2580
|
-
data:
|
|
2826
|
+
z7.object({
|
|
2827
|
+
type: z7.literal("reasoning_delta"),
|
|
2828
|
+
data: z7.string()
|
|
2581
2829
|
}),
|
|
2582
|
-
|
|
2583
|
-
type:
|
|
2584
|
-
data:
|
|
2830
|
+
z7.object({
|
|
2831
|
+
type: z7.literal("json_delta"),
|
|
2832
|
+
data: z7.string()
|
|
2585
2833
|
}),
|
|
2586
|
-
|
|
2587
|
-
type:
|
|
2588
|
-
data:
|
|
2834
|
+
z7.object({
|
|
2835
|
+
type: z7.literal("error"),
|
|
2836
|
+
data: z7.string()
|
|
2589
2837
|
}),
|
|
2590
|
-
|
|
2591
|
-
type:
|
|
2838
|
+
z7.object({
|
|
2839
|
+
type: z7.literal("console"),
|
|
2592
2840
|
data: SSEConsoleEventData
|
|
2593
2841
|
}),
|
|
2594
|
-
|
|
2595
|
-
type:
|
|
2842
|
+
z7.object({
|
|
2843
|
+
type: z7.literal("progress"),
|
|
2596
2844
|
data: SSEProgressEventData
|
|
2597
2845
|
}),
|
|
2598
|
-
|
|
2599
|
-
type:
|
|
2600
|
-
data:
|
|
2846
|
+
z7.object({
|
|
2847
|
+
type: z7.literal("start"),
|
|
2848
|
+
data: z7.string()
|
|
2601
2849
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
data:
|
|
2850
|
+
z7.object({
|
|
2851
|
+
type: z7.literal("done"),
|
|
2852
|
+
data: z7.string()
|
|
2605
2853
|
})
|
|
2606
2854
|
]);
|
|
2607
2855
|
var BraintrustStream = class _BraintrustStream {
|
|
@@ -3309,14 +3557,14 @@ var NoopSpan = class {
|
|
|
3309
3557
|
};
|
|
3310
3558
|
var NOOP_SPAN = new NoopSpan();
|
|
3311
3559
|
var NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
|
|
3312
|
-
var loginSchema =
|
|
3313
|
-
appUrl:
|
|
3314
|
-
appPublicUrl:
|
|
3315
|
-
orgName:
|
|
3316
|
-
apiUrl:
|
|
3317
|
-
proxyUrl:
|
|
3318
|
-
loginToken:
|
|
3319
|
-
orgId:
|
|
3560
|
+
var loginSchema = z8.strictObject({
|
|
3561
|
+
appUrl: z8.string(),
|
|
3562
|
+
appPublicUrl: z8.string(),
|
|
3563
|
+
orgName: z8.string(),
|
|
3564
|
+
apiUrl: z8.string(),
|
|
3565
|
+
proxyUrl: z8.string(),
|
|
3566
|
+
loginToken: z8.string(),
|
|
3567
|
+
orgId: z8.string().nullish(),
|
|
3320
3568
|
gitMetadataSettings: GitMetadataSettings.nullish()
|
|
3321
3569
|
});
|
|
3322
3570
|
var stateNonce = 0;
|
|
@@ -3375,6 +3623,7 @@ var BraintrustState = class _BraintrustState {
|
|
|
3375
3623
|
_apiConn = null;
|
|
3376
3624
|
_proxyConn = null;
|
|
3377
3625
|
promptCache;
|
|
3626
|
+
_idGenerator = null;
|
|
3378
3627
|
resetLoginInfo() {
|
|
3379
3628
|
this.appUrl = null;
|
|
3380
3629
|
this.appPublicUrl = null;
|
|
@@ -3389,6 +3638,15 @@ var BraintrustState = class _BraintrustState {
|
|
|
3389
3638
|
this._apiConn = null;
|
|
3390
3639
|
this._proxyConn = null;
|
|
3391
3640
|
}
|
|
3641
|
+
resetIdGenState() {
|
|
3642
|
+
this._idGenerator = null;
|
|
3643
|
+
}
|
|
3644
|
+
get idGenerator() {
|
|
3645
|
+
if (this._idGenerator === null) {
|
|
3646
|
+
this._idGenerator = getIdGenerator();
|
|
3647
|
+
}
|
|
3648
|
+
return this._idGenerator;
|
|
3649
|
+
}
|
|
3392
3650
|
copyLoginInfo(other) {
|
|
3393
3651
|
this.appUrl = other.appUrl;
|
|
3394
3652
|
this.appPublicUrl = other.appPublicUrl;
|
|
@@ -3811,9 +4069,9 @@ var Attachment = class extends BaseAttachment {
|
|
|
3811
4069
|
let signedUrl;
|
|
3812
4070
|
let headers;
|
|
3813
4071
|
try {
|
|
3814
|
-
({ signedUrl, headers } =
|
|
3815
|
-
signedUrl:
|
|
3816
|
-
headers:
|
|
4072
|
+
({ signedUrl, headers } = z8.object({
|
|
4073
|
+
signedUrl: z8.string().url(),
|
|
4074
|
+
headers: z8.record(z8.string())
|
|
3817
4075
|
}).parse(await metadataResponse.json()));
|
|
3818
4076
|
} catch (error2) {
|
|
3819
4077
|
if (error2 instanceof ZodError) {
|
|
@@ -3901,8 +4159,8 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
|
|
|
3901
4159
|
}
|
|
3902
4160
|
}
|
|
3903
4161
|
};
|
|
3904
|
-
var attachmentMetadataSchema =
|
|
3905
|
-
downloadUrl:
|
|
4162
|
+
var attachmentMetadataSchema = z8.object({
|
|
4163
|
+
downloadUrl: z8.string(),
|
|
3906
4164
|
status: AttachmentStatus
|
|
3907
4165
|
});
|
|
3908
4166
|
var ReadonlyAttachment = class {
|
|
@@ -4040,7 +4298,7 @@ function logFeedbackImpl(state, parentObjectType, parentObjectId, {
|
|
|
4040
4298
|
if (!isEmpty(comment)) {
|
|
4041
4299
|
const record = new LazyValue(async () => {
|
|
4042
4300
|
return {
|
|
4043
|
-
id:
|
|
4301
|
+
id: uuidv42(),
|
|
4044
4302
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4045
4303
|
origin: {
|
|
4046
4304
|
// NOTE: We do not know (or care?) what the transaction id of the row that
|
|
@@ -4758,7 +5016,7 @@ Error: ${errorText}`;
|
|
|
4758
5016
|
}
|
|
4759
5017
|
const payloadFile = isomorph_default.pathJoin(
|
|
4760
5018
|
payloadDir,
|
|
4761
|
-
`payload_${getCurrentUnixTimestamp()}_${
|
|
5019
|
+
`payload_${getCurrentUnixTimestamp()}_${uuidv42().slice(0, 8)}.json`
|
|
4762
5020
|
);
|
|
4763
5021
|
try {
|
|
4764
5022
|
await isomorph_default.mkdir(payloadDir, { recursive: true });
|
|
@@ -5390,7 +5648,7 @@ function validateAndSanitizeExperimentLogPartialArgs(event) {
|
|
|
5390
5648
|
function deepCopyEvent(event) {
|
|
5391
5649
|
const attachments = [];
|
|
5392
5650
|
const IDENTIFIER = "_bt_internal_saved_attachment";
|
|
5393
|
-
const savedAttachmentSchema =
|
|
5651
|
+
const savedAttachmentSchema = z8.strictObject({ [IDENTIFIER]: z8.number() });
|
|
5394
5652
|
const serialized = JSON.stringify(event, (_k, v) => {
|
|
5395
5653
|
if (v instanceof SpanImpl || v instanceof NoopSpan) {
|
|
5396
5654
|
return `<span>`;
|
|
@@ -5893,7 +6151,7 @@ var ReadonlyExperiment = class extends ObjectFetcher {
|
|
|
5893
6151
|
};
|
|
5894
6152
|
var executionCounter = 0;
|
|
5895
6153
|
function newId() {
|
|
5896
|
-
return
|
|
6154
|
+
return uuidv42();
|
|
5897
6155
|
}
|
|
5898
6156
|
var SpanImpl = class _SpanImpl {
|
|
5899
6157
|
_state;
|
|
@@ -5949,13 +6207,17 @@ var SpanImpl = class _SpanImpl {
|
|
|
5949
6207
|
},
|
|
5950
6208
|
created: (/* @__PURE__ */ new Date()).toISOString()
|
|
5951
6209
|
};
|
|
5952
|
-
this._id = eventId ??
|
|
5953
|
-
this._spanId = args.spanId ??
|
|
6210
|
+
this._id = eventId ?? this._state.idGenerator.getSpanId();
|
|
6211
|
+
this._spanId = args.spanId ?? this._state.idGenerator.getSpanId();
|
|
5954
6212
|
if (args.parentSpanIds) {
|
|
5955
6213
|
this._rootSpanId = args.parentSpanIds.rootSpanId;
|
|
5956
6214
|
this._spanParents = "parentSpanIds" in args.parentSpanIds ? args.parentSpanIds.parentSpanIds : [args.parentSpanIds.spanId];
|
|
5957
6215
|
} else {
|
|
5958
|
-
this.
|
|
6216
|
+
if (this._state.idGenerator.shareRootSpanId()) {
|
|
6217
|
+
this._rootSpanId = this._spanId;
|
|
6218
|
+
} else {
|
|
6219
|
+
this._rootSpanId = this._state.idGenerator.getTraceId();
|
|
6220
|
+
}
|
|
5959
6221
|
this._spanParents = void 0;
|
|
5960
6222
|
}
|
|
5961
6223
|
this.isMerge = false;
|
|
@@ -6331,7 +6593,7 @@ var Dataset2 = class extends ObjectFetcher {
|
|
|
6331
6593
|
output
|
|
6332
6594
|
}) {
|
|
6333
6595
|
this.validateEvent({ metadata, expected, output, tags });
|
|
6334
|
-
const rowId = id ||
|
|
6596
|
+
const rowId = id || uuidv42();
|
|
6335
6597
|
const args = this.createArgs(
|
|
6336
6598
|
deepCopyEvent({
|
|
6337
6599
|
id: rowId,
|
|
@@ -6409,8 +6671,8 @@ var Dataset2 = class extends ObjectFetcher {
|
|
|
6409
6671
|
)}`;
|
|
6410
6672
|
let dataSummary;
|
|
6411
6673
|
if (summarizeData) {
|
|
6412
|
-
const rawDataSummary =
|
|
6413
|
-
total_records:
|
|
6674
|
+
const rawDataSummary = z8.object({
|
|
6675
|
+
total_records: z8.number()
|
|
6414
6676
|
}).parse(
|
|
6415
6677
|
await state.apiConn().get_json(
|
|
6416
6678
|
"dataset-summary",
|
|
@@ -6533,11 +6795,11 @@ function renderTemplatedObject(obj, args, options) {
|
|
|
6533
6795
|
return obj;
|
|
6534
6796
|
}
|
|
6535
6797
|
function renderPromptParams(params, args, options) {
|
|
6536
|
-
const schemaParsed =
|
|
6537
|
-
response_format:
|
|
6538
|
-
type:
|
|
6798
|
+
const schemaParsed = z8.object({
|
|
6799
|
+
response_format: z8.object({
|
|
6800
|
+
type: z8.literal("json_schema"),
|
|
6539
6801
|
json_schema: ResponseFormatJsonSchema.omit({ schema: true }).extend({
|
|
6540
|
-
schema:
|
|
6802
|
+
schema: z8.unknown()
|
|
6541
6803
|
})
|
|
6542
6804
|
})
|
|
6543
6805
|
}).safeParse(params);
|
|
@@ -6655,7 +6917,7 @@ var Prompt2 = class _Prompt {
|
|
|
6655
6917
|
if (!prompt) {
|
|
6656
6918
|
throw new Error("Empty prompt");
|
|
6657
6919
|
}
|
|
6658
|
-
const dictArgParsed =
|
|
6920
|
+
const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
|
|
6659
6921
|
const variables = {
|
|
6660
6922
|
input: buildArgs,
|
|
6661
6923
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
@@ -6710,7 +6972,7 @@ var Prompt2 = class _Prompt {
|
|
|
6710
6972
|
return JSON.stringify(v);
|
|
6711
6973
|
}
|
|
6712
6974
|
};
|
|
6713
|
-
const dictArgParsed =
|
|
6975
|
+
const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
|
|
6714
6976
|
const variables = {
|
|
6715
6977
|
input: buildArgs,
|
|
6716
6978
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
@@ -6818,7 +7080,7 @@ function configureNode() {
|
|
|
6818
7080
|
import express from "express";
|
|
6819
7081
|
import cors from "cors";
|
|
6820
7082
|
|
|
6821
|
-
//
|
|
7083
|
+
// ../../node_modules/.pnpm/async@3.2.5/node_modules/async/dist/async.mjs
|
|
6822
7084
|
function initialParams(fn) {
|
|
6823
7085
|
return function(...args) {
|
|
6824
7086
|
var callback = args.pop();
|
|
@@ -7897,12 +8159,12 @@ var BarProgressReporter = class {
|
|
|
7897
8159
|
};
|
|
7898
8160
|
|
|
7899
8161
|
// src/eval-parameters.ts
|
|
7900
|
-
import { z as
|
|
8162
|
+
import { z as z10 } from "zod/v3";
|
|
7901
8163
|
|
|
7902
8164
|
// src/framework2.ts
|
|
7903
8165
|
import path2 from "path";
|
|
7904
8166
|
import slugifyLib from "slugify";
|
|
7905
|
-
import { z as
|
|
8167
|
+
import { z as z9 } from "zod/v3";
|
|
7906
8168
|
var ProjectBuilder = class {
|
|
7907
8169
|
create(opts) {
|
|
7908
8170
|
return new Project2(opts);
|
|
@@ -8136,23 +8398,23 @@ var CodePrompt = class {
|
|
|
8136
8398
|
};
|
|
8137
8399
|
}
|
|
8138
8400
|
};
|
|
8139
|
-
var promptContentsSchema =
|
|
8140
|
-
|
|
8141
|
-
prompt:
|
|
8401
|
+
var promptContentsSchema = z9.union([
|
|
8402
|
+
z9.object({
|
|
8403
|
+
prompt: z9.string()
|
|
8142
8404
|
}),
|
|
8143
|
-
|
|
8144
|
-
messages:
|
|
8405
|
+
z9.object({
|
|
8406
|
+
messages: z9.array(ChatCompletionMessageParam)
|
|
8145
8407
|
})
|
|
8146
8408
|
]);
|
|
8147
8409
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
8148
|
-
|
|
8149
|
-
model:
|
|
8410
|
+
z9.object({
|
|
8411
|
+
model: z9.string(),
|
|
8150
8412
|
params: ModelParams.optional()
|
|
8151
8413
|
})
|
|
8152
8414
|
);
|
|
8153
8415
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
8154
|
-
|
|
8155
|
-
tools:
|
|
8416
|
+
z9.object({
|
|
8417
|
+
tools: z9.array(ToolFunctionDefinition).optional()
|
|
8156
8418
|
})
|
|
8157
8419
|
);
|
|
8158
8420
|
var PromptBuilder = class {
|
|
@@ -8220,7 +8482,7 @@ var ProjectNameIdMap = class {
|
|
|
8220
8482
|
const response = await _internalGetGlobalState().appConn().post_json("api/project/register", {
|
|
8221
8483
|
project_name: projectName
|
|
8222
8484
|
});
|
|
8223
|
-
const result =
|
|
8485
|
+
const result = z9.object({
|
|
8224
8486
|
project: Project
|
|
8225
8487
|
}).parse(response);
|
|
8226
8488
|
const projectId = result.project.id;
|
|
@@ -8234,7 +8496,7 @@ var ProjectNameIdMap = class {
|
|
|
8234
8496
|
const response = await _internalGetGlobalState().appConn().post_json("api/project/get", {
|
|
8235
8497
|
id: projectId
|
|
8236
8498
|
});
|
|
8237
|
-
const result =
|
|
8499
|
+
const result = z9.array(Project).nonempty().parse(response);
|
|
8238
8500
|
const projectName = result[0].name;
|
|
8239
8501
|
this.idToName[projectId] = projectName;
|
|
8240
8502
|
this.nameToId[projectName] = projectId;
|
|
@@ -8250,15 +8512,15 @@ var ProjectNameIdMap = class {
|
|
|
8250
8512
|
};
|
|
8251
8513
|
|
|
8252
8514
|
// src/eval-parameters.ts
|
|
8253
|
-
var evalParametersSchema =
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
type:
|
|
8515
|
+
var evalParametersSchema = z10.record(
|
|
8516
|
+
z10.string(),
|
|
8517
|
+
z10.union([
|
|
8518
|
+
z10.object({
|
|
8519
|
+
type: z10.literal("prompt"),
|
|
8258
8520
|
default: promptDefinitionWithToolsSchema.optional(),
|
|
8259
|
-
description:
|
|
8521
|
+
description: z10.string().optional()
|
|
8260
8522
|
}),
|
|
8261
|
-
|
|
8523
|
+
z10.instanceof(z10.ZodType)
|
|
8262
8524
|
// For Zod schemas
|
|
8263
8525
|
])
|
|
8264
8526
|
);
|
|
@@ -8885,7 +9147,7 @@ function formatMetricSummary(summary, longestMetricName) {
|
|
|
8885
9147
|
}
|
|
8886
9148
|
|
|
8887
9149
|
// dev/errorHandler.ts
|
|
8888
|
-
import { z as
|
|
9150
|
+
import { z as z11 } from "zod/v3";
|
|
8889
9151
|
var errorHandler = (err, req, res, next) => {
|
|
8890
9152
|
if ("status" in err) {
|
|
8891
9153
|
res.status(err.status).json({
|
|
@@ -8896,7 +9158,7 @@ var errorHandler = (err, req, res, next) => {
|
|
|
8896
9158
|
});
|
|
8897
9159
|
return;
|
|
8898
9160
|
}
|
|
8899
|
-
if (err instanceof
|
|
9161
|
+
if (err instanceof z11.ZodError) {
|
|
8900
9162
|
res.status(400).json({
|
|
8901
9163
|
error: {
|
|
8902
9164
|
message: "Invalid request",
|
|
@@ -9057,49 +9319,49 @@ function serializeSSEEvent(event) {
|
|
|
9057
9319
|
}
|
|
9058
9320
|
|
|
9059
9321
|
// dev/types.ts
|
|
9060
|
-
import { z as
|
|
9061
|
-
var evalBodySchema =
|
|
9062
|
-
name:
|
|
9063
|
-
parameters:
|
|
9322
|
+
import { z as z12 } from "zod/v3";
|
|
9323
|
+
var evalBodySchema = z12.object({
|
|
9324
|
+
name: z12.string(),
|
|
9325
|
+
parameters: z12.record(z12.string(), z12.unknown()).nullish(),
|
|
9064
9326
|
data: RunEval.shape.data,
|
|
9065
|
-
scores:
|
|
9066
|
-
|
|
9327
|
+
scores: z12.array(
|
|
9328
|
+
z12.object({
|
|
9067
9329
|
function_id: FunctionId,
|
|
9068
|
-
name:
|
|
9330
|
+
name: z12.string()
|
|
9069
9331
|
})
|
|
9070
9332
|
).nullish(),
|
|
9071
|
-
experiment_name:
|
|
9072
|
-
project_id:
|
|
9333
|
+
experiment_name: z12.string().nullish(),
|
|
9334
|
+
project_id: z12.string().nullish(),
|
|
9073
9335
|
parent: InvokeParent.optional(),
|
|
9074
|
-
stream:
|
|
9336
|
+
stream: z12.boolean().optional()
|
|
9075
9337
|
});
|
|
9076
|
-
var evalParametersSerializedSchema =
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
type:
|
|
9338
|
+
var evalParametersSerializedSchema = z12.record(
|
|
9339
|
+
z12.string(),
|
|
9340
|
+
z12.union([
|
|
9341
|
+
z12.object({
|
|
9342
|
+
type: z12.literal("prompt"),
|
|
9081
9343
|
default: PromptData.optional(),
|
|
9082
|
-
description:
|
|
9344
|
+
description: z12.string().optional()
|
|
9083
9345
|
}),
|
|
9084
|
-
|
|
9085
|
-
type:
|
|
9086
|
-
schema:
|
|
9346
|
+
z12.object({
|
|
9347
|
+
type: z12.literal("data"),
|
|
9348
|
+
schema: z12.record(z12.unknown()),
|
|
9087
9349
|
// JSON Schema
|
|
9088
|
-
default:
|
|
9089
|
-
description:
|
|
9350
|
+
default: z12.unknown().optional(),
|
|
9351
|
+
description: z12.string().optional()
|
|
9090
9352
|
})
|
|
9091
9353
|
])
|
|
9092
9354
|
);
|
|
9093
|
-
var evaluatorDefinitionSchema =
|
|
9355
|
+
var evaluatorDefinitionSchema = z12.object({
|
|
9094
9356
|
parameters: evalParametersSerializedSchema.optional()
|
|
9095
9357
|
});
|
|
9096
|
-
var evaluatorDefinitionsSchema =
|
|
9097
|
-
|
|
9358
|
+
var evaluatorDefinitionsSchema = z12.record(
|
|
9359
|
+
z12.string(),
|
|
9098
9360
|
evaluatorDefinitionSchema
|
|
9099
9361
|
);
|
|
9100
9362
|
|
|
9101
9363
|
// dev/server.ts
|
|
9102
|
-
import { z as
|
|
9364
|
+
import { z as z13 } from "zod/v3";
|
|
9103
9365
|
import zodToJsonSchema from "zod-to-json-schema";
|
|
9104
9366
|
function runDevServer(evaluators, opts) {
|
|
9105
9367
|
const allEvaluators = Object.fromEntries(
|
|
@@ -9184,7 +9446,7 @@ function runDevServer(evaluators, opts) {
|
|
|
9184
9446
|
validateParameters(parameters ?? {}, evaluator.parameters);
|
|
9185
9447
|
} catch (e) {
|
|
9186
9448
|
console.error("Error validating parameters", e);
|
|
9187
|
-
if (e instanceof
|
|
9449
|
+
if (e instanceof z13.ZodError || e instanceof Error) {
|
|
9188
9450
|
res.status(400).json({
|
|
9189
9451
|
error: e.message
|
|
9190
9452
|
});
|
|
@@ -9328,9 +9590,9 @@ async function getDataset(state, data) {
|
|
|
9328
9590
|
return data.data;
|
|
9329
9591
|
}
|
|
9330
9592
|
}
|
|
9331
|
-
var datasetFetchSchema =
|
|
9332
|
-
project_id:
|
|
9333
|
-
name:
|
|
9593
|
+
var datasetFetchSchema = z13.object({
|
|
9594
|
+
project_id: z13.string(),
|
|
9595
|
+
name: z13.string()
|
|
9334
9596
|
});
|
|
9335
9597
|
async function getDatasetById({
|
|
9336
9598
|
state,
|
|
@@ -9339,7 +9601,7 @@ async function getDatasetById({
|
|
|
9339
9601
|
const dataset = await state.appConn().post_json("api/dataset/get", {
|
|
9340
9602
|
id: datasetId
|
|
9341
9603
|
});
|
|
9342
|
-
const parsed =
|
|
9604
|
+
const parsed = z13.array(datasetFetchSchema).parse(dataset);
|
|
9343
9605
|
if (parsed.length === 0) {
|
|
9344
9606
|
throw new Error(`Dataset '${datasetId}' not found`);
|
|
9345
9607
|
}
|