braintrust 0.3.7 → 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 +25 -0
- package/dev/dist/index.d.ts +25 -0
- package/dev/dist/index.js +454 -122
- package/dev/dist/index.mjs +1360 -1028
- package/dist/browser.d.mts +31 -2
- package/dist/browser.d.ts +31 -2
- package/dist/browser.js +309 -114
- package/dist/browser.mjs +1183 -988
- package/dist/cli.js +1361 -1023
- package/dist/index.d.mts +131 -2
- package/dist/index.d.ts +131 -2
- package/dist/index.js +814 -177
- package/dist/index.mjs +1681 -1044
- package/package.json +6 -4
- package/util/dist/index.d.mts +65 -2
- package/util/dist/index.d.ts +65 -2
- package/util/dist/index.js +229 -17
- package/util/dist/index.mjs +230 -18
package/dist/browser.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var iso = {
|
|
|
29
29
|
var isomorph_default = iso;
|
|
30
30
|
|
|
31
31
|
// src/logger.ts
|
|
32
|
-
import { v4 as
|
|
32
|
+
import { v4 as uuidv42 } from "uuid";
|
|
33
33
|
|
|
34
34
|
// src/queue.ts
|
|
35
35
|
var DEFAULT_QUEUE_SIZE = 15e3;
|
|
@@ -87,6 +87,44 @@ var Queue = class {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
// src/id-gen.ts
|
|
91
|
+
import { v4 as uuidv4 } from "uuid";
|
|
92
|
+
function generateHexId(bytes) {
|
|
93
|
+
let result = "";
|
|
94
|
+
for (let i = 0; i < bytes; i++) {
|
|
95
|
+
result += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
var IDGenerator = class {
|
|
100
|
+
};
|
|
101
|
+
var UUIDGenerator = class extends IDGenerator {
|
|
102
|
+
getSpanId() {
|
|
103
|
+
return uuidv4();
|
|
104
|
+
}
|
|
105
|
+
getTraceId() {
|
|
106
|
+
return uuidv4();
|
|
107
|
+
}
|
|
108
|
+
shareRootSpanId() {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var OTELIDGenerator = class extends IDGenerator {
|
|
113
|
+
getSpanId() {
|
|
114
|
+
return generateHexId(8);
|
|
115
|
+
}
|
|
116
|
+
getTraceId() {
|
|
117
|
+
return generateHexId(16);
|
|
118
|
+
}
|
|
119
|
+
shareRootSpanId() {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
function getIdGenerator() {
|
|
124
|
+
const useOtel = typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true";
|
|
125
|
+
return useOtel ? new OTELIDGenerator() : new UUIDGenerator();
|
|
126
|
+
}
|
|
127
|
+
|
|
90
128
|
// util/db_fields.ts
|
|
91
129
|
var TRANSACTION_ID_FIELD = "_xact_id";
|
|
92
130
|
var IS_MERGE_FIELD = "_is_merge";
|
|
@@ -1034,6 +1072,41 @@ function _urljoin(...parts) {
|
|
|
1034
1072
|
).filter((x) => x.trim() !== "").join("/");
|
|
1035
1073
|
}
|
|
1036
1074
|
|
|
1075
|
+
// util/span_identifier_v4.ts
|
|
1076
|
+
import { z as z4 } from "zod/v3";
|
|
1077
|
+
var ENCODING_VERSION_NUMBER_V4 = 4;
|
|
1078
|
+
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.`;
|
|
1079
|
+
var spanComponentsV4Schema = z4.object({
|
|
1080
|
+
object_type: spanObjectTypeV3EnumSchema,
|
|
1081
|
+
propagated_event: z4.record(z4.unknown()).nullish()
|
|
1082
|
+
}).and(
|
|
1083
|
+
z4.union([
|
|
1084
|
+
// Must provide one or the other.
|
|
1085
|
+
z4.object({
|
|
1086
|
+
object_id: z4.string().nullish(),
|
|
1087
|
+
compute_object_metadata_args: z4.optional(z4.null())
|
|
1088
|
+
}),
|
|
1089
|
+
z4.object({
|
|
1090
|
+
object_id: z4.optional(z4.null()),
|
|
1091
|
+
compute_object_metadata_args: z4.record(z4.unknown())
|
|
1092
|
+
})
|
|
1093
|
+
])
|
|
1094
|
+
).and(
|
|
1095
|
+
z4.union([
|
|
1096
|
+
// Either all of these must be provided or none.
|
|
1097
|
+
z4.object({
|
|
1098
|
+
row_id: z4.string(),
|
|
1099
|
+
span_id: z4.string(),
|
|
1100
|
+
root_span_id: z4.string()
|
|
1101
|
+
}),
|
|
1102
|
+
z4.object({
|
|
1103
|
+
row_id: z4.optional(z4.null()),
|
|
1104
|
+
span_id: z4.optional(z4.null()),
|
|
1105
|
+
root_span_id: z4.optional(z4.null())
|
|
1106
|
+
})
|
|
1107
|
+
])
|
|
1108
|
+
);
|
|
1109
|
+
|
|
1037
1110
|
// util/git_fields.ts
|
|
1038
1111
|
function mergeGitMetadataSettings(s1, s2) {
|
|
1039
1112
|
if (s1.collect === "all") {
|
|
@@ -1065,12 +1138,12 @@ function prettifyXact(valueString) {
|
|
|
1065
1138
|
}
|
|
1066
1139
|
|
|
1067
1140
|
// util/zod_util.ts
|
|
1068
|
-
import { z as
|
|
1141
|
+
import { z as z5 } from "zod/v3";
|
|
1069
1142
|
|
|
1070
1143
|
// src/generated_types.ts
|
|
1071
|
-
import { z as
|
|
1072
|
-
var AclObjectType =
|
|
1073
|
-
|
|
1144
|
+
import { z as z6 } from "zod/v3";
|
|
1145
|
+
var AclObjectType = z6.union([
|
|
1146
|
+
z6.enum([
|
|
1074
1147
|
"organization",
|
|
1075
1148
|
"project",
|
|
1076
1149
|
"experiment",
|
|
@@ -1083,9 +1156,9 @@ var AclObjectType = z5.union([
|
|
|
1083
1156
|
"project_log",
|
|
1084
1157
|
"org_project"
|
|
1085
1158
|
]),
|
|
1086
|
-
|
|
1159
|
+
z6.null()
|
|
1087
1160
|
]);
|
|
1088
|
-
var Permission =
|
|
1161
|
+
var Permission = z6.enum([
|
|
1089
1162
|
"create",
|
|
1090
1163
|
"read",
|
|
1091
1164
|
"update",
|
|
@@ -1095,310 +1168,310 @@ var Permission = z5.enum([
|
|
|
1095
1168
|
"update_acls",
|
|
1096
1169
|
"delete_acls"
|
|
1097
1170
|
]);
|
|
1098
|
-
var Acl =
|
|
1099
|
-
id:
|
|
1100
|
-
object_type: AclObjectType.and(
|
|
1101
|
-
object_id:
|
|
1102
|
-
user_id:
|
|
1103
|
-
group_id:
|
|
1104
|
-
permission: Permission.and(
|
|
1105
|
-
restrict_object_type: AclObjectType.and(
|
|
1106
|
-
role_id:
|
|
1107
|
-
_object_org_id:
|
|
1108
|
-
created:
|
|
1171
|
+
var Acl = z6.object({
|
|
1172
|
+
id: z6.string().uuid(),
|
|
1173
|
+
object_type: AclObjectType.and(z6.string()),
|
|
1174
|
+
object_id: z6.string().uuid(),
|
|
1175
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1176
|
+
group_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1177
|
+
permission: Permission.and(z6.union([z6.string(), z6.null()])).optional(),
|
|
1178
|
+
restrict_object_type: AclObjectType.and(z6.unknown()).optional(),
|
|
1179
|
+
role_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1180
|
+
_object_org_id: z6.string().uuid(),
|
|
1181
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1109
1182
|
});
|
|
1110
|
-
var AISecret =
|
|
1111
|
-
id:
|
|
1112
|
-
created:
|
|
1113
|
-
updated_at:
|
|
1114
|
-
org_id:
|
|
1115
|
-
name:
|
|
1116
|
-
type:
|
|
1117
|
-
metadata:
|
|
1118
|
-
preview_secret:
|
|
1183
|
+
var AISecret = z6.object({
|
|
1184
|
+
id: z6.string().uuid(),
|
|
1185
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1186
|
+
updated_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1187
|
+
org_id: z6.string().uuid(),
|
|
1188
|
+
name: z6.string(),
|
|
1189
|
+
type: z6.union([z6.string(), z6.null()]).optional(),
|
|
1190
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1191
|
+
preview_secret: z6.union([z6.string(), z6.null()]).optional()
|
|
1119
1192
|
});
|
|
1120
|
-
var ResponseFormatJsonSchema =
|
|
1121
|
-
name:
|
|
1122
|
-
description:
|
|
1123
|
-
schema:
|
|
1124
|
-
strict:
|
|
1193
|
+
var ResponseFormatJsonSchema = z6.object({
|
|
1194
|
+
name: z6.string(),
|
|
1195
|
+
description: z6.string().optional(),
|
|
1196
|
+
schema: z6.union([z6.object({}).partial().passthrough(), z6.string()]).optional(),
|
|
1197
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1125
1198
|
});
|
|
1126
|
-
var ResponseFormatNullish =
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
type:
|
|
1199
|
+
var ResponseFormatNullish = z6.union([
|
|
1200
|
+
z6.object({ type: z6.literal("json_object") }),
|
|
1201
|
+
z6.object({
|
|
1202
|
+
type: z6.literal("json_schema"),
|
|
1130
1203
|
json_schema: ResponseFormatJsonSchema
|
|
1131
1204
|
}),
|
|
1132
|
-
|
|
1133
|
-
|
|
1205
|
+
z6.object({ type: z6.literal("text") }),
|
|
1206
|
+
z6.null()
|
|
1134
1207
|
]);
|
|
1135
|
-
var AnyModelParams =
|
|
1136
|
-
temperature:
|
|
1137
|
-
top_p:
|
|
1138
|
-
max_tokens:
|
|
1139
|
-
max_completion_tokens:
|
|
1140
|
-
frequency_penalty:
|
|
1141
|
-
presence_penalty:
|
|
1208
|
+
var AnyModelParams = z6.object({
|
|
1209
|
+
temperature: z6.number().optional(),
|
|
1210
|
+
top_p: z6.number().optional(),
|
|
1211
|
+
max_tokens: z6.number(),
|
|
1212
|
+
max_completion_tokens: z6.number().optional(),
|
|
1213
|
+
frequency_penalty: z6.number().optional(),
|
|
1214
|
+
presence_penalty: z6.number().optional(),
|
|
1142
1215
|
response_format: ResponseFormatNullish.optional(),
|
|
1143
|
-
tool_choice:
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
type:
|
|
1149
|
-
function:
|
|
1216
|
+
tool_choice: z6.union([
|
|
1217
|
+
z6.literal("auto"),
|
|
1218
|
+
z6.literal("none"),
|
|
1219
|
+
z6.literal("required"),
|
|
1220
|
+
z6.object({
|
|
1221
|
+
type: z6.literal("function"),
|
|
1222
|
+
function: z6.object({ name: z6.string() })
|
|
1150
1223
|
})
|
|
1151
1224
|
]).optional(),
|
|
1152
|
-
function_call:
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1225
|
+
function_call: z6.union([
|
|
1226
|
+
z6.literal("auto"),
|
|
1227
|
+
z6.literal("none"),
|
|
1228
|
+
z6.object({ name: z6.string() })
|
|
1156
1229
|
]).optional(),
|
|
1157
|
-
n:
|
|
1158
|
-
stop:
|
|
1159
|
-
reasoning_effort:
|
|
1160
|
-
verbosity:
|
|
1161
|
-
top_k:
|
|
1162
|
-
stop_sequences:
|
|
1163
|
-
max_tokens_to_sample:
|
|
1164
|
-
maxOutputTokens:
|
|
1165
|
-
topP:
|
|
1166
|
-
topK:
|
|
1167
|
-
use_cache:
|
|
1230
|
+
n: z6.number().optional(),
|
|
1231
|
+
stop: z6.array(z6.string()).optional(),
|
|
1232
|
+
reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]).optional(),
|
|
1233
|
+
verbosity: z6.enum(["low", "medium", "high"]).optional(),
|
|
1234
|
+
top_k: z6.number().optional(),
|
|
1235
|
+
stop_sequences: z6.array(z6.string()).optional(),
|
|
1236
|
+
max_tokens_to_sample: z6.number().optional(),
|
|
1237
|
+
maxOutputTokens: z6.number().optional(),
|
|
1238
|
+
topP: z6.number().optional(),
|
|
1239
|
+
topK: z6.number().optional(),
|
|
1240
|
+
use_cache: z6.boolean().optional()
|
|
1168
1241
|
});
|
|
1169
|
-
var ApiKey =
|
|
1170
|
-
id:
|
|
1171
|
-
created:
|
|
1172
|
-
name:
|
|
1173
|
-
preview_name:
|
|
1174
|
-
user_id:
|
|
1175
|
-
user_email:
|
|
1176
|
-
user_given_name:
|
|
1177
|
-
user_family_name:
|
|
1178
|
-
org_id:
|
|
1242
|
+
var ApiKey = z6.object({
|
|
1243
|
+
id: z6.string().uuid(),
|
|
1244
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1245
|
+
name: z6.string(),
|
|
1246
|
+
preview_name: z6.string(),
|
|
1247
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1248
|
+
user_email: z6.union([z6.string(), z6.null()]).optional(),
|
|
1249
|
+
user_given_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
1250
|
+
user_family_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
1251
|
+
org_id: z6.union([z6.string(), z6.null()]).optional()
|
|
1179
1252
|
});
|
|
1180
|
-
var AsyncScoringState =
|
|
1181
|
-
|
|
1182
|
-
status:
|
|
1183
|
-
token:
|
|
1184
|
-
function_ids:
|
|
1185
|
-
skip_logging:
|
|
1253
|
+
var AsyncScoringState = z6.union([
|
|
1254
|
+
z6.object({
|
|
1255
|
+
status: z6.literal("enabled"),
|
|
1256
|
+
token: z6.string(),
|
|
1257
|
+
function_ids: z6.array(z6.unknown()).min(1),
|
|
1258
|
+
skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1186
1259
|
}),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1260
|
+
z6.object({ status: z6.literal("disabled") }),
|
|
1261
|
+
z6.null(),
|
|
1262
|
+
z6.null()
|
|
1190
1263
|
]);
|
|
1191
|
-
var AsyncScoringControl =
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1264
|
+
var AsyncScoringControl = z6.union([
|
|
1265
|
+
z6.object({ kind: z6.literal("score_update"), token: z6.string() }),
|
|
1266
|
+
z6.object({ kind: z6.literal("state_override"), state: AsyncScoringState }),
|
|
1267
|
+
z6.object({ kind: z6.literal("state_force_reselect") }),
|
|
1268
|
+
z6.object({ kind: z6.literal("state_enabled_force_rescore") })
|
|
1196
1269
|
]);
|
|
1197
|
-
var BraintrustAttachmentReference =
|
|
1198
|
-
type:
|
|
1199
|
-
filename:
|
|
1200
|
-
content_type:
|
|
1201
|
-
key:
|
|
1270
|
+
var BraintrustAttachmentReference = z6.object({
|
|
1271
|
+
type: z6.literal("braintrust_attachment"),
|
|
1272
|
+
filename: z6.string().min(1),
|
|
1273
|
+
content_type: z6.string().min(1),
|
|
1274
|
+
key: z6.string().min(1)
|
|
1202
1275
|
});
|
|
1203
|
-
var ExternalAttachmentReference =
|
|
1204
|
-
type:
|
|
1205
|
-
filename:
|
|
1206
|
-
content_type:
|
|
1207
|
-
url:
|
|
1276
|
+
var ExternalAttachmentReference = z6.object({
|
|
1277
|
+
type: z6.literal("external_attachment"),
|
|
1278
|
+
filename: z6.string().min(1),
|
|
1279
|
+
content_type: z6.string().min(1),
|
|
1280
|
+
url: z6.string().min(1)
|
|
1208
1281
|
});
|
|
1209
|
-
var AttachmentReference =
|
|
1282
|
+
var AttachmentReference = z6.discriminatedUnion("type", [
|
|
1210
1283
|
BraintrustAttachmentReference,
|
|
1211
1284
|
ExternalAttachmentReference
|
|
1212
1285
|
]);
|
|
1213
|
-
var UploadStatus =
|
|
1214
|
-
var AttachmentStatus =
|
|
1286
|
+
var UploadStatus = z6.enum(["uploading", "done", "error"]);
|
|
1287
|
+
var AttachmentStatus = z6.object({
|
|
1215
1288
|
upload_status: UploadStatus,
|
|
1216
|
-
error_message:
|
|
1289
|
+
error_message: z6.string().optional()
|
|
1217
1290
|
});
|
|
1218
|
-
var BraintrustModelParams =
|
|
1219
|
-
var CallEvent =
|
|
1220
|
-
|
|
1221
|
-
id:
|
|
1222
|
-
data:
|
|
1223
|
-
event:
|
|
1291
|
+
var BraintrustModelParams = z6.object({ use_cache: z6.boolean() }).partial();
|
|
1292
|
+
var CallEvent = z6.union([
|
|
1293
|
+
z6.object({
|
|
1294
|
+
id: z6.string().optional(),
|
|
1295
|
+
data: z6.string(),
|
|
1296
|
+
event: z6.literal("text_delta")
|
|
1224
1297
|
}),
|
|
1225
|
-
|
|
1226
|
-
id:
|
|
1227
|
-
data:
|
|
1228
|
-
event:
|
|
1298
|
+
z6.object({
|
|
1299
|
+
id: z6.string().optional(),
|
|
1300
|
+
data: z6.string(),
|
|
1301
|
+
event: z6.literal("reasoning_delta")
|
|
1229
1302
|
}),
|
|
1230
|
-
|
|
1231
|
-
id:
|
|
1232
|
-
data:
|
|
1233
|
-
event:
|
|
1303
|
+
z6.object({
|
|
1304
|
+
id: z6.string().optional(),
|
|
1305
|
+
data: z6.string(),
|
|
1306
|
+
event: z6.literal("json_delta")
|
|
1234
1307
|
}),
|
|
1235
|
-
|
|
1236
|
-
id:
|
|
1237
|
-
data:
|
|
1238
|
-
event:
|
|
1308
|
+
z6.object({
|
|
1309
|
+
id: z6.string().optional(),
|
|
1310
|
+
data: z6.string(),
|
|
1311
|
+
event: z6.literal("progress")
|
|
1239
1312
|
}),
|
|
1240
|
-
|
|
1241
|
-
id:
|
|
1242
|
-
data:
|
|
1243
|
-
event:
|
|
1313
|
+
z6.object({
|
|
1314
|
+
id: z6.string().optional(),
|
|
1315
|
+
data: z6.string(),
|
|
1316
|
+
event: z6.literal("error")
|
|
1244
1317
|
}),
|
|
1245
|
-
|
|
1246
|
-
id:
|
|
1247
|
-
data:
|
|
1248
|
-
event:
|
|
1318
|
+
z6.object({
|
|
1319
|
+
id: z6.string().optional(),
|
|
1320
|
+
data: z6.string(),
|
|
1321
|
+
event: z6.literal("console")
|
|
1249
1322
|
}),
|
|
1250
|
-
|
|
1251
|
-
id:
|
|
1252
|
-
event:
|
|
1253
|
-
data:
|
|
1323
|
+
z6.object({
|
|
1324
|
+
id: z6.string().optional(),
|
|
1325
|
+
event: z6.literal("start"),
|
|
1326
|
+
data: z6.literal("")
|
|
1254
1327
|
}),
|
|
1255
|
-
|
|
1256
|
-
id:
|
|
1257
|
-
event:
|
|
1258
|
-
data:
|
|
1328
|
+
z6.object({
|
|
1329
|
+
id: z6.string().optional(),
|
|
1330
|
+
event: z6.literal("done"),
|
|
1331
|
+
data: z6.literal("")
|
|
1259
1332
|
})
|
|
1260
1333
|
]);
|
|
1261
|
-
var ChatCompletionContentPartTextWithTitle =
|
|
1262
|
-
text:
|
|
1263
|
-
type:
|
|
1264
|
-
cache_control:
|
|
1334
|
+
var ChatCompletionContentPartTextWithTitle = z6.object({
|
|
1335
|
+
text: z6.string().default(""),
|
|
1336
|
+
type: z6.literal("text"),
|
|
1337
|
+
cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
|
|
1265
1338
|
});
|
|
1266
|
-
var ChatCompletionContentPartImageWithTitle =
|
|
1267
|
-
image_url:
|
|
1268
|
-
url:
|
|
1269
|
-
detail:
|
|
1339
|
+
var ChatCompletionContentPartImageWithTitle = z6.object({
|
|
1340
|
+
image_url: z6.object({
|
|
1341
|
+
url: z6.string(),
|
|
1342
|
+
detail: z6.union([z6.literal("auto"), z6.literal("low"), z6.literal("high")]).optional()
|
|
1270
1343
|
}),
|
|
1271
|
-
type:
|
|
1344
|
+
type: z6.literal("image_url")
|
|
1272
1345
|
});
|
|
1273
|
-
var ChatCompletionContentPart =
|
|
1346
|
+
var ChatCompletionContentPart = z6.union([
|
|
1274
1347
|
ChatCompletionContentPartTextWithTitle,
|
|
1275
1348
|
ChatCompletionContentPartImageWithTitle
|
|
1276
1349
|
]);
|
|
1277
|
-
var ChatCompletionContentPartText =
|
|
1278
|
-
text:
|
|
1279
|
-
type:
|
|
1280
|
-
cache_control:
|
|
1350
|
+
var ChatCompletionContentPartText = z6.object({
|
|
1351
|
+
text: z6.string().default(""),
|
|
1352
|
+
type: z6.literal("text"),
|
|
1353
|
+
cache_control: z6.object({ type: z6.literal("ephemeral") }).optional()
|
|
1281
1354
|
});
|
|
1282
|
-
var ChatCompletionMessageToolCall =
|
|
1283
|
-
id:
|
|
1284
|
-
function:
|
|
1285
|
-
type:
|
|
1355
|
+
var ChatCompletionMessageToolCall = z6.object({
|
|
1356
|
+
id: z6.string(),
|
|
1357
|
+
function: z6.object({ arguments: z6.string(), name: z6.string() }),
|
|
1358
|
+
type: z6.literal("function")
|
|
1286
1359
|
});
|
|
1287
|
-
var ChatCompletionMessageReasoning =
|
|
1288
|
-
var ChatCompletionMessageParam =
|
|
1289
|
-
|
|
1290
|
-
content:
|
|
1291
|
-
role:
|
|
1292
|
-
name:
|
|
1360
|
+
var ChatCompletionMessageReasoning = z6.object({ id: z6.string(), content: z6.string() }).partial();
|
|
1361
|
+
var ChatCompletionMessageParam = z6.union([
|
|
1362
|
+
z6.object({
|
|
1363
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1364
|
+
role: z6.literal("system"),
|
|
1365
|
+
name: z6.string().optional()
|
|
1293
1366
|
}),
|
|
1294
|
-
|
|
1295
|
-
content:
|
|
1296
|
-
role:
|
|
1297
|
-
name:
|
|
1367
|
+
z6.object({
|
|
1368
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
|
|
1369
|
+
role: z6.literal("user"),
|
|
1370
|
+
name: z6.string().optional()
|
|
1298
1371
|
}),
|
|
1299
|
-
|
|
1300
|
-
role:
|
|
1301
|
-
content:
|
|
1302
|
-
function_call:
|
|
1303
|
-
name:
|
|
1304
|
-
tool_calls:
|
|
1305
|
-
reasoning:
|
|
1372
|
+
z6.object({
|
|
1373
|
+
role: z6.literal("assistant"),
|
|
1374
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
|
|
1375
|
+
function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
|
|
1376
|
+
name: z6.string().optional(),
|
|
1377
|
+
tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
|
|
1378
|
+
reasoning: z6.array(ChatCompletionMessageReasoning).optional()
|
|
1306
1379
|
}),
|
|
1307
|
-
|
|
1308
|
-
content:
|
|
1309
|
-
role:
|
|
1310
|
-
tool_call_id:
|
|
1380
|
+
z6.object({
|
|
1381
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1382
|
+
role: z6.literal("tool"),
|
|
1383
|
+
tool_call_id: z6.string().default("")
|
|
1311
1384
|
}),
|
|
1312
|
-
|
|
1313
|
-
content:
|
|
1314
|
-
name:
|
|
1315
|
-
role:
|
|
1385
|
+
z6.object({
|
|
1386
|
+
content: z6.union([z6.string(), z6.null()]),
|
|
1387
|
+
name: z6.string(),
|
|
1388
|
+
role: z6.literal("function")
|
|
1316
1389
|
}),
|
|
1317
|
-
|
|
1318
|
-
content:
|
|
1319
|
-
role:
|
|
1320
|
-
name:
|
|
1390
|
+
z6.object({
|
|
1391
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1392
|
+
role: z6.literal("developer"),
|
|
1393
|
+
name: z6.string().optional()
|
|
1321
1394
|
}),
|
|
1322
|
-
|
|
1323
|
-
role:
|
|
1324
|
-
content:
|
|
1395
|
+
z6.object({
|
|
1396
|
+
role: z6.literal("model"),
|
|
1397
|
+
content: z6.union([z6.string(), z6.null()]).optional()
|
|
1325
1398
|
})
|
|
1326
1399
|
]);
|
|
1327
|
-
var ChatCompletionOpenAIMessageParam =
|
|
1328
|
-
|
|
1329
|
-
content:
|
|
1330
|
-
role:
|
|
1331
|
-
name:
|
|
1400
|
+
var ChatCompletionOpenAIMessageParam = z6.union([
|
|
1401
|
+
z6.object({
|
|
1402
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1403
|
+
role: z6.literal("system"),
|
|
1404
|
+
name: z6.string().optional()
|
|
1332
1405
|
}),
|
|
1333
|
-
|
|
1334
|
-
content:
|
|
1335
|
-
role:
|
|
1336
|
-
name:
|
|
1406
|
+
z6.object({
|
|
1407
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPart)]),
|
|
1408
|
+
role: z6.literal("user"),
|
|
1409
|
+
name: z6.string().optional()
|
|
1337
1410
|
}),
|
|
1338
|
-
|
|
1339
|
-
role:
|
|
1340
|
-
content:
|
|
1341
|
-
function_call:
|
|
1342
|
-
name:
|
|
1343
|
-
tool_calls:
|
|
1344
|
-
reasoning:
|
|
1411
|
+
z6.object({
|
|
1412
|
+
role: z6.literal("assistant"),
|
|
1413
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText), z6.null()]).optional(),
|
|
1414
|
+
function_call: z6.object({ arguments: z6.string(), name: z6.string() }).optional(),
|
|
1415
|
+
name: z6.string().optional(),
|
|
1416
|
+
tool_calls: z6.array(ChatCompletionMessageToolCall).optional(),
|
|
1417
|
+
reasoning: z6.array(ChatCompletionMessageReasoning).optional()
|
|
1345
1418
|
}),
|
|
1346
|
-
|
|
1347
|
-
content:
|
|
1348
|
-
role:
|
|
1349
|
-
tool_call_id:
|
|
1419
|
+
z6.object({
|
|
1420
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1421
|
+
role: z6.literal("tool"),
|
|
1422
|
+
tool_call_id: z6.string().default("")
|
|
1350
1423
|
}),
|
|
1351
|
-
|
|
1352
|
-
content:
|
|
1353
|
-
name:
|
|
1354
|
-
role:
|
|
1424
|
+
z6.object({
|
|
1425
|
+
content: z6.union([z6.string(), z6.null()]),
|
|
1426
|
+
name: z6.string(),
|
|
1427
|
+
role: z6.literal("function")
|
|
1355
1428
|
}),
|
|
1356
|
-
|
|
1357
|
-
content:
|
|
1358
|
-
role:
|
|
1359
|
-
name:
|
|
1429
|
+
z6.object({
|
|
1430
|
+
content: z6.union([z6.string(), z6.array(ChatCompletionContentPartText)]),
|
|
1431
|
+
role: z6.literal("developer"),
|
|
1432
|
+
name: z6.string().optional()
|
|
1360
1433
|
})
|
|
1361
1434
|
]);
|
|
1362
|
-
var ChatCompletionTool =
|
|
1363
|
-
function:
|
|
1364
|
-
name:
|
|
1365
|
-
description:
|
|
1366
|
-
parameters:
|
|
1435
|
+
var ChatCompletionTool = z6.object({
|
|
1436
|
+
function: z6.object({
|
|
1437
|
+
name: z6.string(),
|
|
1438
|
+
description: z6.string().optional(),
|
|
1439
|
+
parameters: z6.object({}).partial().passthrough().optional()
|
|
1367
1440
|
}),
|
|
1368
|
-
type:
|
|
1441
|
+
type: z6.literal("function")
|
|
1369
1442
|
});
|
|
1370
|
-
var CodeBundle =
|
|
1371
|
-
runtime_context:
|
|
1372
|
-
runtime:
|
|
1373
|
-
version:
|
|
1443
|
+
var CodeBundle = z6.object({
|
|
1444
|
+
runtime_context: z6.object({
|
|
1445
|
+
runtime: z6.enum(["node", "python"]),
|
|
1446
|
+
version: z6.string()
|
|
1374
1447
|
}),
|
|
1375
|
-
location:
|
|
1376
|
-
|
|
1377
|
-
type:
|
|
1378
|
-
eval_name:
|
|
1379
|
-
position:
|
|
1380
|
-
|
|
1381
|
-
|
|
1448
|
+
location: z6.union([
|
|
1449
|
+
z6.object({
|
|
1450
|
+
type: z6.literal("experiment"),
|
|
1451
|
+
eval_name: z6.string(),
|
|
1452
|
+
position: z6.union([
|
|
1453
|
+
z6.object({ type: z6.literal("task") }),
|
|
1454
|
+
z6.object({ type: z6.literal("scorer"), index: z6.number().int().gte(0) })
|
|
1382
1455
|
])
|
|
1383
1456
|
}),
|
|
1384
|
-
|
|
1457
|
+
z6.object({ type: z6.literal("function"), index: z6.number().int().gte(0) })
|
|
1385
1458
|
]),
|
|
1386
|
-
bundle_id:
|
|
1387
|
-
preview:
|
|
1459
|
+
bundle_id: z6.string(),
|
|
1460
|
+
preview: z6.union([z6.string(), z6.null()]).optional()
|
|
1388
1461
|
});
|
|
1389
|
-
var Dataset =
|
|
1390
|
-
id:
|
|
1391
|
-
project_id:
|
|
1392
|
-
name:
|
|
1393
|
-
description:
|
|
1394
|
-
created:
|
|
1395
|
-
deleted_at:
|
|
1396
|
-
user_id:
|
|
1397
|
-
metadata:
|
|
1462
|
+
var Dataset = z6.object({
|
|
1463
|
+
id: z6.string().uuid(),
|
|
1464
|
+
project_id: z6.string().uuid(),
|
|
1465
|
+
name: z6.string(),
|
|
1466
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1467
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1468
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1469
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1470
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
1398
1471
|
});
|
|
1399
|
-
var ObjectReferenceNullish =
|
|
1400
|
-
|
|
1401
|
-
object_type:
|
|
1472
|
+
var ObjectReferenceNullish = z6.union([
|
|
1473
|
+
z6.object({
|
|
1474
|
+
object_type: z6.enum([
|
|
1402
1475
|
"project_logs",
|
|
1403
1476
|
"experiment",
|
|
1404
1477
|
"dataset",
|
|
@@ -1406,399 +1479,399 @@ var ObjectReferenceNullish = z5.union([
|
|
|
1406
1479
|
"function",
|
|
1407
1480
|
"prompt_session"
|
|
1408
1481
|
]),
|
|
1409
|
-
object_id:
|
|
1410
|
-
id:
|
|
1411
|
-
_xact_id:
|
|
1412
|
-
created:
|
|
1482
|
+
object_id: z6.string().uuid(),
|
|
1483
|
+
id: z6.string(),
|
|
1484
|
+
_xact_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1485
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1413
1486
|
}),
|
|
1414
|
-
|
|
1487
|
+
z6.null()
|
|
1415
1488
|
]);
|
|
1416
|
-
var DatasetEvent =
|
|
1417
|
-
id:
|
|
1418
|
-
_xact_id:
|
|
1419
|
-
created:
|
|
1420
|
-
_pagination_key:
|
|
1421
|
-
project_id:
|
|
1422
|
-
dataset_id:
|
|
1423
|
-
input:
|
|
1424
|
-
expected:
|
|
1425
|
-
metadata:
|
|
1426
|
-
|
|
1427
|
-
|
|
1489
|
+
var DatasetEvent = z6.object({
|
|
1490
|
+
id: z6.string(),
|
|
1491
|
+
_xact_id: z6.string(),
|
|
1492
|
+
created: z6.string().datetime({ offset: true }),
|
|
1493
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
1494
|
+
project_id: z6.string().uuid(),
|
|
1495
|
+
dataset_id: z6.string().uuid(),
|
|
1496
|
+
input: z6.unknown().optional(),
|
|
1497
|
+
expected: z6.unknown().optional(),
|
|
1498
|
+
metadata: z6.union([
|
|
1499
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
1500
|
+
z6.null()
|
|
1428
1501
|
]).optional(),
|
|
1429
|
-
tags:
|
|
1430
|
-
span_id:
|
|
1431
|
-
root_span_id:
|
|
1432
|
-
is_root:
|
|
1502
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1503
|
+
span_id: z6.string(),
|
|
1504
|
+
root_span_id: z6.string(),
|
|
1505
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1433
1506
|
origin: ObjectReferenceNullish.optional()
|
|
1434
1507
|
});
|
|
1435
|
-
var EnvVar =
|
|
1436
|
-
id:
|
|
1437
|
-
object_type:
|
|
1438
|
-
object_id:
|
|
1439
|
-
name:
|
|
1440
|
-
created:
|
|
1441
|
-
used:
|
|
1508
|
+
var EnvVar = z6.object({
|
|
1509
|
+
id: z6.string().uuid(),
|
|
1510
|
+
object_type: z6.enum(["organization", "project", "function"]),
|
|
1511
|
+
object_id: z6.string().uuid(),
|
|
1512
|
+
name: z6.string(),
|
|
1513
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1514
|
+
used: z6.union([z6.string(), z6.null()]).optional()
|
|
1442
1515
|
});
|
|
1443
|
-
var RepoInfo =
|
|
1444
|
-
|
|
1445
|
-
commit:
|
|
1446
|
-
branch:
|
|
1447
|
-
tag:
|
|
1448
|
-
dirty:
|
|
1449
|
-
author_name:
|
|
1450
|
-
author_email:
|
|
1451
|
-
commit_message:
|
|
1452
|
-
commit_time:
|
|
1453
|
-
git_diff:
|
|
1516
|
+
var RepoInfo = z6.union([
|
|
1517
|
+
z6.object({
|
|
1518
|
+
commit: z6.union([z6.string(), z6.null()]),
|
|
1519
|
+
branch: z6.union([z6.string(), z6.null()]),
|
|
1520
|
+
tag: z6.union([z6.string(), z6.null()]),
|
|
1521
|
+
dirty: z6.union([z6.boolean(), z6.null()]),
|
|
1522
|
+
author_name: z6.union([z6.string(), z6.null()]),
|
|
1523
|
+
author_email: z6.union([z6.string(), z6.null()]),
|
|
1524
|
+
commit_message: z6.union([z6.string(), z6.null()]),
|
|
1525
|
+
commit_time: z6.union([z6.string(), z6.null()]),
|
|
1526
|
+
git_diff: z6.union([z6.string(), z6.null()])
|
|
1454
1527
|
}).partial(),
|
|
1455
|
-
|
|
1528
|
+
z6.null()
|
|
1456
1529
|
]);
|
|
1457
|
-
var Experiment =
|
|
1458
|
-
id:
|
|
1459
|
-
project_id:
|
|
1460
|
-
name:
|
|
1461
|
-
description:
|
|
1462
|
-
created:
|
|
1530
|
+
var Experiment = z6.object({
|
|
1531
|
+
id: z6.string().uuid(),
|
|
1532
|
+
project_id: z6.string().uuid(),
|
|
1533
|
+
name: z6.string(),
|
|
1534
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1535
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1463
1536
|
repo_info: RepoInfo.optional(),
|
|
1464
|
-
commit:
|
|
1465
|
-
base_exp_id:
|
|
1466
|
-
deleted_at:
|
|
1467
|
-
dataset_id:
|
|
1468
|
-
dataset_version:
|
|
1469
|
-
public:
|
|
1470
|
-
user_id:
|
|
1471
|
-
metadata:
|
|
1472
|
-
tags:
|
|
1537
|
+
commit: z6.union([z6.string(), z6.null()]).optional(),
|
|
1538
|
+
base_exp_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1539
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1540
|
+
dataset_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1541
|
+
dataset_version: z6.union([z6.string(), z6.null()]).optional(),
|
|
1542
|
+
public: z6.boolean(),
|
|
1543
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1544
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1545
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
|
|
1473
1546
|
});
|
|
1474
|
-
var SpanType =
|
|
1475
|
-
|
|
1476
|
-
|
|
1547
|
+
var SpanType = z6.union([
|
|
1548
|
+
z6.enum(["llm", "score", "function", "eval", "task", "tool"]),
|
|
1549
|
+
z6.null()
|
|
1477
1550
|
]);
|
|
1478
|
-
var SpanAttributes =
|
|
1479
|
-
|
|
1480
|
-
|
|
1551
|
+
var SpanAttributes = z6.union([
|
|
1552
|
+
z6.object({ name: z6.union([z6.string(), z6.null()]), type: SpanType }).partial().passthrough(),
|
|
1553
|
+
z6.null()
|
|
1481
1554
|
]);
|
|
1482
|
-
var ExperimentEvent =
|
|
1483
|
-
id:
|
|
1484
|
-
_xact_id:
|
|
1485
|
-
created:
|
|
1486
|
-
_pagination_key:
|
|
1487
|
-
project_id:
|
|
1488
|
-
experiment_id:
|
|
1489
|
-
input:
|
|
1490
|
-
output:
|
|
1491
|
-
expected:
|
|
1492
|
-
error:
|
|
1493
|
-
scores:
|
|
1494
|
-
metadata:
|
|
1495
|
-
|
|
1496
|
-
|
|
1555
|
+
var ExperimentEvent = z6.object({
|
|
1556
|
+
id: z6.string(),
|
|
1557
|
+
_xact_id: z6.string(),
|
|
1558
|
+
created: z6.string().datetime({ offset: true }),
|
|
1559
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
1560
|
+
project_id: z6.string().uuid(),
|
|
1561
|
+
experiment_id: z6.string().uuid(),
|
|
1562
|
+
input: z6.unknown().optional(),
|
|
1563
|
+
output: z6.unknown().optional(),
|
|
1564
|
+
expected: z6.unknown().optional(),
|
|
1565
|
+
error: z6.unknown().optional(),
|
|
1566
|
+
scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
|
|
1567
|
+
metadata: z6.union([
|
|
1568
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
1569
|
+
z6.null()
|
|
1497
1570
|
]).optional(),
|
|
1498
|
-
tags:
|
|
1499
|
-
metrics:
|
|
1500
|
-
context:
|
|
1501
|
-
|
|
1502
|
-
caller_functionname:
|
|
1503
|
-
caller_filename:
|
|
1504
|
-
caller_lineno:
|
|
1571
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1572
|
+
metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
|
|
1573
|
+
context: z6.union([
|
|
1574
|
+
z6.object({
|
|
1575
|
+
caller_functionname: z6.union([z6.string(), z6.null()]),
|
|
1576
|
+
caller_filename: z6.union([z6.string(), z6.null()]),
|
|
1577
|
+
caller_lineno: z6.union([z6.number(), z6.null()])
|
|
1505
1578
|
}).partial().passthrough(),
|
|
1506
|
-
|
|
1579
|
+
z6.null()
|
|
1507
1580
|
]).optional(),
|
|
1508
|
-
span_id:
|
|
1509
|
-
span_parents:
|
|
1510
|
-
root_span_id:
|
|
1581
|
+
span_id: z6.string(),
|
|
1582
|
+
span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1583
|
+
root_span_id: z6.string(),
|
|
1511
1584
|
span_attributes: SpanAttributes.optional(),
|
|
1512
|
-
is_root:
|
|
1585
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1513
1586
|
origin: ObjectReferenceNullish.optional()
|
|
1514
1587
|
});
|
|
1515
|
-
var ExtendedSavedFunctionId =
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
type:
|
|
1520
|
-
project_id:
|
|
1521
|
-
slug:
|
|
1588
|
+
var ExtendedSavedFunctionId = z6.union([
|
|
1589
|
+
z6.object({ type: z6.literal("function"), id: z6.string() }),
|
|
1590
|
+
z6.object({ type: z6.literal("global"), name: z6.string() }),
|
|
1591
|
+
z6.object({
|
|
1592
|
+
type: z6.literal("slug"),
|
|
1593
|
+
project_id: z6.string(),
|
|
1594
|
+
slug: z6.string()
|
|
1522
1595
|
})
|
|
1523
1596
|
]);
|
|
1524
|
-
var PromptBlockDataNullish =
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
type:
|
|
1528
|
-
messages:
|
|
1529
|
-
tools:
|
|
1597
|
+
var PromptBlockDataNullish = z6.union([
|
|
1598
|
+
z6.object({ type: z6.literal("completion"), content: z6.string() }),
|
|
1599
|
+
z6.object({
|
|
1600
|
+
type: z6.literal("chat"),
|
|
1601
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
1602
|
+
tools: z6.string().optional()
|
|
1530
1603
|
}),
|
|
1531
|
-
|
|
1604
|
+
z6.null()
|
|
1532
1605
|
]);
|
|
1533
|
-
var ModelParams =
|
|
1534
|
-
|
|
1535
|
-
use_cache:
|
|
1536
|
-
temperature:
|
|
1537
|
-
top_p:
|
|
1538
|
-
max_tokens:
|
|
1539
|
-
max_completion_tokens:
|
|
1540
|
-
frequency_penalty:
|
|
1541
|
-
presence_penalty:
|
|
1606
|
+
var ModelParams = z6.union([
|
|
1607
|
+
z6.object({
|
|
1608
|
+
use_cache: z6.boolean(),
|
|
1609
|
+
temperature: z6.number(),
|
|
1610
|
+
top_p: z6.number(),
|
|
1611
|
+
max_tokens: z6.number(),
|
|
1612
|
+
max_completion_tokens: z6.number(),
|
|
1613
|
+
frequency_penalty: z6.number(),
|
|
1614
|
+
presence_penalty: z6.number(),
|
|
1542
1615
|
response_format: ResponseFormatNullish,
|
|
1543
|
-
tool_choice:
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
type:
|
|
1549
|
-
function:
|
|
1616
|
+
tool_choice: z6.union([
|
|
1617
|
+
z6.literal("auto"),
|
|
1618
|
+
z6.literal("none"),
|
|
1619
|
+
z6.literal("required"),
|
|
1620
|
+
z6.object({
|
|
1621
|
+
type: z6.literal("function"),
|
|
1622
|
+
function: z6.object({ name: z6.string() })
|
|
1550
1623
|
})
|
|
1551
1624
|
]),
|
|
1552
|
-
function_call:
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1625
|
+
function_call: z6.union([
|
|
1626
|
+
z6.literal("auto"),
|
|
1627
|
+
z6.literal("none"),
|
|
1628
|
+
z6.object({ name: z6.string() })
|
|
1556
1629
|
]),
|
|
1557
|
-
n:
|
|
1558
|
-
stop:
|
|
1559
|
-
reasoning_effort:
|
|
1560
|
-
verbosity:
|
|
1630
|
+
n: z6.number(),
|
|
1631
|
+
stop: z6.array(z6.string()),
|
|
1632
|
+
reasoning_effort: z6.enum(["minimal", "low", "medium", "high"]),
|
|
1633
|
+
verbosity: z6.enum(["low", "medium", "high"])
|
|
1561
1634
|
}).partial().passthrough(),
|
|
1562
|
-
|
|
1563
|
-
use_cache:
|
|
1564
|
-
max_tokens:
|
|
1565
|
-
temperature:
|
|
1566
|
-
top_p:
|
|
1567
|
-
top_k:
|
|
1568
|
-
stop_sequences:
|
|
1569
|
-
max_tokens_to_sample:
|
|
1635
|
+
z6.object({
|
|
1636
|
+
use_cache: z6.boolean().optional(),
|
|
1637
|
+
max_tokens: z6.number(),
|
|
1638
|
+
temperature: z6.number(),
|
|
1639
|
+
top_p: z6.number().optional(),
|
|
1640
|
+
top_k: z6.number().optional(),
|
|
1641
|
+
stop_sequences: z6.array(z6.string()).optional(),
|
|
1642
|
+
max_tokens_to_sample: z6.number().optional()
|
|
1570
1643
|
}).passthrough(),
|
|
1571
|
-
|
|
1572
|
-
use_cache:
|
|
1573
|
-
temperature:
|
|
1574
|
-
maxOutputTokens:
|
|
1575
|
-
topP:
|
|
1576
|
-
topK:
|
|
1644
|
+
z6.object({
|
|
1645
|
+
use_cache: z6.boolean(),
|
|
1646
|
+
temperature: z6.number(),
|
|
1647
|
+
maxOutputTokens: z6.number(),
|
|
1648
|
+
topP: z6.number(),
|
|
1649
|
+
topK: z6.number()
|
|
1577
1650
|
}).partial().passthrough(),
|
|
1578
|
-
|
|
1579
|
-
use_cache:
|
|
1580
|
-
temperature:
|
|
1581
|
-
topK:
|
|
1651
|
+
z6.object({
|
|
1652
|
+
use_cache: z6.boolean(),
|
|
1653
|
+
temperature: z6.number(),
|
|
1654
|
+
topK: z6.number()
|
|
1582
1655
|
}).partial().passthrough(),
|
|
1583
|
-
|
|
1656
|
+
z6.object({ use_cache: z6.boolean() }).partial().passthrough()
|
|
1584
1657
|
]);
|
|
1585
|
-
var PromptOptionsNullish =
|
|
1586
|
-
|
|
1587
|
-
|
|
1658
|
+
var PromptOptionsNullish = z6.union([
|
|
1659
|
+
z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial(),
|
|
1660
|
+
z6.null()
|
|
1588
1661
|
]);
|
|
1589
|
-
var PromptParserNullish =
|
|
1590
|
-
|
|
1591
|
-
type:
|
|
1592
|
-
use_cot:
|
|
1593
|
-
choice_scores:
|
|
1662
|
+
var PromptParserNullish = z6.union([
|
|
1663
|
+
z6.object({
|
|
1664
|
+
type: z6.literal("llm_classifier"),
|
|
1665
|
+
use_cot: z6.boolean(),
|
|
1666
|
+
choice_scores: z6.record(z6.number().gte(0).lte(1))
|
|
1594
1667
|
}),
|
|
1595
|
-
|
|
1668
|
+
z6.null()
|
|
1596
1669
|
]);
|
|
1597
|
-
var SavedFunctionId =
|
|
1598
|
-
|
|
1599
|
-
|
|
1670
|
+
var SavedFunctionId = z6.union([
|
|
1671
|
+
z6.object({ type: z6.literal("function"), id: z6.string() }),
|
|
1672
|
+
z6.object({ type: z6.literal("global"), name: z6.string() })
|
|
1600
1673
|
]);
|
|
1601
|
-
var PromptDataNullish =
|
|
1602
|
-
|
|
1674
|
+
var PromptDataNullish = z6.union([
|
|
1675
|
+
z6.object({
|
|
1603
1676
|
prompt: PromptBlockDataNullish,
|
|
1604
1677
|
options: PromptOptionsNullish,
|
|
1605
1678
|
parser: PromptParserNullish,
|
|
1606
|
-
tool_functions:
|
|
1607
|
-
origin:
|
|
1608
|
-
|
|
1609
|
-
prompt_id:
|
|
1610
|
-
project_id:
|
|
1611
|
-
prompt_version:
|
|
1679
|
+
tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
|
|
1680
|
+
origin: z6.union([
|
|
1681
|
+
z6.object({
|
|
1682
|
+
prompt_id: z6.string(),
|
|
1683
|
+
project_id: z6.string(),
|
|
1684
|
+
prompt_version: z6.string()
|
|
1612
1685
|
}).partial(),
|
|
1613
|
-
|
|
1686
|
+
z6.null()
|
|
1614
1687
|
])
|
|
1615
1688
|
}).partial(),
|
|
1616
|
-
|
|
1689
|
+
z6.null()
|
|
1617
1690
|
]);
|
|
1618
|
-
var FunctionTypeEnumNullish =
|
|
1619
|
-
|
|
1620
|
-
|
|
1691
|
+
var FunctionTypeEnumNullish = z6.union([
|
|
1692
|
+
z6.enum(["llm", "scorer", "task", "tool"]),
|
|
1693
|
+
z6.null()
|
|
1621
1694
|
]);
|
|
1622
|
-
var FunctionIdRef =
|
|
1623
|
-
var PromptBlockData =
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
type:
|
|
1627
|
-
messages:
|
|
1628
|
-
tools:
|
|
1695
|
+
var FunctionIdRef = z6.object({}).partial().passthrough();
|
|
1696
|
+
var PromptBlockData = z6.union([
|
|
1697
|
+
z6.object({ type: z6.literal("completion"), content: z6.string() }),
|
|
1698
|
+
z6.object({
|
|
1699
|
+
type: z6.literal("chat"),
|
|
1700
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
1701
|
+
tools: z6.string().optional()
|
|
1629
1702
|
})
|
|
1630
1703
|
]);
|
|
1631
|
-
var GraphNode =
|
|
1632
|
-
|
|
1633
|
-
description:
|
|
1634
|
-
position:
|
|
1635
|
-
type:
|
|
1704
|
+
var GraphNode = z6.union([
|
|
1705
|
+
z6.object({
|
|
1706
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1707
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1708
|
+
type: z6.literal("function"),
|
|
1636
1709
|
function: FunctionIdRef
|
|
1637
1710
|
}),
|
|
1638
|
-
|
|
1639
|
-
description:
|
|
1640
|
-
position:
|
|
1641
|
-
type:
|
|
1711
|
+
z6.object({
|
|
1712
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1713
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1714
|
+
type: z6.literal("input")
|
|
1642
1715
|
}),
|
|
1643
|
-
|
|
1644
|
-
description:
|
|
1645
|
-
position:
|
|
1646
|
-
type:
|
|
1716
|
+
z6.object({
|
|
1717
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1718
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1719
|
+
type: z6.literal("output")
|
|
1647
1720
|
}),
|
|
1648
|
-
|
|
1649
|
-
description:
|
|
1650
|
-
position:
|
|
1651
|
-
type:
|
|
1652
|
-
value:
|
|
1721
|
+
z6.object({
|
|
1722
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1723
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1724
|
+
type: z6.literal("literal"),
|
|
1725
|
+
value: z6.unknown().optional()
|
|
1653
1726
|
}),
|
|
1654
|
-
|
|
1655
|
-
description:
|
|
1656
|
-
position:
|
|
1657
|
-
type:
|
|
1658
|
-
expr:
|
|
1727
|
+
z6.object({
|
|
1728
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1729
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1730
|
+
type: z6.literal("btql"),
|
|
1731
|
+
expr: z6.string()
|
|
1659
1732
|
}),
|
|
1660
|
-
|
|
1661
|
-
description:
|
|
1662
|
-
position:
|
|
1663
|
-
type:
|
|
1664
|
-
condition:
|
|
1733
|
+
z6.object({
|
|
1734
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1735
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1736
|
+
type: z6.literal("gate"),
|
|
1737
|
+
condition: z6.union([z6.string(), z6.null()]).optional()
|
|
1665
1738
|
}),
|
|
1666
|
-
|
|
1667
|
-
description:
|
|
1668
|
-
position:
|
|
1669
|
-
type:
|
|
1739
|
+
z6.object({
|
|
1740
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1741
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1742
|
+
type: z6.literal("aggregator")
|
|
1670
1743
|
}),
|
|
1671
|
-
|
|
1672
|
-
description:
|
|
1673
|
-
position:
|
|
1674
|
-
type:
|
|
1744
|
+
z6.object({
|
|
1745
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1746
|
+
position: z6.union([z6.object({ x: z6.number(), y: z6.number() }), z6.null()]).optional(),
|
|
1747
|
+
type: z6.literal("prompt_template"),
|
|
1675
1748
|
prompt: PromptBlockData
|
|
1676
1749
|
})
|
|
1677
1750
|
]);
|
|
1678
|
-
var GraphEdge =
|
|
1679
|
-
source:
|
|
1680
|
-
target:
|
|
1681
|
-
purpose:
|
|
1751
|
+
var GraphEdge = z6.object({
|
|
1752
|
+
source: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
|
|
1753
|
+
target: z6.object({ node: z6.string().max(1024), variable: z6.string() }),
|
|
1754
|
+
purpose: z6.enum(["control", "data", "messages"])
|
|
1682
1755
|
});
|
|
1683
|
-
var GraphData =
|
|
1684
|
-
type:
|
|
1685
|
-
nodes:
|
|
1686
|
-
edges:
|
|
1756
|
+
var GraphData = z6.object({
|
|
1757
|
+
type: z6.literal("graph"),
|
|
1758
|
+
nodes: z6.record(GraphNode),
|
|
1759
|
+
edges: z6.record(GraphEdge)
|
|
1687
1760
|
});
|
|
1688
|
-
var FunctionData =
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
type:
|
|
1692
|
-
data:
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
type:
|
|
1696
|
-
runtime_context:
|
|
1697
|
-
runtime:
|
|
1698
|
-
version:
|
|
1761
|
+
var FunctionData = z6.union([
|
|
1762
|
+
z6.object({ type: z6.literal("prompt") }),
|
|
1763
|
+
z6.object({
|
|
1764
|
+
type: z6.literal("code"),
|
|
1765
|
+
data: z6.union([
|
|
1766
|
+
z6.object({ type: z6.literal("bundle") }).and(CodeBundle),
|
|
1767
|
+
z6.object({
|
|
1768
|
+
type: z6.literal("inline"),
|
|
1769
|
+
runtime_context: z6.object({
|
|
1770
|
+
runtime: z6.enum(["node", "python"]),
|
|
1771
|
+
version: z6.string()
|
|
1699
1772
|
}),
|
|
1700
|
-
code:
|
|
1773
|
+
code: z6.string()
|
|
1701
1774
|
})
|
|
1702
1775
|
])
|
|
1703
1776
|
}),
|
|
1704
1777
|
GraphData,
|
|
1705
|
-
|
|
1706
|
-
type:
|
|
1707
|
-
endpoint:
|
|
1708
|
-
eval_name:
|
|
1709
|
-
parameters:
|
|
1778
|
+
z6.object({
|
|
1779
|
+
type: z6.literal("remote_eval"),
|
|
1780
|
+
endpoint: z6.string(),
|
|
1781
|
+
eval_name: z6.string(),
|
|
1782
|
+
parameters: z6.object({}).partial().passthrough()
|
|
1710
1783
|
}),
|
|
1711
|
-
|
|
1784
|
+
z6.object({ type: z6.literal("global"), name: z6.string() })
|
|
1712
1785
|
]);
|
|
1713
|
-
var Function =
|
|
1714
|
-
id:
|
|
1715
|
-
_xact_id:
|
|
1716
|
-
project_id:
|
|
1717
|
-
log_id:
|
|
1718
|
-
org_id:
|
|
1719
|
-
name:
|
|
1720
|
-
slug:
|
|
1721
|
-
description:
|
|
1722
|
-
created:
|
|
1786
|
+
var Function = z6.object({
|
|
1787
|
+
id: z6.string().uuid(),
|
|
1788
|
+
_xact_id: z6.string(),
|
|
1789
|
+
project_id: z6.string().uuid(),
|
|
1790
|
+
log_id: z6.literal("p"),
|
|
1791
|
+
org_id: z6.string().uuid(),
|
|
1792
|
+
name: z6.string(),
|
|
1793
|
+
slug: z6.string(),
|
|
1794
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1795
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1723
1796
|
prompt_data: PromptDataNullish.optional(),
|
|
1724
|
-
tags:
|
|
1725
|
-
metadata:
|
|
1797
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1798
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
1726
1799
|
function_type: FunctionTypeEnumNullish.optional(),
|
|
1727
1800
|
function_data: FunctionData,
|
|
1728
|
-
origin:
|
|
1729
|
-
|
|
1730
|
-
object_type: AclObjectType.and(
|
|
1731
|
-
object_id:
|
|
1732
|
-
internal:
|
|
1801
|
+
origin: z6.union([
|
|
1802
|
+
z6.object({
|
|
1803
|
+
object_type: AclObjectType.and(z6.string()),
|
|
1804
|
+
object_id: z6.string().uuid(),
|
|
1805
|
+
internal: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1733
1806
|
}),
|
|
1734
|
-
|
|
1807
|
+
z6.null()
|
|
1735
1808
|
]).optional(),
|
|
1736
|
-
function_schema:
|
|
1737
|
-
|
|
1738
|
-
|
|
1809
|
+
function_schema: z6.union([
|
|
1810
|
+
z6.object({ parameters: z6.unknown(), returns: z6.unknown() }).partial(),
|
|
1811
|
+
z6.null()
|
|
1739
1812
|
]).optional()
|
|
1740
1813
|
});
|
|
1741
|
-
var FunctionFormat =
|
|
1742
|
-
var PromptData =
|
|
1814
|
+
var FunctionFormat = z6.enum(["llm", "code", "global", "graph"]);
|
|
1815
|
+
var PromptData = z6.object({
|
|
1743
1816
|
prompt: PromptBlockDataNullish,
|
|
1744
1817
|
options: PromptOptionsNullish,
|
|
1745
1818
|
parser: PromptParserNullish,
|
|
1746
|
-
tool_functions:
|
|
1747
|
-
origin:
|
|
1748
|
-
|
|
1749
|
-
prompt_id:
|
|
1750
|
-
project_id:
|
|
1751
|
-
prompt_version:
|
|
1819
|
+
tool_functions: z6.union([z6.array(SavedFunctionId), z6.null()]),
|
|
1820
|
+
origin: z6.union([
|
|
1821
|
+
z6.object({
|
|
1822
|
+
prompt_id: z6.string(),
|
|
1823
|
+
project_id: z6.string(),
|
|
1824
|
+
prompt_version: z6.string()
|
|
1752
1825
|
}).partial(),
|
|
1753
|
-
|
|
1826
|
+
z6.null()
|
|
1754
1827
|
])
|
|
1755
1828
|
}).partial();
|
|
1756
|
-
var FunctionTypeEnum =
|
|
1757
|
-
var FunctionId =
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
project_name:
|
|
1761
|
-
slug:
|
|
1762
|
-
version:
|
|
1829
|
+
var FunctionTypeEnum = z6.enum(["llm", "scorer", "task", "tool"]);
|
|
1830
|
+
var FunctionId = z6.union([
|
|
1831
|
+
z6.object({ function_id: z6.string(), version: z6.string().optional() }),
|
|
1832
|
+
z6.object({
|
|
1833
|
+
project_name: z6.string(),
|
|
1834
|
+
slug: z6.string(),
|
|
1835
|
+
version: z6.string().optional()
|
|
1763
1836
|
}),
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
prompt_session_id:
|
|
1767
|
-
prompt_session_function_id:
|
|
1768
|
-
version:
|
|
1837
|
+
z6.object({ global_function: z6.string() }),
|
|
1838
|
+
z6.object({
|
|
1839
|
+
prompt_session_id: z6.string(),
|
|
1840
|
+
prompt_session_function_id: z6.string(),
|
|
1841
|
+
version: z6.string().optional()
|
|
1769
1842
|
}),
|
|
1770
|
-
|
|
1771
|
-
inline_context:
|
|
1772
|
-
runtime:
|
|
1773
|
-
version:
|
|
1843
|
+
z6.object({
|
|
1844
|
+
inline_context: z6.object({
|
|
1845
|
+
runtime: z6.enum(["node", "python"]),
|
|
1846
|
+
version: z6.string()
|
|
1774
1847
|
}),
|
|
1775
|
-
code:
|
|
1776
|
-
name:
|
|
1848
|
+
code: z6.string(),
|
|
1849
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
1777
1850
|
}),
|
|
1778
|
-
|
|
1851
|
+
z6.object({
|
|
1779
1852
|
inline_prompt: PromptData.optional(),
|
|
1780
|
-
inline_function:
|
|
1853
|
+
inline_function: z6.object({}).partial().passthrough(),
|
|
1781
1854
|
function_type: FunctionTypeEnum.optional(),
|
|
1782
|
-
name:
|
|
1855
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
1783
1856
|
}),
|
|
1784
|
-
|
|
1857
|
+
z6.object({
|
|
1785
1858
|
inline_prompt: PromptData,
|
|
1786
1859
|
function_type: FunctionTypeEnum.optional(),
|
|
1787
|
-
name:
|
|
1860
|
+
name: z6.union([z6.string(), z6.null()]).optional()
|
|
1788
1861
|
})
|
|
1789
1862
|
]);
|
|
1790
|
-
var FunctionObjectType =
|
|
1863
|
+
var FunctionObjectType = z6.enum([
|
|
1791
1864
|
"prompt",
|
|
1792
1865
|
"tool",
|
|
1793
1866
|
"scorer",
|
|
1794
1867
|
"task",
|
|
1795
1868
|
"agent"
|
|
1796
1869
|
]);
|
|
1797
|
-
var FunctionOutputType =
|
|
1798
|
-
var GitMetadataSettings =
|
|
1799
|
-
collect:
|
|
1800
|
-
fields:
|
|
1801
|
-
|
|
1870
|
+
var FunctionOutputType = z6.enum(["completion", "score", "any"]);
|
|
1871
|
+
var GitMetadataSettings = z6.object({
|
|
1872
|
+
collect: z6.enum(["all", "none", "some"]),
|
|
1873
|
+
fields: z6.array(
|
|
1874
|
+
z6.enum([
|
|
1802
1875
|
"commit",
|
|
1803
1876
|
"branch",
|
|
1804
1877
|
"tag",
|
|
@@ -1811,49 +1884,49 @@ var GitMetadataSettings = z5.object({
|
|
|
1811
1884
|
])
|
|
1812
1885
|
).optional()
|
|
1813
1886
|
});
|
|
1814
|
-
var Group =
|
|
1815
|
-
id:
|
|
1816
|
-
org_id:
|
|
1817
|
-
user_id:
|
|
1818
|
-
created:
|
|
1819
|
-
name:
|
|
1820
|
-
description:
|
|
1821
|
-
deleted_at:
|
|
1822
|
-
member_users:
|
|
1823
|
-
member_groups:
|
|
1887
|
+
var Group = z6.object({
|
|
1888
|
+
id: z6.string().uuid(),
|
|
1889
|
+
org_id: z6.string().uuid(),
|
|
1890
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1891
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
1892
|
+
name: z6.string(),
|
|
1893
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
1894
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
1895
|
+
member_users: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional(),
|
|
1896
|
+
member_groups: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
|
|
1824
1897
|
});
|
|
1825
|
-
var IfExists =
|
|
1826
|
-
var InvokeParent =
|
|
1827
|
-
|
|
1828
|
-
object_type:
|
|
1829
|
-
object_id:
|
|
1830
|
-
row_ids:
|
|
1831
|
-
|
|
1832
|
-
id:
|
|
1833
|
-
span_id:
|
|
1834
|
-
root_span_id:
|
|
1898
|
+
var IfExists = z6.enum(["error", "ignore", "replace"]);
|
|
1899
|
+
var InvokeParent = z6.union([
|
|
1900
|
+
z6.object({
|
|
1901
|
+
object_type: z6.enum(["project_logs", "experiment", "playground_logs"]),
|
|
1902
|
+
object_id: z6.string(),
|
|
1903
|
+
row_ids: z6.union([
|
|
1904
|
+
z6.object({
|
|
1905
|
+
id: z6.string(),
|
|
1906
|
+
span_id: z6.string(),
|
|
1907
|
+
root_span_id: z6.string()
|
|
1835
1908
|
}),
|
|
1836
|
-
|
|
1909
|
+
z6.null()
|
|
1837
1910
|
]).optional(),
|
|
1838
|
-
propagated_event:
|
|
1911
|
+
propagated_event: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
1839
1912
|
}),
|
|
1840
|
-
|
|
1913
|
+
z6.string()
|
|
1841
1914
|
]);
|
|
1842
|
-
var StreamingMode =
|
|
1915
|
+
var StreamingMode = z6.union([z6.enum(["auto", "parallel"]), z6.null()]);
|
|
1843
1916
|
var InvokeFunction = FunctionId.and(
|
|
1844
|
-
|
|
1845
|
-
input:
|
|
1846
|
-
expected:
|
|
1847
|
-
metadata:
|
|
1848
|
-
tags:
|
|
1849
|
-
messages:
|
|
1917
|
+
z6.object({
|
|
1918
|
+
input: z6.unknown(),
|
|
1919
|
+
expected: z6.unknown(),
|
|
1920
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]),
|
|
1921
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]),
|
|
1922
|
+
messages: z6.array(ChatCompletionMessageParam),
|
|
1850
1923
|
parent: InvokeParent,
|
|
1851
|
-
stream:
|
|
1924
|
+
stream: z6.union([z6.boolean(), z6.null()]),
|
|
1852
1925
|
mode: StreamingMode,
|
|
1853
|
-
strict:
|
|
1926
|
+
strict: z6.union([z6.boolean(), z6.null()])
|
|
1854
1927
|
}).partial()
|
|
1855
1928
|
);
|
|
1856
|
-
var MessageRole =
|
|
1929
|
+
var MessageRole = z6.enum([
|
|
1857
1930
|
"system",
|
|
1858
1931
|
"user",
|
|
1859
1932
|
"assistant",
|
|
@@ -1862,8 +1935,8 @@ var MessageRole = z5.enum([
|
|
|
1862
1935
|
"model",
|
|
1863
1936
|
"developer"
|
|
1864
1937
|
]);
|
|
1865
|
-
var ObjectReference =
|
|
1866
|
-
object_type:
|
|
1938
|
+
var ObjectReference = z6.object({
|
|
1939
|
+
object_type: z6.enum([
|
|
1867
1940
|
"project_logs",
|
|
1868
1941
|
"experiment",
|
|
1869
1942
|
"dataset",
|
|
@@ -1871,146 +1944,146 @@ var ObjectReference = z5.object({
|
|
|
1871
1944
|
"function",
|
|
1872
1945
|
"prompt_session"
|
|
1873
1946
|
]),
|
|
1874
|
-
object_id:
|
|
1875
|
-
id:
|
|
1876
|
-
_xact_id:
|
|
1877
|
-
created:
|
|
1947
|
+
object_id: z6.string().uuid(),
|
|
1948
|
+
id: z6.string(),
|
|
1949
|
+
_xact_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1950
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1878
1951
|
});
|
|
1879
|
-
var OnlineScoreConfig =
|
|
1880
|
-
|
|
1881
|
-
sampling_rate:
|
|
1882
|
-
scorers:
|
|
1883
|
-
btql_filter:
|
|
1884
|
-
apply_to_root_span:
|
|
1885
|
-
apply_to_span_names:
|
|
1886
|
-
skip_logging:
|
|
1952
|
+
var OnlineScoreConfig = z6.union([
|
|
1953
|
+
z6.object({
|
|
1954
|
+
sampling_rate: z6.number().gte(0).lte(1),
|
|
1955
|
+
scorers: z6.array(SavedFunctionId),
|
|
1956
|
+
btql_filter: z6.union([z6.string(), z6.null()]).optional(),
|
|
1957
|
+
apply_to_root_span: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1958
|
+
apply_to_span_names: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
1959
|
+
skip_logging: z6.union([z6.boolean(), z6.null()]).optional()
|
|
1887
1960
|
}),
|
|
1888
|
-
|
|
1961
|
+
z6.null()
|
|
1889
1962
|
]);
|
|
1890
|
-
var Organization =
|
|
1891
|
-
id:
|
|
1892
|
-
name:
|
|
1893
|
-
api_url:
|
|
1894
|
-
is_universal_api:
|
|
1895
|
-
proxy_url:
|
|
1896
|
-
realtime_url:
|
|
1897
|
-
created:
|
|
1963
|
+
var Organization = z6.object({
|
|
1964
|
+
id: z6.string().uuid(),
|
|
1965
|
+
name: z6.string(),
|
|
1966
|
+
api_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
1967
|
+
is_universal_api: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1968
|
+
proxy_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
1969
|
+
realtime_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
1970
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
1898
1971
|
});
|
|
1899
|
-
var ProjectSettings =
|
|
1900
|
-
|
|
1901
|
-
comparison_key:
|
|
1902
|
-
baseline_experiment_id:
|
|
1903
|
-
spanFieldOrder:
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
object_type:
|
|
1907
|
-
column_id:
|
|
1908
|
-
position:
|
|
1909
|
-
layout:
|
|
1972
|
+
var ProjectSettings = z6.union([
|
|
1973
|
+
z6.object({
|
|
1974
|
+
comparison_key: z6.union([z6.string(), z6.null()]),
|
|
1975
|
+
baseline_experiment_id: z6.union([z6.string(), z6.null()]),
|
|
1976
|
+
spanFieldOrder: z6.union([
|
|
1977
|
+
z6.array(
|
|
1978
|
+
z6.object({
|
|
1979
|
+
object_type: z6.string(),
|
|
1980
|
+
column_id: z6.string(),
|
|
1981
|
+
position: z6.string(),
|
|
1982
|
+
layout: z6.union([z6.literal("full"), z6.literal("two_column"), z6.null()]).optional()
|
|
1910
1983
|
})
|
|
1911
1984
|
),
|
|
1912
|
-
|
|
1985
|
+
z6.null()
|
|
1913
1986
|
]),
|
|
1914
|
-
remote_eval_sources:
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
url:
|
|
1918
|
-
name:
|
|
1919
|
-
description:
|
|
1987
|
+
remote_eval_sources: z6.union([
|
|
1988
|
+
z6.array(
|
|
1989
|
+
z6.object({
|
|
1990
|
+
url: z6.string(),
|
|
1991
|
+
name: z6.string(),
|
|
1992
|
+
description: z6.union([z6.string(), z6.null()]).optional()
|
|
1920
1993
|
})
|
|
1921
1994
|
),
|
|
1922
|
-
|
|
1995
|
+
z6.null()
|
|
1923
1996
|
])
|
|
1924
1997
|
}).partial(),
|
|
1925
|
-
|
|
1998
|
+
z6.null()
|
|
1926
1999
|
]);
|
|
1927
|
-
var Project =
|
|
1928
|
-
id:
|
|
1929
|
-
org_id:
|
|
1930
|
-
name:
|
|
1931
|
-
created:
|
|
1932
|
-
deleted_at:
|
|
1933
|
-
user_id:
|
|
2000
|
+
var Project = z6.object({
|
|
2001
|
+
id: z6.string().uuid(),
|
|
2002
|
+
org_id: z6.string().uuid(),
|
|
2003
|
+
name: z6.string(),
|
|
2004
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2005
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2006
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
1934
2007
|
settings: ProjectSettings.optional()
|
|
1935
2008
|
});
|
|
1936
|
-
var RetentionObjectType =
|
|
2009
|
+
var RetentionObjectType = z6.enum([
|
|
1937
2010
|
"project_logs",
|
|
1938
2011
|
"experiment",
|
|
1939
2012
|
"dataset"
|
|
1940
2013
|
]);
|
|
1941
|
-
var ProjectAutomation =
|
|
1942
|
-
id:
|
|
1943
|
-
project_id:
|
|
1944
|
-
user_id:
|
|
1945
|
-
created:
|
|
1946
|
-
name:
|
|
1947
|
-
description:
|
|
1948
|
-
config:
|
|
1949
|
-
|
|
1950
|
-
event_type:
|
|
1951
|
-
btql_filter:
|
|
1952
|
-
interval_seconds:
|
|
1953
|
-
action:
|
|
2014
|
+
var ProjectAutomation = z6.object({
|
|
2015
|
+
id: z6.string().uuid(),
|
|
2016
|
+
project_id: z6.string().uuid(),
|
|
2017
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2018
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2019
|
+
name: z6.string(),
|
|
2020
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2021
|
+
config: z6.union([
|
|
2022
|
+
z6.object({
|
|
2023
|
+
event_type: z6.literal("logs"),
|
|
2024
|
+
btql_filter: z6.string(),
|
|
2025
|
+
interval_seconds: z6.number().gte(1).lte(2592e3),
|
|
2026
|
+
action: z6.object({ type: z6.literal("webhook"), url: z6.string() })
|
|
1954
2027
|
}),
|
|
1955
|
-
|
|
1956
|
-
event_type:
|
|
1957
|
-
export_definition:
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
2028
|
+
z6.object({
|
|
2029
|
+
event_type: z6.literal("btql_export"),
|
|
2030
|
+
export_definition: z6.union([
|
|
2031
|
+
z6.object({ type: z6.literal("log_traces") }),
|
|
2032
|
+
z6.object({ type: z6.literal("log_spans") }),
|
|
2033
|
+
z6.object({ type: z6.literal("btql_query"), btql_query: z6.string() })
|
|
1961
2034
|
]),
|
|
1962
|
-
export_path:
|
|
1963
|
-
format:
|
|
1964
|
-
interval_seconds:
|
|
1965
|
-
credentials:
|
|
1966
|
-
type:
|
|
1967
|
-
role_arn:
|
|
1968
|
-
external_id:
|
|
2035
|
+
export_path: z6.string(),
|
|
2036
|
+
format: z6.enum(["jsonl", "parquet"]),
|
|
2037
|
+
interval_seconds: z6.number().gte(1).lte(2592e3),
|
|
2038
|
+
credentials: z6.object({
|
|
2039
|
+
type: z6.literal("aws_iam"),
|
|
2040
|
+
role_arn: z6.string(),
|
|
2041
|
+
external_id: z6.string()
|
|
1969
2042
|
}),
|
|
1970
|
-
batch_size:
|
|
2043
|
+
batch_size: z6.union([z6.number(), z6.null()]).optional()
|
|
1971
2044
|
}),
|
|
1972
|
-
|
|
1973
|
-
event_type:
|
|
2045
|
+
z6.object({
|
|
2046
|
+
event_type: z6.literal("retention"),
|
|
1974
2047
|
object_type: RetentionObjectType,
|
|
1975
|
-
retention_days:
|
|
2048
|
+
retention_days: z6.number().gte(0)
|
|
1976
2049
|
})
|
|
1977
2050
|
])
|
|
1978
2051
|
});
|
|
1979
|
-
var ProjectLogsEvent =
|
|
1980
|
-
id:
|
|
1981
|
-
_xact_id:
|
|
1982
|
-
_pagination_key:
|
|
1983
|
-
created:
|
|
1984
|
-
org_id:
|
|
1985
|
-
project_id:
|
|
1986
|
-
log_id:
|
|
1987
|
-
input:
|
|
1988
|
-
output:
|
|
1989
|
-
expected:
|
|
1990
|
-
error:
|
|
1991
|
-
scores:
|
|
1992
|
-
metadata:
|
|
1993
|
-
|
|
1994
|
-
|
|
2052
|
+
var ProjectLogsEvent = z6.object({
|
|
2053
|
+
id: z6.string(),
|
|
2054
|
+
_xact_id: z6.string(),
|
|
2055
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
2056
|
+
created: z6.string().datetime({ offset: true }),
|
|
2057
|
+
org_id: z6.string().uuid(),
|
|
2058
|
+
project_id: z6.string().uuid(),
|
|
2059
|
+
log_id: z6.literal("g"),
|
|
2060
|
+
input: z6.unknown().optional(),
|
|
2061
|
+
output: z6.unknown().optional(),
|
|
2062
|
+
expected: z6.unknown().optional(),
|
|
2063
|
+
error: z6.unknown().optional(),
|
|
2064
|
+
scores: z6.union([z6.record(z6.union([z6.number(), z6.null()])), z6.null()]).optional(),
|
|
2065
|
+
metadata: z6.union([
|
|
2066
|
+
z6.object({ model: z6.union([z6.string(), z6.null()]) }).partial().passthrough(),
|
|
2067
|
+
z6.null()
|
|
1995
2068
|
]).optional(),
|
|
1996
|
-
tags:
|
|
1997
|
-
metrics:
|
|
1998
|
-
context:
|
|
1999
|
-
|
|
2000
|
-
caller_functionname:
|
|
2001
|
-
caller_filename:
|
|
2002
|
-
caller_lineno:
|
|
2069
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2070
|
+
metrics: z6.union([z6.record(z6.number()), z6.null()]).optional(),
|
|
2071
|
+
context: z6.union([
|
|
2072
|
+
z6.object({
|
|
2073
|
+
caller_functionname: z6.union([z6.string(), z6.null()]),
|
|
2074
|
+
caller_filename: z6.union([z6.string(), z6.null()]),
|
|
2075
|
+
caller_lineno: z6.union([z6.number(), z6.null()])
|
|
2003
2076
|
}).partial().passthrough(),
|
|
2004
|
-
|
|
2077
|
+
z6.null()
|
|
2005
2078
|
]).optional(),
|
|
2006
|
-
span_id:
|
|
2007
|
-
span_parents:
|
|
2008
|
-
root_span_id:
|
|
2009
|
-
is_root:
|
|
2079
|
+
span_id: z6.string(),
|
|
2080
|
+
span_parents: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2081
|
+
root_span_id: z6.string(),
|
|
2082
|
+
is_root: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2010
2083
|
span_attributes: SpanAttributes.optional(),
|
|
2011
2084
|
origin: ObjectReferenceNullish.optional()
|
|
2012
2085
|
});
|
|
2013
|
-
var ProjectScoreType =
|
|
2086
|
+
var ProjectScoreType = z6.enum([
|
|
2014
2087
|
"slider",
|
|
2015
2088
|
"categorical",
|
|
2016
2089
|
"weighted",
|
|
@@ -2019,172 +2092,172 @@ var ProjectScoreType = z5.enum([
|
|
|
2019
2092
|
"online",
|
|
2020
2093
|
"free-form"
|
|
2021
2094
|
]);
|
|
2022
|
-
var ProjectScoreCategory =
|
|
2023
|
-
name:
|
|
2024
|
-
value:
|
|
2095
|
+
var ProjectScoreCategory = z6.object({
|
|
2096
|
+
name: z6.string(),
|
|
2097
|
+
value: z6.number()
|
|
2025
2098
|
});
|
|
2026
|
-
var ProjectScoreCategories =
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2099
|
+
var ProjectScoreCategories = z6.union([
|
|
2100
|
+
z6.array(ProjectScoreCategory),
|
|
2101
|
+
z6.record(z6.number()),
|
|
2102
|
+
z6.array(z6.string()),
|
|
2103
|
+
z6.null()
|
|
2031
2104
|
]);
|
|
2032
|
-
var ProjectScoreConfig =
|
|
2033
|
-
|
|
2034
|
-
multi_select:
|
|
2035
|
-
destination:
|
|
2105
|
+
var ProjectScoreConfig = z6.union([
|
|
2106
|
+
z6.object({
|
|
2107
|
+
multi_select: z6.union([z6.boolean(), z6.null()]),
|
|
2108
|
+
destination: z6.union([z6.string(), z6.null()]),
|
|
2036
2109
|
online: OnlineScoreConfig
|
|
2037
2110
|
}).partial(),
|
|
2038
|
-
|
|
2111
|
+
z6.null()
|
|
2039
2112
|
]);
|
|
2040
|
-
var ProjectScore =
|
|
2041
|
-
id:
|
|
2042
|
-
project_id:
|
|
2043
|
-
user_id:
|
|
2044
|
-
created:
|
|
2045
|
-
name:
|
|
2046
|
-
description:
|
|
2113
|
+
var ProjectScore = z6.object({
|
|
2114
|
+
id: z6.string().uuid(),
|
|
2115
|
+
project_id: z6.string().uuid(),
|
|
2116
|
+
user_id: z6.string().uuid(),
|
|
2117
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2118
|
+
name: z6.string(),
|
|
2119
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2047
2120
|
score_type: ProjectScoreType,
|
|
2048
2121
|
categories: ProjectScoreCategories.optional(),
|
|
2049
2122
|
config: ProjectScoreConfig.optional(),
|
|
2050
|
-
position:
|
|
2123
|
+
position: z6.union([z6.string(), z6.null()]).optional()
|
|
2051
2124
|
});
|
|
2052
|
-
var ProjectTag =
|
|
2053
|
-
id:
|
|
2054
|
-
project_id:
|
|
2055
|
-
user_id:
|
|
2056
|
-
created:
|
|
2057
|
-
name:
|
|
2058
|
-
description:
|
|
2059
|
-
color:
|
|
2060
|
-
position:
|
|
2125
|
+
var ProjectTag = z6.object({
|
|
2126
|
+
id: z6.string().uuid(),
|
|
2127
|
+
project_id: z6.string().uuid(),
|
|
2128
|
+
user_id: z6.string().uuid(),
|
|
2129
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2130
|
+
name: z6.string(),
|
|
2131
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2132
|
+
color: z6.union([z6.string(), z6.null()]).optional(),
|
|
2133
|
+
position: z6.union([z6.string(), z6.null()]).optional()
|
|
2061
2134
|
});
|
|
2062
|
-
var Prompt =
|
|
2063
|
-
id:
|
|
2064
|
-
_xact_id:
|
|
2065
|
-
project_id:
|
|
2066
|
-
log_id:
|
|
2067
|
-
org_id:
|
|
2068
|
-
name:
|
|
2069
|
-
slug:
|
|
2070
|
-
description:
|
|
2071
|
-
created:
|
|
2135
|
+
var Prompt = z6.object({
|
|
2136
|
+
id: z6.string().uuid(),
|
|
2137
|
+
_xact_id: z6.string(),
|
|
2138
|
+
project_id: z6.string().uuid(),
|
|
2139
|
+
log_id: z6.literal("p"),
|
|
2140
|
+
org_id: z6.string().uuid(),
|
|
2141
|
+
name: z6.string(),
|
|
2142
|
+
slug: z6.string(),
|
|
2143
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2144
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2072
2145
|
prompt_data: PromptDataNullish.optional(),
|
|
2073
|
-
tags:
|
|
2074
|
-
metadata:
|
|
2146
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional(),
|
|
2147
|
+
metadata: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional(),
|
|
2075
2148
|
function_type: FunctionTypeEnumNullish.optional()
|
|
2076
2149
|
});
|
|
2077
|
-
var PromptOptions =
|
|
2078
|
-
var PromptSessionEvent =
|
|
2079
|
-
id:
|
|
2080
|
-
_xact_id:
|
|
2081
|
-
created:
|
|
2082
|
-
_pagination_key:
|
|
2083
|
-
project_id:
|
|
2084
|
-
prompt_session_id:
|
|
2085
|
-
prompt_session_data:
|
|
2086
|
-
prompt_data:
|
|
2087
|
-
function_data:
|
|
2150
|
+
var PromptOptions = z6.object({ model: z6.string(), params: ModelParams, position: z6.string() }).partial();
|
|
2151
|
+
var PromptSessionEvent = z6.object({
|
|
2152
|
+
id: z6.string(),
|
|
2153
|
+
_xact_id: z6.string(),
|
|
2154
|
+
created: z6.string().datetime({ offset: true }),
|
|
2155
|
+
_pagination_key: z6.union([z6.string(), z6.null()]).optional(),
|
|
2156
|
+
project_id: z6.string().uuid(),
|
|
2157
|
+
prompt_session_id: z6.string().uuid(),
|
|
2158
|
+
prompt_session_data: z6.unknown().optional(),
|
|
2159
|
+
prompt_data: z6.unknown().optional(),
|
|
2160
|
+
function_data: z6.unknown().optional(),
|
|
2088
2161
|
function_type: FunctionTypeEnumNullish.optional(),
|
|
2089
|
-
object_data:
|
|
2090
|
-
completion:
|
|
2091
|
-
tags:
|
|
2162
|
+
object_data: z6.unknown().optional(),
|
|
2163
|
+
completion: z6.unknown().optional(),
|
|
2164
|
+
tags: z6.union([z6.array(z6.string()), z6.null()]).optional()
|
|
2092
2165
|
});
|
|
2093
|
-
var ResponseFormat =
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
type:
|
|
2166
|
+
var ResponseFormat = z6.union([
|
|
2167
|
+
z6.object({ type: z6.literal("json_object") }),
|
|
2168
|
+
z6.object({
|
|
2169
|
+
type: z6.literal("json_schema"),
|
|
2097
2170
|
json_schema: ResponseFormatJsonSchema
|
|
2098
2171
|
}),
|
|
2099
|
-
|
|
2172
|
+
z6.object({ type: z6.literal("text") })
|
|
2100
2173
|
]);
|
|
2101
|
-
var Role =
|
|
2102
|
-
id:
|
|
2103
|
-
org_id:
|
|
2104
|
-
user_id:
|
|
2105
|
-
created:
|
|
2106
|
-
name:
|
|
2107
|
-
description:
|
|
2108
|
-
deleted_at:
|
|
2109
|
-
member_permissions:
|
|
2110
|
-
|
|
2111
|
-
|
|
2174
|
+
var Role = z6.object({
|
|
2175
|
+
id: z6.string().uuid(),
|
|
2176
|
+
org_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2177
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2178
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2179
|
+
name: z6.string(),
|
|
2180
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2181
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2182
|
+
member_permissions: z6.union([
|
|
2183
|
+
z6.array(
|
|
2184
|
+
z6.object({
|
|
2112
2185
|
permission: Permission,
|
|
2113
2186
|
restrict_object_type: AclObjectType.optional()
|
|
2114
2187
|
})
|
|
2115
2188
|
),
|
|
2116
|
-
|
|
2189
|
+
z6.null()
|
|
2117
2190
|
]).optional(),
|
|
2118
|
-
member_roles:
|
|
2191
|
+
member_roles: z6.union([z6.array(z6.string().uuid()), z6.null()]).optional()
|
|
2119
2192
|
});
|
|
2120
|
-
var RunEval =
|
|
2121
|
-
project_id:
|
|
2122
|
-
data:
|
|
2123
|
-
|
|
2124
|
-
dataset_id:
|
|
2125
|
-
_internal_btql:
|
|
2193
|
+
var RunEval = z6.object({
|
|
2194
|
+
project_id: z6.string(),
|
|
2195
|
+
data: z6.union([
|
|
2196
|
+
z6.object({
|
|
2197
|
+
dataset_id: z6.string(),
|
|
2198
|
+
_internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
2126
2199
|
}),
|
|
2127
|
-
|
|
2128
|
-
project_name:
|
|
2129
|
-
dataset_name:
|
|
2130
|
-
_internal_btql:
|
|
2200
|
+
z6.object({
|
|
2201
|
+
project_name: z6.string(),
|
|
2202
|
+
dataset_name: z6.string(),
|
|
2203
|
+
_internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
2131
2204
|
}),
|
|
2132
|
-
|
|
2205
|
+
z6.object({ data: z6.array(z6.unknown()) })
|
|
2133
2206
|
]),
|
|
2134
|
-
task: FunctionId.and(
|
|
2135
|
-
scores:
|
|
2136
|
-
experiment_name:
|
|
2137
|
-
metadata:
|
|
2138
|
-
parent: InvokeParent.and(
|
|
2139
|
-
stream:
|
|
2140
|
-
trial_count:
|
|
2141
|
-
is_public:
|
|
2142
|
-
timeout:
|
|
2143
|
-
max_concurrency:
|
|
2144
|
-
base_experiment_name:
|
|
2145
|
-
base_experiment_id:
|
|
2207
|
+
task: FunctionId.and(z6.unknown()),
|
|
2208
|
+
scores: z6.array(FunctionId),
|
|
2209
|
+
experiment_name: z6.string().optional(),
|
|
2210
|
+
metadata: z6.object({}).partial().passthrough().optional(),
|
|
2211
|
+
parent: InvokeParent.and(z6.unknown()).optional(),
|
|
2212
|
+
stream: z6.boolean().optional(),
|
|
2213
|
+
trial_count: z6.union([z6.number(), z6.null()]).optional(),
|
|
2214
|
+
is_public: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2215
|
+
timeout: z6.union([z6.number(), z6.null()]).optional(),
|
|
2216
|
+
max_concurrency: z6.union([z6.number(), z6.null()]).optional().default(10),
|
|
2217
|
+
base_experiment_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2218
|
+
base_experiment_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2146
2219
|
git_metadata_settings: GitMetadataSettings.and(
|
|
2147
|
-
|
|
2220
|
+
z6.union([z6.object({}).partial(), z6.null()])
|
|
2148
2221
|
).optional(),
|
|
2149
|
-
repo_info: RepoInfo.and(
|
|
2150
|
-
strict:
|
|
2151
|
-
stop_token:
|
|
2152
|
-
extra_messages:
|
|
2153
|
-
tags:
|
|
2222
|
+
repo_info: RepoInfo.and(z6.unknown()).optional(),
|
|
2223
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
2224
|
+
stop_token: z6.union([z6.string(), z6.null()]).optional(),
|
|
2225
|
+
extra_messages: z6.string().optional(),
|
|
2226
|
+
tags: z6.array(z6.string()).optional()
|
|
2154
2227
|
});
|
|
2155
|
-
var ServiceToken =
|
|
2156
|
-
id:
|
|
2157
|
-
created:
|
|
2158
|
-
name:
|
|
2159
|
-
preview_name:
|
|
2160
|
-
service_account_id:
|
|
2161
|
-
service_account_email:
|
|
2162
|
-
service_account_name:
|
|
2163
|
-
org_id:
|
|
2228
|
+
var ServiceToken = z6.object({
|
|
2229
|
+
id: z6.string().uuid(),
|
|
2230
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2231
|
+
name: z6.string(),
|
|
2232
|
+
preview_name: z6.string(),
|
|
2233
|
+
service_account_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2234
|
+
service_account_email: z6.union([z6.string(), z6.null()]).optional(),
|
|
2235
|
+
service_account_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2236
|
+
org_id: z6.union([z6.string(), z6.null()]).optional()
|
|
2164
2237
|
});
|
|
2165
|
-
var SpanIFrame =
|
|
2166
|
-
id:
|
|
2167
|
-
project_id:
|
|
2168
|
-
user_id:
|
|
2169
|
-
created:
|
|
2170
|
-
deleted_at:
|
|
2171
|
-
name:
|
|
2172
|
-
description:
|
|
2173
|
-
url:
|
|
2174
|
-
post_message:
|
|
2238
|
+
var SpanIFrame = z6.object({
|
|
2239
|
+
id: z6.string().uuid(),
|
|
2240
|
+
project_id: z6.string().uuid(),
|
|
2241
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2242
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2243
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
2244
|
+
name: z6.string(),
|
|
2245
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
2246
|
+
url: z6.string(),
|
|
2247
|
+
post_message: z6.union([z6.boolean(), z6.null()]).optional()
|
|
2175
2248
|
});
|
|
2176
|
-
var SSEConsoleEventData =
|
|
2177
|
-
stream:
|
|
2178
|
-
message:
|
|
2249
|
+
var SSEConsoleEventData = z6.object({
|
|
2250
|
+
stream: z6.enum(["stderr", "stdout"]),
|
|
2251
|
+
message: z6.string()
|
|
2179
2252
|
});
|
|
2180
|
-
var SSEProgressEventData =
|
|
2181
|
-
id:
|
|
2253
|
+
var SSEProgressEventData = z6.object({
|
|
2254
|
+
id: z6.string(),
|
|
2182
2255
|
object_type: FunctionObjectType,
|
|
2183
|
-
origin: ObjectReferenceNullish.and(
|
|
2256
|
+
origin: ObjectReferenceNullish.and(z6.unknown()).optional(),
|
|
2184
2257
|
format: FunctionFormat,
|
|
2185
2258
|
output_type: FunctionOutputType,
|
|
2186
|
-
name:
|
|
2187
|
-
event:
|
|
2259
|
+
name: z6.string(),
|
|
2260
|
+
event: z6.enum([
|
|
2188
2261
|
"reasoning_delta",
|
|
2189
2262
|
"text_delta",
|
|
2190
2263
|
"json_delta",
|
|
@@ -2194,110 +2267,110 @@ var SSEProgressEventData = z5.object({
|
|
|
2194
2267
|
"done",
|
|
2195
2268
|
"progress"
|
|
2196
2269
|
]),
|
|
2197
|
-
data:
|
|
2270
|
+
data: z6.string()
|
|
2198
2271
|
});
|
|
2199
|
-
var ToolFunctionDefinition =
|
|
2200
|
-
type:
|
|
2201
|
-
function:
|
|
2202
|
-
name:
|
|
2203
|
-
description:
|
|
2204
|
-
parameters:
|
|
2205
|
-
strict:
|
|
2272
|
+
var ToolFunctionDefinition = z6.object({
|
|
2273
|
+
type: z6.literal("function"),
|
|
2274
|
+
function: z6.object({
|
|
2275
|
+
name: z6.string(),
|
|
2276
|
+
description: z6.string().optional(),
|
|
2277
|
+
parameters: z6.object({}).partial().passthrough().optional(),
|
|
2278
|
+
strict: z6.union([z6.boolean(), z6.null()]).optional()
|
|
2206
2279
|
})
|
|
2207
2280
|
});
|
|
2208
|
-
var User =
|
|
2209
|
-
id:
|
|
2210
|
-
given_name:
|
|
2211
|
-
family_name:
|
|
2212
|
-
email:
|
|
2213
|
-
avatar_url:
|
|
2214
|
-
created:
|
|
2281
|
+
var User = z6.object({
|
|
2282
|
+
id: z6.string().uuid(),
|
|
2283
|
+
given_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2284
|
+
family_name: z6.union([z6.string(), z6.null()]).optional(),
|
|
2285
|
+
email: z6.union([z6.string(), z6.null()]).optional(),
|
|
2286
|
+
avatar_url: z6.union([z6.string(), z6.null()]).optional(),
|
|
2287
|
+
created: z6.union([z6.string(), z6.null()]).optional()
|
|
2215
2288
|
});
|
|
2216
|
-
var ViewDataSearch =
|
|
2217
|
-
|
|
2218
|
-
filter:
|
|
2219
|
-
tag:
|
|
2220
|
-
match:
|
|
2221
|
-
sort:
|
|
2289
|
+
var ViewDataSearch = z6.union([
|
|
2290
|
+
z6.object({
|
|
2291
|
+
filter: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2292
|
+
tag: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2293
|
+
match: z6.union([z6.array(z6.unknown()), z6.null()]),
|
|
2294
|
+
sort: z6.union([z6.array(z6.unknown()), z6.null()])
|
|
2222
2295
|
}).partial(),
|
|
2223
|
-
|
|
2296
|
+
z6.null()
|
|
2224
2297
|
]);
|
|
2225
|
-
var ViewData =
|
|
2226
|
-
|
|
2227
|
-
|
|
2298
|
+
var ViewData = z6.union([
|
|
2299
|
+
z6.object({ search: ViewDataSearch }).partial(),
|
|
2300
|
+
z6.null()
|
|
2228
2301
|
]);
|
|
2229
|
-
var ViewOptions =
|
|
2230
|
-
|
|
2231
|
-
viewType:
|
|
2232
|
-
options:
|
|
2233
|
-
spanType:
|
|
2234
|
-
rangeValue:
|
|
2235
|
-
frameStart:
|
|
2236
|
-
frameEnd:
|
|
2237
|
-
tzUTC:
|
|
2238
|
-
chartVisibility:
|
|
2239
|
-
projectId:
|
|
2240
|
-
type:
|
|
2241
|
-
groupBy:
|
|
2302
|
+
var ViewOptions = z6.union([
|
|
2303
|
+
z6.object({
|
|
2304
|
+
viewType: z6.literal("monitor"),
|
|
2305
|
+
options: z6.object({
|
|
2306
|
+
spanType: z6.union([z6.enum(["range", "frame"]), z6.null()]),
|
|
2307
|
+
rangeValue: z6.union([z6.string(), z6.null()]),
|
|
2308
|
+
frameStart: z6.union([z6.string(), z6.null()]),
|
|
2309
|
+
frameEnd: z6.union([z6.string(), z6.null()]),
|
|
2310
|
+
tzUTC: z6.union([z6.boolean(), z6.null()]),
|
|
2311
|
+
chartVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
|
|
2312
|
+
projectId: z6.union([z6.string(), z6.null()]),
|
|
2313
|
+
type: z6.union([z6.enum(["project", "experiment"]), z6.null()]),
|
|
2314
|
+
groupBy: z6.union([z6.string(), z6.null()])
|
|
2242
2315
|
}).partial()
|
|
2243
2316
|
}),
|
|
2244
|
-
|
|
2245
|
-
columnVisibility:
|
|
2246
|
-
columnOrder:
|
|
2247
|
-
columnSizing:
|
|
2248
|
-
grouping:
|
|
2249
|
-
rowHeight:
|
|
2250
|
-
tallGroupRows:
|
|
2251
|
-
layout:
|
|
2252
|
-
chartHeight:
|
|
2253
|
-
excludedMeasures:
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
type:
|
|
2257
|
-
value:
|
|
2317
|
+
z6.object({
|
|
2318
|
+
columnVisibility: z6.union([z6.record(z6.boolean()), z6.null()]),
|
|
2319
|
+
columnOrder: z6.union([z6.array(z6.string()), z6.null()]),
|
|
2320
|
+
columnSizing: z6.union([z6.record(z6.number()), z6.null()]),
|
|
2321
|
+
grouping: z6.union([z6.string(), z6.null()]),
|
|
2322
|
+
rowHeight: z6.union([z6.string(), z6.null()]),
|
|
2323
|
+
tallGroupRows: z6.union([z6.boolean(), z6.null()]),
|
|
2324
|
+
layout: z6.union([z6.string(), z6.null()]),
|
|
2325
|
+
chartHeight: z6.union([z6.number(), z6.null()]),
|
|
2326
|
+
excludedMeasures: z6.union([
|
|
2327
|
+
z6.array(
|
|
2328
|
+
z6.object({
|
|
2329
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2330
|
+
value: z6.string()
|
|
2258
2331
|
})
|
|
2259
2332
|
),
|
|
2260
|
-
|
|
2333
|
+
z6.null()
|
|
2261
2334
|
]),
|
|
2262
|
-
yMetric:
|
|
2263
|
-
|
|
2264
|
-
type:
|
|
2265
|
-
value:
|
|
2335
|
+
yMetric: z6.union([
|
|
2336
|
+
z6.object({
|
|
2337
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2338
|
+
value: z6.string()
|
|
2266
2339
|
}),
|
|
2267
|
-
|
|
2340
|
+
z6.null()
|
|
2268
2341
|
]),
|
|
2269
|
-
xAxis:
|
|
2270
|
-
|
|
2271
|
-
type:
|
|
2272
|
-
value:
|
|
2342
|
+
xAxis: z6.union([
|
|
2343
|
+
z6.object({
|
|
2344
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2345
|
+
value: z6.string()
|
|
2273
2346
|
}),
|
|
2274
|
-
|
|
2347
|
+
z6.null()
|
|
2275
2348
|
]),
|
|
2276
|
-
symbolGrouping:
|
|
2277
|
-
|
|
2278
|
-
type:
|
|
2279
|
-
value:
|
|
2349
|
+
symbolGrouping: z6.union([
|
|
2350
|
+
z6.object({
|
|
2351
|
+
type: z6.enum(["none", "score", "metric", "metadata"]),
|
|
2352
|
+
value: z6.string()
|
|
2280
2353
|
}),
|
|
2281
|
-
|
|
2354
|
+
z6.null()
|
|
2282
2355
|
]),
|
|
2283
|
-
xAxisAggregation:
|
|
2284
|
-
chartAnnotations:
|
|
2285
|
-
|
|
2286
|
-
|
|
2356
|
+
xAxisAggregation: z6.union([z6.string(), z6.null()]),
|
|
2357
|
+
chartAnnotations: z6.union([
|
|
2358
|
+
z6.array(z6.object({ id: z6.string(), text: z6.string() })),
|
|
2359
|
+
z6.null()
|
|
2287
2360
|
]),
|
|
2288
|
-
timeRangeFilter:
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2361
|
+
timeRangeFilter: z6.union([
|
|
2362
|
+
z6.string(),
|
|
2363
|
+
z6.object({ from: z6.string(), to: z6.string() }),
|
|
2364
|
+
z6.null()
|
|
2292
2365
|
])
|
|
2293
2366
|
}).partial(),
|
|
2294
|
-
|
|
2367
|
+
z6.null()
|
|
2295
2368
|
]);
|
|
2296
|
-
var View =
|
|
2297
|
-
id:
|
|
2298
|
-
object_type: AclObjectType.and(
|
|
2299
|
-
object_id:
|
|
2300
|
-
view_type:
|
|
2369
|
+
var View = z6.object({
|
|
2370
|
+
id: z6.string().uuid(),
|
|
2371
|
+
object_type: AclObjectType.and(z6.string()),
|
|
2372
|
+
object_id: z6.string().uuid(),
|
|
2373
|
+
view_type: z6.enum([
|
|
2301
2374
|
"projects",
|
|
2302
2375
|
"experiments",
|
|
2303
2376
|
"experiment",
|
|
@@ -2312,56 +2385,56 @@ var View = z5.object({
|
|
|
2312
2385
|
"agents",
|
|
2313
2386
|
"monitor"
|
|
2314
2387
|
]),
|
|
2315
|
-
name:
|
|
2316
|
-
created:
|
|
2388
|
+
name: z6.string(),
|
|
2389
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
2317
2390
|
view_data: ViewData.optional(),
|
|
2318
2391
|
options: ViewOptions.optional(),
|
|
2319
|
-
user_id:
|
|
2320
|
-
deleted_at:
|
|
2392
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
2393
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional()
|
|
2321
2394
|
});
|
|
2322
2395
|
|
|
2323
2396
|
// src/logger.ts
|
|
2324
2397
|
import { waitUntil } from "@vercel/functions";
|
|
2325
2398
|
import Mustache2 from "mustache";
|
|
2326
|
-
import { z as
|
|
2399
|
+
import { z as z8, ZodError } from "zod";
|
|
2327
2400
|
|
|
2328
2401
|
// src/functions/stream.ts
|
|
2329
2402
|
import {
|
|
2330
2403
|
createParser
|
|
2331
2404
|
} from "eventsource-parser";
|
|
2332
|
-
import { z as
|
|
2333
|
-
var braintrustStreamChunkSchema =
|
|
2334
|
-
|
|
2335
|
-
type:
|
|
2336
|
-
data:
|
|
2405
|
+
import { z as z7 } from "zod/v3";
|
|
2406
|
+
var braintrustStreamChunkSchema = z7.union([
|
|
2407
|
+
z7.object({
|
|
2408
|
+
type: z7.literal("text_delta"),
|
|
2409
|
+
data: z7.string()
|
|
2337
2410
|
}),
|
|
2338
|
-
|
|
2339
|
-
type:
|
|
2340
|
-
data:
|
|
2411
|
+
z7.object({
|
|
2412
|
+
type: z7.literal("reasoning_delta"),
|
|
2413
|
+
data: z7.string()
|
|
2341
2414
|
}),
|
|
2342
|
-
|
|
2343
|
-
type:
|
|
2344
|
-
data:
|
|
2415
|
+
z7.object({
|
|
2416
|
+
type: z7.literal("json_delta"),
|
|
2417
|
+
data: z7.string()
|
|
2345
2418
|
}),
|
|
2346
|
-
|
|
2347
|
-
type:
|
|
2348
|
-
data:
|
|
2419
|
+
z7.object({
|
|
2420
|
+
type: z7.literal("error"),
|
|
2421
|
+
data: z7.string()
|
|
2349
2422
|
}),
|
|
2350
|
-
|
|
2351
|
-
type:
|
|
2423
|
+
z7.object({
|
|
2424
|
+
type: z7.literal("console"),
|
|
2352
2425
|
data: SSEConsoleEventData
|
|
2353
2426
|
}),
|
|
2354
|
-
|
|
2355
|
-
type:
|
|
2427
|
+
z7.object({
|
|
2428
|
+
type: z7.literal("progress"),
|
|
2356
2429
|
data: SSEProgressEventData
|
|
2357
2430
|
}),
|
|
2358
|
-
|
|
2359
|
-
type:
|
|
2360
|
-
data:
|
|
2431
|
+
z7.object({
|
|
2432
|
+
type: z7.literal("start"),
|
|
2433
|
+
data: z7.string()
|
|
2361
2434
|
}),
|
|
2362
|
-
|
|
2363
|
-
type:
|
|
2364
|
-
data:
|
|
2435
|
+
z7.object({
|
|
2436
|
+
type: z7.literal("done"),
|
|
2437
|
+
data: z7.string()
|
|
2365
2438
|
})
|
|
2366
2439
|
]);
|
|
2367
2440
|
var BraintrustStream = class _BraintrustStream {
|
|
@@ -3058,17 +3131,31 @@ var NoopSpan = class {
|
|
|
3058
3131
|
state() {
|
|
3059
3132
|
return _internalGetGlobalState();
|
|
3060
3133
|
}
|
|
3134
|
+
// Custom inspect for Node.js console.log
|
|
3135
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3136
|
+
return `NoopSpan {
|
|
3137
|
+
kind: '${this.kind}',
|
|
3138
|
+
id: '${this.id}',
|
|
3139
|
+
spanId: '${this.spanId}',
|
|
3140
|
+
rootSpanId: '${this.rootSpanId}',
|
|
3141
|
+
spanParents: ${JSON.stringify(this.spanParents)}
|
|
3142
|
+
}`;
|
|
3143
|
+
}
|
|
3144
|
+
// Custom toString
|
|
3145
|
+
toString() {
|
|
3146
|
+
return `NoopSpan(id=${this.id}, spanId=${this.spanId})`;
|
|
3147
|
+
}
|
|
3061
3148
|
};
|
|
3062
3149
|
var NOOP_SPAN = new NoopSpan();
|
|
3063
3150
|
var NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
|
|
3064
|
-
var loginSchema =
|
|
3065
|
-
appUrl:
|
|
3066
|
-
appPublicUrl:
|
|
3067
|
-
orgName:
|
|
3068
|
-
apiUrl:
|
|
3069
|
-
proxyUrl:
|
|
3070
|
-
loginToken:
|
|
3071
|
-
orgId:
|
|
3151
|
+
var loginSchema = z8.strictObject({
|
|
3152
|
+
appUrl: z8.string(),
|
|
3153
|
+
appPublicUrl: z8.string(),
|
|
3154
|
+
orgName: z8.string(),
|
|
3155
|
+
apiUrl: z8.string(),
|
|
3156
|
+
proxyUrl: z8.string(),
|
|
3157
|
+
loginToken: z8.string(),
|
|
3158
|
+
orgId: z8.string().nullish(),
|
|
3072
3159
|
gitMetadataSettings: GitMetadataSettings.nullish()
|
|
3073
3160
|
});
|
|
3074
3161
|
var stateNonce = 0;
|
|
@@ -3127,6 +3214,7 @@ var BraintrustState = class _BraintrustState {
|
|
|
3127
3214
|
_apiConn = null;
|
|
3128
3215
|
_proxyConn = null;
|
|
3129
3216
|
promptCache;
|
|
3217
|
+
_idGenerator = null;
|
|
3130
3218
|
resetLoginInfo() {
|
|
3131
3219
|
this.appUrl = null;
|
|
3132
3220
|
this.appPublicUrl = null;
|
|
@@ -3141,6 +3229,15 @@ var BraintrustState = class _BraintrustState {
|
|
|
3141
3229
|
this._apiConn = null;
|
|
3142
3230
|
this._proxyConn = null;
|
|
3143
3231
|
}
|
|
3232
|
+
resetIdGenState() {
|
|
3233
|
+
this._idGenerator = null;
|
|
3234
|
+
}
|
|
3235
|
+
get idGenerator() {
|
|
3236
|
+
if (this._idGenerator === null) {
|
|
3237
|
+
this._idGenerator = getIdGenerator();
|
|
3238
|
+
}
|
|
3239
|
+
return this._idGenerator;
|
|
3240
|
+
}
|
|
3144
3241
|
copyLoginInfo(other) {
|
|
3145
3242
|
this.appUrl = other.appUrl;
|
|
3146
3243
|
this.appPublicUrl = other.appPublicUrl;
|
|
@@ -3278,6 +3375,37 @@ var BraintrustState = class _BraintrustState {
|
|
|
3278
3375
|
enforceQueueSizeLimit(enforce) {
|
|
3279
3376
|
this._bgLogger.get().enforceQueueSizeLimit(enforce);
|
|
3280
3377
|
}
|
|
3378
|
+
// Custom serialization to avoid logging sensitive data
|
|
3379
|
+
toJSON() {
|
|
3380
|
+
return {
|
|
3381
|
+
id: this.id,
|
|
3382
|
+
orgId: this.orgId,
|
|
3383
|
+
orgName: this.orgName,
|
|
3384
|
+
appUrl: this.appUrl,
|
|
3385
|
+
appPublicUrl: this.appPublicUrl,
|
|
3386
|
+
apiUrl: this.apiUrl,
|
|
3387
|
+
proxyUrl: this.proxyUrl,
|
|
3388
|
+
loggedIn: this.loggedIn
|
|
3389
|
+
// Explicitly exclude loginToken, _apiConn, _appConn, _proxyConn and other sensitive fields
|
|
3390
|
+
};
|
|
3391
|
+
}
|
|
3392
|
+
// Custom inspect for Node.js console.log
|
|
3393
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3394
|
+
return `BraintrustState {
|
|
3395
|
+
id: '${this.id}',
|
|
3396
|
+
orgId: ${this.orgId ? `'${this.orgId}'` : "null"},
|
|
3397
|
+
orgName: ${this.orgName ? `'${this.orgName}'` : "null"},
|
|
3398
|
+
appUrl: ${this.appUrl ? `'${this.appUrl}'` : "null"},
|
|
3399
|
+
apiUrl: ${this.apiUrl ? `'${this.apiUrl}'` : "null"},
|
|
3400
|
+
proxyUrl: ${this.proxyUrl ? `'${this.proxyUrl}'` : "null"},
|
|
3401
|
+
loggedIn: ${this.loggedIn},
|
|
3402
|
+
loginToken: '[REDACTED]'
|
|
3403
|
+
}`;
|
|
3404
|
+
}
|
|
3405
|
+
// Custom toString
|
|
3406
|
+
toString() {
|
|
3407
|
+
return `BraintrustState(id=${this.id}, org=${this.orgName || "none"}, loggedIn=${this.loggedIn})`;
|
|
3408
|
+
}
|
|
3281
3409
|
};
|
|
3282
3410
|
var _globalState;
|
|
3283
3411
|
function useTestBackgroundLogger() {
|
|
@@ -3445,6 +3573,17 @@ var HTTPConnection = class _HTTPConnection {
|
|
|
3445
3573
|
});
|
|
3446
3574
|
return await resp.json();
|
|
3447
3575
|
}
|
|
3576
|
+
// Custom inspect for Node.js console.log
|
|
3577
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3578
|
+
return `HTTPConnection {
|
|
3579
|
+
base_url: '${this.base_url}',
|
|
3580
|
+
token: '[REDACTED]'
|
|
3581
|
+
}`;
|
|
3582
|
+
}
|
|
3583
|
+
// Custom toString
|
|
3584
|
+
toString() {
|
|
3585
|
+
return `HTTPConnection(${this.base_url})`;
|
|
3586
|
+
}
|
|
3448
3587
|
};
|
|
3449
3588
|
var BaseAttachment = class {
|
|
3450
3589
|
reference;
|
|
@@ -3545,9 +3684,9 @@ var Attachment = class extends BaseAttachment {
|
|
|
3545
3684
|
let signedUrl;
|
|
3546
3685
|
let headers;
|
|
3547
3686
|
try {
|
|
3548
|
-
({ signedUrl, headers } =
|
|
3549
|
-
signedUrl:
|
|
3550
|
-
headers:
|
|
3687
|
+
({ signedUrl, headers } = z8.object({
|
|
3688
|
+
signedUrl: z8.string().url(),
|
|
3689
|
+
headers: z8.record(z8.string())
|
|
3551
3690
|
}).parse(await metadataResponse.json()));
|
|
3552
3691
|
} catch (error) {
|
|
3553
3692
|
if (error instanceof ZodError) {
|
|
@@ -3702,8 +3841,8 @@ var ExternalAttachment = class extends BaseAttachment {
|
|
|
3702
3841
|
});
|
|
3703
3842
|
}
|
|
3704
3843
|
};
|
|
3705
|
-
var attachmentMetadataSchema =
|
|
3706
|
-
downloadUrl:
|
|
3844
|
+
var attachmentMetadataSchema = z8.object({
|
|
3845
|
+
downloadUrl: z8.string(),
|
|
3707
3846
|
status: AttachmentStatus
|
|
3708
3847
|
});
|
|
3709
3848
|
var ReadonlyAttachment = class {
|
|
@@ -3841,7 +3980,7 @@ function logFeedbackImpl(state, parentObjectType, parentObjectId, {
|
|
|
3841
3980
|
if (!isEmpty(comment)) {
|
|
3842
3981
|
const record = new LazyValue(async () => {
|
|
3843
3982
|
return {
|
|
3844
|
-
id:
|
|
3983
|
+
id: uuidv42(),
|
|
3845
3984
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3846
3985
|
origin: {
|
|
3847
3986
|
// NOTE: We do not know (or care?) what the transaction id of the row that
|
|
@@ -4631,7 +4770,7 @@ Error: ${errorText}`;
|
|
|
4631
4770
|
}
|
|
4632
4771
|
const payloadFile = isomorph_default.pathJoin(
|
|
4633
4772
|
payloadDir,
|
|
4634
|
-
`payload_${getCurrentUnixTimestamp()}_${
|
|
4773
|
+
`payload_${getCurrentUnixTimestamp()}_${uuidv42().slice(0, 8)}.json`
|
|
4635
4774
|
);
|
|
4636
4775
|
try {
|
|
4637
4776
|
await isomorph_default.mkdir(payloadDir, { recursive: true });
|
|
@@ -5683,7 +5822,7 @@ function validateAndSanitizeExperimentLogPartialArgs(event) {
|
|
|
5683
5822
|
function deepCopyEvent(event) {
|
|
5684
5823
|
const attachments = [];
|
|
5685
5824
|
const IDENTIFIER = "_bt_internal_saved_attachment";
|
|
5686
|
-
const savedAttachmentSchema =
|
|
5825
|
+
const savedAttachmentSchema = z8.strictObject({ [IDENTIFIER]: z8.number() });
|
|
5687
5826
|
const serialized = JSON.stringify(event, (_k, v) => {
|
|
5688
5827
|
if (v instanceof SpanImpl || v instanceof NoopSpan) {
|
|
5689
5828
|
return `<span>`;
|
|
@@ -6186,7 +6325,7 @@ var ReadonlyExperiment = class extends ObjectFetcher {
|
|
|
6186
6325
|
};
|
|
6187
6326
|
var executionCounter = 0;
|
|
6188
6327
|
function newId() {
|
|
6189
|
-
return
|
|
6328
|
+
return uuidv42();
|
|
6190
6329
|
}
|
|
6191
6330
|
var SpanImpl = class _SpanImpl {
|
|
6192
6331
|
_state;
|
|
@@ -6242,13 +6381,17 @@ var SpanImpl = class _SpanImpl {
|
|
|
6242
6381
|
},
|
|
6243
6382
|
created: (/* @__PURE__ */ new Date()).toISOString()
|
|
6244
6383
|
};
|
|
6245
|
-
this._id = eventId ??
|
|
6246
|
-
this._spanId = args.spanId ??
|
|
6384
|
+
this._id = eventId ?? this._state.idGenerator.getSpanId();
|
|
6385
|
+
this._spanId = args.spanId ?? this._state.idGenerator.getSpanId();
|
|
6247
6386
|
if (args.parentSpanIds) {
|
|
6248
6387
|
this._rootSpanId = args.parentSpanIds.rootSpanId;
|
|
6249
6388
|
this._spanParents = "parentSpanIds" in args.parentSpanIds ? args.parentSpanIds.parentSpanIds : [args.parentSpanIds.spanId];
|
|
6250
6389
|
} else {
|
|
6251
|
-
this.
|
|
6390
|
+
if (this._state.idGenerator.shareRootSpanId()) {
|
|
6391
|
+
this._rootSpanId = this._spanId;
|
|
6392
|
+
} else {
|
|
6393
|
+
this._rootSpanId = this._state.idGenerator.getTraceId();
|
|
6394
|
+
}
|
|
6252
6395
|
this._spanParents = void 0;
|
|
6253
6396
|
}
|
|
6254
6397
|
this.isMerge = false;
|
|
@@ -6459,6 +6602,20 @@ var SpanImpl = class _SpanImpl {
|
|
|
6459
6602
|
state() {
|
|
6460
6603
|
return this._state;
|
|
6461
6604
|
}
|
|
6605
|
+
// Custom inspect for Node.js console.log
|
|
6606
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6607
|
+
return `SpanImpl {
|
|
6608
|
+
kind: '${this.kind}',
|
|
6609
|
+
id: '${this.id}',
|
|
6610
|
+
spanId: '${this.spanId}',
|
|
6611
|
+
rootSpanId: '${this.rootSpanId}',
|
|
6612
|
+
spanParents: ${JSON.stringify(this.spanParents)}
|
|
6613
|
+
}`;
|
|
6614
|
+
}
|
|
6615
|
+
// Custom toString
|
|
6616
|
+
toString() {
|
|
6617
|
+
return `SpanImpl(id=${this.id}, spanId=${this.spanId})`;
|
|
6618
|
+
}
|
|
6462
6619
|
};
|
|
6463
6620
|
function splitLoggingData({
|
|
6464
6621
|
event,
|
|
@@ -6610,7 +6767,7 @@ var Dataset2 = class extends ObjectFetcher {
|
|
|
6610
6767
|
output
|
|
6611
6768
|
}) {
|
|
6612
6769
|
this.validateEvent({ metadata, expected, output, tags });
|
|
6613
|
-
const rowId = id ||
|
|
6770
|
+
const rowId = id || uuidv42();
|
|
6614
6771
|
const args = this.createArgs(
|
|
6615
6772
|
deepCopyEvent({
|
|
6616
6773
|
id: rowId,
|
|
@@ -6688,8 +6845,8 @@ var Dataset2 = class extends ObjectFetcher {
|
|
|
6688
6845
|
)}`;
|
|
6689
6846
|
let dataSummary;
|
|
6690
6847
|
if (summarizeData) {
|
|
6691
|
-
const rawDataSummary =
|
|
6692
|
-
total_records:
|
|
6848
|
+
const rawDataSummary = z8.object({
|
|
6849
|
+
total_records: z8.number()
|
|
6693
6850
|
}).parse(
|
|
6694
6851
|
await state.apiConn().get_json(
|
|
6695
6852
|
"dataset-summary",
|
|
@@ -6812,11 +6969,11 @@ function renderTemplatedObject(obj, args, options) {
|
|
|
6812
6969
|
return obj;
|
|
6813
6970
|
}
|
|
6814
6971
|
function renderPromptParams(params, args, options) {
|
|
6815
|
-
const schemaParsed =
|
|
6816
|
-
response_format:
|
|
6817
|
-
type:
|
|
6972
|
+
const schemaParsed = z8.object({
|
|
6973
|
+
response_format: z8.object({
|
|
6974
|
+
type: z8.literal("json_schema"),
|
|
6818
6975
|
json_schema: ResponseFormatJsonSchema.omit({ schema: true }).extend({
|
|
6819
|
-
schema:
|
|
6976
|
+
schema: z8.unknown()
|
|
6820
6977
|
})
|
|
6821
6978
|
})
|
|
6822
6979
|
}).safeParse(params);
|
|
@@ -6934,7 +7091,7 @@ var Prompt2 = class _Prompt {
|
|
|
6934
7091
|
if (!prompt) {
|
|
6935
7092
|
throw new Error("Empty prompt");
|
|
6936
7093
|
}
|
|
6937
|
-
const dictArgParsed =
|
|
7094
|
+
const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
|
|
6938
7095
|
const variables = {
|
|
6939
7096
|
input: buildArgs,
|
|
6940
7097
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
@@ -6989,7 +7146,7 @@ var Prompt2 = class _Prompt {
|
|
|
6989
7146
|
return JSON.stringify(v);
|
|
6990
7147
|
}
|
|
6991
7148
|
};
|
|
6992
|
-
const dictArgParsed =
|
|
7149
|
+
const dictArgParsed = z8.record(z8.unknown()).safeParse(buildArgs);
|
|
6993
7150
|
const variables = {
|
|
6994
7151
|
input: buildArgs,
|
|
6995
7152
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
@@ -7130,6 +7287,12 @@ async function getPromptVersions(projectId, promptId) {
|
|
|
7130
7287
|
(entry) => ["upsert", "merge"].includes(entry.audit_data?.action)
|
|
7131
7288
|
).map((entry) => prettifyXact(entry._xact_id)) || [];
|
|
7132
7289
|
}
|
|
7290
|
+
function resetIdGenStateForTests() {
|
|
7291
|
+
const state = _internalGetGlobalState();
|
|
7292
|
+
if (state) {
|
|
7293
|
+
state.resetIdGenState();
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7133
7296
|
var _exportsForTestingOnly = {
|
|
7134
7297
|
extractAttachments,
|
|
7135
7298
|
deepCopyEvent,
|
|
@@ -7140,7 +7303,8 @@ var _exportsForTestingOnly = {
|
|
|
7140
7303
|
setInitialTestState,
|
|
7141
7304
|
initTestExperiment,
|
|
7142
7305
|
isGeneratorFunction,
|
|
7143
|
-
isAsyncGeneratorFunction
|
|
7306
|
+
isAsyncGeneratorFunction,
|
|
7307
|
+
resetIdGenStateForTests
|
|
7144
7308
|
};
|
|
7145
7309
|
|
|
7146
7310
|
// src/browser-config.ts
|
|
@@ -7208,6 +7372,7 @@ __export(exports_browser_exports, {
|
|
|
7208
7372
|
currentExperiment: () => currentExperiment,
|
|
7209
7373
|
currentLogger: () => currentLogger,
|
|
7210
7374
|
currentSpan: () => currentSpan,
|
|
7375
|
+
deepCopyEvent: () => deepCopyEvent,
|
|
7211
7376
|
deserializePlainStringAsJSON: () => deserializePlainStringAsJSON,
|
|
7212
7377
|
devNullWritableStream: () => devNullWritableStream,
|
|
7213
7378
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
@@ -7387,7 +7552,7 @@ function parseSpanFromResponseCreateParams(params) {
|
|
|
7387
7552
|
function parseEventFromResponseCreateResult(result) {
|
|
7388
7553
|
const data = {};
|
|
7389
7554
|
if (result?.output !== void 0) {
|
|
7390
|
-
data.output = result.output;
|
|
7555
|
+
data.output = processImagesInOutput(result.output);
|
|
7391
7556
|
}
|
|
7392
7557
|
if (result) {
|
|
7393
7558
|
const { output, usage, ...metadata } = result;
|
|
@@ -7398,6 +7563,35 @@ function parseEventFromResponseCreateResult(result) {
|
|
|
7398
7563
|
data.metrics = parseMetricsFromUsage(result?.usage);
|
|
7399
7564
|
return data;
|
|
7400
7565
|
}
|
|
7566
|
+
function processImagesInOutput(output) {
|
|
7567
|
+
if (Array.isArray(output)) {
|
|
7568
|
+
return output.map(processImagesInOutput);
|
|
7569
|
+
}
|
|
7570
|
+
if (isObject(output)) {
|
|
7571
|
+
if (output.type === "image_generation_call" && output.result && typeof output.result === "string") {
|
|
7572
|
+
const fileExtension = output.output_format || "png";
|
|
7573
|
+
const contentType = `image/${fileExtension}`;
|
|
7574
|
+
const baseFilename = output.revised_prompt && typeof output.revised_prompt === "string" ? output.revised_prompt.slice(0, 50).replace(/[^a-zA-Z0-9]/g, "_") : "generated_image";
|
|
7575
|
+
const filename = `${baseFilename}.${fileExtension}`;
|
|
7576
|
+
const binaryString = atob(output.result);
|
|
7577
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
7578
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
7579
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
7580
|
+
}
|
|
7581
|
+
const blob = new Blob([bytes], { type: contentType });
|
|
7582
|
+
const attachment = new Attachment({
|
|
7583
|
+
data: blob,
|
|
7584
|
+
filename,
|
|
7585
|
+
contentType
|
|
7586
|
+
});
|
|
7587
|
+
return {
|
|
7588
|
+
...output,
|
|
7589
|
+
result: attachment
|
|
7590
|
+
};
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
return output;
|
|
7594
|
+
}
|
|
7401
7595
|
function parseSpanFromResponseParseParams(params) {
|
|
7402
7596
|
const spanArgs = {
|
|
7403
7597
|
name: "openai.responses.parse",
|
|
@@ -7421,7 +7615,7 @@ function parseSpanFromResponseParseParams(params) {
|
|
|
7421
7615
|
function parseEventFromResponseParseResult(result) {
|
|
7422
7616
|
const data = {};
|
|
7423
7617
|
if (result?.output !== void 0) {
|
|
7424
|
-
data.output = result.output;
|
|
7618
|
+
data.output = processImagesInOutput(result.output);
|
|
7425
7619
|
}
|
|
7426
7620
|
if (result) {
|
|
7427
7621
|
const { output, usage, ...metadata } = result;
|
|
@@ -7465,7 +7659,7 @@ function parseLogFromItem(item) {
|
|
|
7465
7659
|
case "response.completed":
|
|
7466
7660
|
const data = {};
|
|
7467
7661
|
if (response?.output !== void 0) {
|
|
7468
|
-
data.output = response.output;
|
|
7662
|
+
data.output = processImagesInOutput(response.output);
|
|
7469
7663
|
}
|
|
7470
7664
|
if (response) {
|
|
7471
7665
|
const { usage, output, ...metadata } = response;
|
|
@@ -8050,44 +8244,44 @@ var WrapperStream = class {
|
|
|
8050
8244
|
};
|
|
8051
8245
|
|
|
8052
8246
|
// dev/types.ts
|
|
8053
|
-
import { z as
|
|
8054
|
-
var evalBodySchema =
|
|
8055
|
-
name:
|
|
8056
|
-
parameters:
|
|
8247
|
+
import { z as z9 } from "zod/v3";
|
|
8248
|
+
var evalBodySchema = z9.object({
|
|
8249
|
+
name: z9.string(),
|
|
8250
|
+
parameters: z9.record(z9.string(), z9.unknown()).nullish(),
|
|
8057
8251
|
data: RunEval.shape.data,
|
|
8058
|
-
scores:
|
|
8059
|
-
|
|
8252
|
+
scores: z9.array(
|
|
8253
|
+
z9.object({
|
|
8060
8254
|
function_id: FunctionId,
|
|
8061
|
-
name:
|
|
8255
|
+
name: z9.string()
|
|
8062
8256
|
})
|
|
8063
8257
|
).nullish(),
|
|
8064
|
-
experiment_name:
|
|
8065
|
-
project_id:
|
|
8258
|
+
experiment_name: z9.string().nullish(),
|
|
8259
|
+
project_id: z9.string().nullish(),
|
|
8066
8260
|
parent: InvokeParent.optional(),
|
|
8067
|
-
stream:
|
|
8261
|
+
stream: z9.boolean().optional()
|
|
8068
8262
|
});
|
|
8069
|
-
var evalParametersSerializedSchema =
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
type:
|
|
8263
|
+
var evalParametersSerializedSchema = z9.record(
|
|
8264
|
+
z9.string(),
|
|
8265
|
+
z9.union([
|
|
8266
|
+
z9.object({
|
|
8267
|
+
type: z9.literal("prompt"),
|
|
8074
8268
|
default: PromptData.optional(),
|
|
8075
|
-
description:
|
|
8269
|
+
description: z9.string().optional()
|
|
8076
8270
|
}),
|
|
8077
|
-
|
|
8078
|
-
type:
|
|
8079
|
-
schema:
|
|
8271
|
+
z9.object({
|
|
8272
|
+
type: z9.literal("data"),
|
|
8273
|
+
schema: z9.record(z9.unknown()),
|
|
8080
8274
|
// JSON Schema
|
|
8081
|
-
default:
|
|
8082
|
-
description:
|
|
8275
|
+
default: z9.unknown().optional(),
|
|
8276
|
+
description: z9.string().optional()
|
|
8083
8277
|
})
|
|
8084
8278
|
])
|
|
8085
8279
|
);
|
|
8086
|
-
var evaluatorDefinitionSchema =
|
|
8280
|
+
var evaluatorDefinitionSchema = z9.object({
|
|
8087
8281
|
parameters: evalParametersSerializedSchema.optional()
|
|
8088
8282
|
});
|
|
8089
|
-
var evaluatorDefinitionsSchema =
|
|
8090
|
-
|
|
8283
|
+
var evaluatorDefinitionsSchema = z9.record(
|
|
8284
|
+
z9.string(),
|
|
8091
8285
|
evaluatorDefinitionSchema
|
|
8092
8286
|
);
|
|
8093
8287
|
|
|
@@ -8125,6 +8319,7 @@ export {
|
|
|
8125
8319
|
currentExperiment,
|
|
8126
8320
|
currentLogger,
|
|
8127
8321
|
currentSpan,
|
|
8322
|
+
deepCopyEvent,
|
|
8128
8323
|
browser_default as default,
|
|
8129
8324
|
deserializePlainStringAsJSON,
|
|
8130
8325
|
devNullWritableStream,
|