braintrust 1.0.3 → 1.1.0-rc.16
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 +5 -0
- package/dev/dist/index.d.ts +5 -0
- package/dev/dist/index.js +244 -148
- package/dev/dist/index.mjs +244 -148
- package/dist/browser.d.mts +19 -3
- package/dist/browser.d.ts +19 -3
- package/dist/browser.js +484 -240
- package/dist/browser.mjs +423 -179
- package/dist/cli.js +254 -156
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +484 -240
- package/dist/index.mjs +423 -179
- package/package.json +3 -1
package/dev/dist/index.mjs
CHANGED
|
@@ -2923,7 +2923,200 @@ var View = z6.object({
|
|
|
2923
2923
|
|
|
2924
2924
|
// src/logger.ts
|
|
2925
2925
|
import { waitUntil } from "@vercel/functions";
|
|
2926
|
+
import Mustache3 from "mustache";
|
|
2927
|
+
|
|
2928
|
+
// src/template/renderer.ts
|
|
2926
2929
|
import Mustache2 from "mustache";
|
|
2930
|
+
|
|
2931
|
+
// src/template/mustache-utils.ts
|
|
2932
|
+
import Mustache from "mustache";
|
|
2933
|
+
function lintTemplate(template, context) {
|
|
2934
|
+
const variables = getMustacheVars(template);
|
|
2935
|
+
for (const variable of variables) {
|
|
2936
|
+
const arrPathsReplaced = variable[1].replaceAll(/\.\d+/g, ".0");
|
|
2937
|
+
const fieldExists = getObjValueByPath(context, arrPathsReplaced.split(".")) !== void 0;
|
|
2938
|
+
if (!fieldExists) {
|
|
2939
|
+
throw new Error(`Variable '${variable[1]}' does not exist.`);
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
function getMustacheVars(prompt) {
|
|
2944
|
+
try {
|
|
2945
|
+
return Mustache.parse(prompt).filter(
|
|
2946
|
+
(span) => span[0] === "name" || span[0] === "&"
|
|
2947
|
+
);
|
|
2948
|
+
} catch {
|
|
2949
|
+
return [];
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
// src/template/nunjucks-utils.ts
|
|
2954
|
+
import * as nunjucks from "nunjucks";
|
|
2955
|
+
function lintTemplate2(template, context) {
|
|
2956
|
+
const env = new nunjucks.Environment(null, {
|
|
2957
|
+
autoescape: true,
|
|
2958
|
+
throwOnUndefined: true
|
|
2959
|
+
});
|
|
2960
|
+
env.renderString(template, context);
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
// src/template/nunjucks.ts
|
|
2964
|
+
import * as nunjucksNodeModule from "nunjucks";
|
|
2965
|
+
var nunjucks2 = nunjucksNodeModule;
|
|
2966
|
+
|
|
2967
|
+
// src/util.ts
|
|
2968
|
+
var GLOBAL_PROJECT = "Global";
|
|
2969
|
+
function runCatchFinally(f, catchF, finallyF) {
|
|
2970
|
+
let runSyncCleanup = true;
|
|
2971
|
+
try {
|
|
2972
|
+
const ret = f();
|
|
2973
|
+
if (ret instanceof Promise) {
|
|
2974
|
+
runSyncCleanup = false;
|
|
2975
|
+
return ret.catch(catchF).finally(finallyF);
|
|
2976
|
+
} else {
|
|
2977
|
+
return ret;
|
|
2978
|
+
}
|
|
2979
|
+
} catch (e) {
|
|
2980
|
+
return catchF(e);
|
|
2981
|
+
} finally {
|
|
2982
|
+
if (runSyncCleanup) {
|
|
2983
|
+
finallyF();
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
function getCurrentUnixTimestamp() {
|
|
2988
|
+
return (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
2989
|
+
}
|
|
2990
|
+
function isEmpty2(a) {
|
|
2991
|
+
return a === void 0 || a === null;
|
|
2992
|
+
}
|
|
2993
|
+
var LazyValue = class {
|
|
2994
|
+
callable;
|
|
2995
|
+
resolvedValue = void 0;
|
|
2996
|
+
value = {
|
|
2997
|
+
computedState: "uninitialized"
|
|
2998
|
+
};
|
|
2999
|
+
constructor(callable) {
|
|
3000
|
+
this.callable = callable;
|
|
3001
|
+
}
|
|
3002
|
+
get() {
|
|
3003
|
+
if (this.value.computedState !== "uninitialized") {
|
|
3004
|
+
return this.value.val;
|
|
3005
|
+
}
|
|
3006
|
+
this.value = {
|
|
3007
|
+
computedState: "in_progress",
|
|
3008
|
+
val: this.callable().then((x) => {
|
|
3009
|
+
this.value.computedState = "succeeded";
|
|
3010
|
+
this.resolvedValue = x;
|
|
3011
|
+
return x;
|
|
3012
|
+
})
|
|
3013
|
+
};
|
|
3014
|
+
return this.value.val;
|
|
3015
|
+
}
|
|
3016
|
+
getSync() {
|
|
3017
|
+
return {
|
|
3018
|
+
resolved: this.value.computedState === "succeeded",
|
|
3019
|
+
value: this.resolvedValue
|
|
3020
|
+
};
|
|
3021
|
+
}
|
|
3022
|
+
// If this is true, the caller should be able to obtain the LazyValue without
|
|
3023
|
+
// it throwing.
|
|
3024
|
+
get hasSucceeded() {
|
|
3025
|
+
return this.value.computedState === "succeeded";
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3028
|
+
var SyncLazyValue = class {
|
|
3029
|
+
callable;
|
|
3030
|
+
value = {
|
|
3031
|
+
computedState: "uninitialized"
|
|
3032
|
+
};
|
|
3033
|
+
constructor(callable) {
|
|
3034
|
+
this.callable = callable;
|
|
3035
|
+
}
|
|
3036
|
+
get() {
|
|
3037
|
+
if (this.value.computedState !== "uninitialized") {
|
|
3038
|
+
return this.value.val;
|
|
3039
|
+
}
|
|
3040
|
+
const result = this.callable();
|
|
3041
|
+
this.value = { computedState: "succeeded", val: result };
|
|
3042
|
+
return result;
|
|
3043
|
+
}
|
|
3044
|
+
// If this is true, the caller should be able to obtain the SyncLazyValue without
|
|
3045
|
+
// it throwing.
|
|
3046
|
+
get hasSucceeded() {
|
|
3047
|
+
return this.value.computedState === "succeeded";
|
|
3048
|
+
}
|
|
3049
|
+
};
|
|
3050
|
+
function addAzureBlobHeaders(headers, url) {
|
|
3051
|
+
if (url.includes("blob.core.windows.net")) {
|
|
3052
|
+
headers["x-ms-blob-type"] = "BlockBlob";
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
var InternalAbortError = class extends Error {
|
|
3056
|
+
constructor(message) {
|
|
3057
|
+
super(message);
|
|
3058
|
+
this.name = "InternalAbortError";
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
|
|
3062
|
+
// src/template/nunjucks-env.ts
|
|
3063
|
+
var createNunjucksEnv = (throwOnUndefined) => {
|
|
3064
|
+
return new nunjucks2.Environment(null, {
|
|
3065
|
+
autoescape: true,
|
|
3066
|
+
throwOnUndefined
|
|
3067
|
+
});
|
|
3068
|
+
};
|
|
3069
|
+
var nunjucksEnv = new SyncLazyValue(
|
|
3070
|
+
() => createNunjucksEnv(false)
|
|
3071
|
+
);
|
|
3072
|
+
var nunjucksStrictEnv = new SyncLazyValue(
|
|
3073
|
+
() => createNunjucksEnv(true)
|
|
3074
|
+
);
|
|
3075
|
+
function getNunjucksEnv(strict = false) {
|
|
3076
|
+
return strict ? nunjucksStrictEnv.get() : nunjucksEnv.get();
|
|
3077
|
+
}
|
|
3078
|
+
function renderNunjucksString(template, variables, strict = false) {
|
|
3079
|
+
try {
|
|
3080
|
+
return getNunjucksEnv(strict).renderString(template, variables);
|
|
3081
|
+
} catch (error) {
|
|
3082
|
+
if (error instanceof Error && error.message.includes(
|
|
3083
|
+
"Code generation from strings disallowed for this context"
|
|
3084
|
+
)) {
|
|
3085
|
+
throw new Error(
|
|
3086
|
+
`String template rendering. Disallowed in this environment for security reasons. Try a different template renderer. Original error: ${error.message}`
|
|
3087
|
+
);
|
|
3088
|
+
}
|
|
3089
|
+
throw error;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
// src/template/renderer.ts
|
|
3094
|
+
function isTemplateFormat(v) {
|
|
3095
|
+
return v === "mustache" || v === "nunjucks" || v === "none";
|
|
3096
|
+
}
|
|
3097
|
+
function parseTemplateFormat(value, defaultFormat = "mustache") {
|
|
3098
|
+
return isTemplateFormat(value) ? value : defaultFormat;
|
|
3099
|
+
}
|
|
3100
|
+
function renderTemplateContent(template, variables, escape, options) {
|
|
3101
|
+
const strict = !!options.strict;
|
|
3102
|
+
const templateFormat = parseTemplateFormat(options.templateFormat);
|
|
3103
|
+
if (templateFormat === "nunjucks") {
|
|
3104
|
+
if (strict) {
|
|
3105
|
+
lintTemplate2(template, variables);
|
|
3106
|
+
}
|
|
3107
|
+
return renderNunjucksString(template, variables, strict);
|
|
3108
|
+
} else if (templateFormat === "mustache") {
|
|
3109
|
+
if (strict) {
|
|
3110
|
+
lintTemplate(template, variables);
|
|
3111
|
+
}
|
|
3112
|
+
return Mustache2.render(template, variables, void 0, {
|
|
3113
|
+
escape
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
return template;
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
// src/logger.ts
|
|
2927
3120
|
import { z as z8, ZodError } from "zod/v3";
|
|
2928
3121
|
|
|
2929
3122
|
// src/functions/stream.ts
|
|
@@ -3451,123 +3644,6 @@ var PromptCache = class {
|
|
|
3451
3644
|
}
|
|
3452
3645
|
};
|
|
3453
3646
|
|
|
3454
|
-
// src/util.ts
|
|
3455
|
-
var GLOBAL_PROJECT = "Global";
|
|
3456
|
-
function runCatchFinally(f, catchF, finallyF) {
|
|
3457
|
-
let runSyncCleanup = true;
|
|
3458
|
-
try {
|
|
3459
|
-
const ret = f();
|
|
3460
|
-
if (ret instanceof Promise) {
|
|
3461
|
-
runSyncCleanup = false;
|
|
3462
|
-
return ret.catch(catchF).finally(finallyF);
|
|
3463
|
-
} else {
|
|
3464
|
-
return ret;
|
|
3465
|
-
}
|
|
3466
|
-
} catch (e) {
|
|
3467
|
-
return catchF(e);
|
|
3468
|
-
} finally {
|
|
3469
|
-
if (runSyncCleanup) {
|
|
3470
|
-
finallyF();
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
function getCurrentUnixTimestamp() {
|
|
3475
|
-
return (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
3476
|
-
}
|
|
3477
|
-
function isEmpty2(a) {
|
|
3478
|
-
return a === void 0 || a === null;
|
|
3479
|
-
}
|
|
3480
|
-
var LazyValue = class {
|
|
3481
|
-
callable;
|
|
3482
|
-
resolvedValue = void 0;
|
|
3483
|
-
value = {
|
|
3484
|
-
computedState: "uninitialized"
|
|
3485
|
-
};
|
|
3486
|
-
constructor(callable) {
|
|
3487
|
-
this.callable = callable;
|
|
3488
|
-
}
|
|
3489
|
-
get() {
|
|
3490
|
-
if (this.value.computedState !== "uninitialized") {
|
|
3491
|
-
return this.value.val;
|
|
3492
|
-
}
|
|
3493
|
-
this.value = {
|
|
3494
|
-
computedState: "in_progress",
|
|
3495
|
-
val: this.callable().then((x) => {
|
|
3496
|
-
this.value.computedState = "succeeded";
|
|
3497
|
-
this.resolvedValue = x;
|
|
3498
|
-
return x;
|
|
3499
|
-
})
|
|
3500
|
-
};
|
|
3501
|
-
return this.value.val;
|
|
3502
|
-
}
|
|
3503
|
-
getSync() {
|
|
3504
|
-
return {
|
|
3505
|
-
resolved: this.value.computedState === "succeeded",
|
|
3506
|
-
value: this.resolvedValue
|
|
3507
|
-
};
|
|
3508
|
-
}
|
|
3509
|
-
// If this is true, the caller should be able to obtain the LazyValue without
|
|
3510
|
-
// it throwing.
|
|
3511
|
-
get hasSucceeded() {
|
|
3512
|
-
return this.value.computedState === "succeeded";
|
|
3513
|
-
}
|
|
3514
|
-
};
|
|
3515
|
-
var SyncLazyValue = class {
|
|
3516
|
-
callable;
|
|
3517
|
-
value = {
|
|
3518
|
-
computedState: "uninitialized"
|
|
3519
|
-
};
|
|
3520
|
-
constructor(callable) {
|
|
3521
|
-
this.callable = callable;
|
|
3522
|
-
}
|
|
3523
|
-
get() {
|
|
3524
|
-
if (this.value.computedState !== "uninitialized") {
|
|
3525
|
-
return this.value.val;
|
|
3526
|
-
}
|
|
3527
|
-
const result = this.callable();
|
|
3528
|
-
this.value = { computedState: "succeeded", val: result };
|
|
3529
|
-
return result;
|
|
3530
|
-
}
|
|
3531
|
-
// If this is true, the caller should be able to obtain the SyncLazyValue without
|
|
3532
|
-
// it throwing.
|
|
3533
|
-
get hasSucceeded() {
|
|
3534
|
-
return this.value.computedState === "succeeded";
|
|
3535
|
-
}
|
|
3536
|
-
};
|
|
3537
|
-
function addAzureBlobHeaders(headers, url) {
|
|
3538
|
-
if (url.includes("blob.core.windows.net")) {
|
|
3539
|
-
headers["x-ms-blob-type"] = "BlockBlob";
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3542
|
-
var InternalAbortError = class extends Error {
|
|
3543
|
-
constructor(message) {
|
|
3544
|
-
super(message);
|
|
3545
|
-
this.name = "InternalAbortError";
|
|
3546
|
-
}
|
|
3547
|
-
};
|
|
3548
|
-
|
|
3549
|
-
// src/mustache-utils.ts
|
|
3550
|
-
import Mustache from "mustache";
|
|
3551
|
-
function lintTemplate(template, context) {
|
|
3552
|
-
const variables = getMustacheVars(template);
|
|
3553
|
-
for (const variable of variables) {
|
|
3554
|
-
const arrPathsReplaced = variable[1].replaceAll(/\.\d+/g, ".0");
|
|
3555
|
-
const fieldExists = getObjValueByPath(context, arrPathsReplaced.split(".")) !== void 0;
|
|
3556
|
-
if (!fieldExists) {
|
|
3557
|
-
throw new Error(`Variable '${variable[1]}' does not exist.`);
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
function getMustacheVars(prompt) {
|
|
3562
|
-
try {
|
|
3563
|
-
return Mustache.parse(prompt).filter(
|
|
3564
|
-
(span) => span[0] === "name" || span[0] === "&"
|
|
3565
|
-
);
|
|
3566
|
-
} catch {
|
|
3567
|
-
return [];
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
|
|
3571
3647
|
// src/logger.ts
|
|
3572
3648
|
var BRAINTRUST_ATTACHMENT = BraintrustAttachmentReference.shape.type.value;
|
|
3573
3649
|
var EXTERNAL_ATTACHMENT = ExternalAttachmentReference.shape.type.value;
|
|
@@ -7054,18 +7130,28 @@ function deserializePlainStringAsJSON(s) {
|
|
|
7054
7130
|
}
|
|
7055
7131
|
function renderTemplatedObject(obj, args, options) {
|
|
7056
7132
|
if (typeof obj === "string") {
|
|
7057
|
-
|
|
7058
|
-
|
|
7133
|
+
const strict = !!options.strict;
|
|
7134
|
+
if (options.templateFormat === "nunjucks") {
|
|
7135
|
+
if (strict) {
|
|
7136
|
+
lintTemplate2(obj, args);
|
|
7137
|
+
}
|
|
7138
|
+
return renderNunjucksString(obj, args, strict);
|
|
7059
7139
|
}
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
return value;
|
|
7064
|
-
} else {
|
|
7065
|
-
return JSON.stringify(value);
|
|
7066
|
-
}
|
|
7140
|
+
if (options.templateFormat === "mustache") {
|
|
7141
|
+
if (strict) {
|
|
7142
|
+
lintTemplate(obj, args);
|
|
7067
7143
|
}
|
|
7068
|
-
|
|
7144
|
+
return Mustache3.render(obj, args, void 0, {
|
|
7145
|
+
escape: (value) => {
|
|
7146
|
+
if (typeof value === "string") {
|
|
7147
|
+
return value;
|
|
7148
|
+
} else {
|
|
7149
|
+
return JSON.stringify(value);
|
|
7150
|
+
}
|
|
7151
|
+
}
|
|
7152
|
+
});
|
|
7153
|
+
}
|
|
7154
|
+
return obj;
|
|
7069
7155
|
} else if (isArray(obj)) {
|
|
7070
7156
|
return obj.map((item) => renderTemplatedObject(item, args, options));
|
|
7071
7157
|
} else if (isObject(obj)) {
|
|
@@ -7078,7 +7164,9 @@ function renderTemplatedObject(obj, args, options) {
|
|
|
7078
7164
|
}
|
|
7079
7165
|
return obj;
|
|
7080
7166
|
}
|
|
7081
|
-
function renderPromptParams(params, args, options) {
|
|
7167
|
+
function renderPromptParams(params, args, options = {}) {
|
|
7168
|
+
const templateFormat = parseTemplateFormat(options.templateFormat);
|
|
7169
|
+
const strict = !!options.strict;
|
|
7082
7170
|
const schemaParsed = z8.object({
|
|
7083
7171
|
response_format: z8.object({
|
|
7084
7172
|
type: z8.literal("json_schema"),
|
|
@@ -7089,7 +7177,10 @@ function renderPromptParams(params, args, options) {
|
|
|
7089
7177
|
}).safeParse(params);
|
|
7090
7178
|
if (schemaParsed.success) {
|
|
7091
7179
|
const rawSchema = schemaParsed.data.response_format.json_schema.schema;
|
|
7092
|
-
const templatedSchema = renderTemplatedObject(rawSchema, args,
|
|
7180
|
+
const templatedSchema = renderTemplatedObject(rawSchema, args, {
|
|
7181
|
+
strict,
|
|
7182
|
+
templateFormat
|
|
7183
|
+
});
|
|
7093
7184
|
const parsedSchema = typeof templatedSchema === "string" ? deserializePlainStringAsJSON(templatedSchema).value : templatedSchema;
|
|
7094
7185
|
return {
|
|
7095
7186
|
...params,
|
|
@@ -7148,7 +7239,8 @@ var Prompt2 = class _Prompt {
|
|
|
7148
7239
|
return this.runBuild(buildArgs, {
|
|
7149
7240
|
flavor: options.flavor ?? "chat",
|
|
7150
7241
|
messages: options.messages,
|
|
7151
|
-
strict: options.strict
|
|
7242
|
+
strict: options.strict,
|
|
7243
|
+
templateFormat: options.templateFormat
|
|
7152
7244
|
});
|
|
7153
7245
|
}
|
|
7154
7246
|
/**
|
|
@@ -7163,7 +7255,8 @@ var Prompt2 = class _Prompt {
|
|
|
7163
7255
|
return this.runBuild(hydrated, {
|
|
7164
7256
|
flavor: options.flavor ?? "chat",
|
|
7165
7257
|
messages: options.messages,
|
|
7166
|
-
strict: options.strict
|
|
7258
|
+
strict: options.strict,
|
|
7259
|
+
templateFormat: options.templateFormat
|
|
7167
7260
|
});
|
|
7168
7261
|
}
|
|
7169
7262
|
runBuild(buildArgs, options) {
|
|
@@ -7206,10 +7299,11 @@ var Prompt2 = class _Prompt {
|
|
|
7206
7299
|
input: buildArgs,
|
|
7207
7300
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
7208
7301
|
};
|
|
7302
|
+
const resolvedTemplateFormat = parseTemplateFormat(options.templateFormat);
|
|
7209
7303
|
const renderedPrompt = _Prompt.renderPrompt({
|
|
7210
7304
|
prompt,
|
|
7211
7305
|
buildArgs,
|
|
7212
|
-
options
|
|
7306
|
+
options: { ...options, templateFormat: resolvedTemplateFormat }
|
|
7213
7307
|
});
|
|
7214
7308
|
if (flavor === "chat") {
|
|
7215
7309
|
if (renderedPrompt.type !== "chat") {
|
|
@@ -7218,7 +7312,10 @@ var Prompt2 = class _Prompt {
|
|
|
7218
7312
|
);
|
|
7219
7313
|
}
|
|
7220
7314
|
return {
|
|
7221
|
-
...renderPromptParams(params, variables, {
|
|
7315
|
+
...renderPromptParams(params, variables, {
|
|
7316
|
+
strict: options.strict,
|
|
7317
|
+
templateFormat: resolvedTemplateFormat
|
|
7318
|
+
}),
|
|
7222
7319
|
...spanInfo,
|
|
7223
7320
|
messages: renderedPrompt.messages,
|
|
7224
7321
|
...renderedPrompt.tools ? {
|
|
@@ -7230,7 +7327,10 @@ var Prompt2 = class _Prompt {
|
|
|
7230
7327
|
throw new Error(`Prompt is a chat prompt. Use flavor: 'chat' instead`);
|
|
7231
7328
|
}
|
|
7232
7329
|
return {
|
|
7233
|
-
...renderPromptParams(params, variables, {
|
|
7330
|
+
...renderPromptParams(params, variables, {
|
|
7331
|
+
strict: options.strict,
|
|
7332
|
+
templateFormat: resolvedTemplateFormat
|
|
7333
|
+
}),
|
|
7234
7334
|
...spanInfo,
|
|
7235
7335
|
prompt: renderedPrompt.content
|
|
7236
7336
|
};
|
|
@@ -7261,15 +7361,12 @@ var Prompt2 = class _Prompt {
|
|
|
7261
7361
|
input: buildArgs,
|
|
7262
7362
|
...dictArgParsed.success ? dictArgParsed.data : {}
|
|
7263
7363
|
};
|
|
7364
|
+
const templateFormat = parseTemplateFormat(options.templateFormat);
|
|
7264
7365
|
if (prompt.type === "chat") {
|
|
7265
|
-
const render = (template) => {
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
return Mustache2.render(template, variables, void 0, {
|
|
7270
|
-
escape
|
|
7271
|
-
});
|
|
7272
|
-
};
|
|
7366
|
+
const render = (template) => renderTemplateContent(template, variables, escape, {
|
|
7367
|
+
strict: options.strict,
|
|
7368
|
+
templateFormat
|
|
7369
|
+
});
|
|
7273
7370
|
const baseMessages = (prompt.messages || []).map(
|
|
7274
7371
|
(m) => renderMessage(render, m)
|
|
7275
7372
|
);
|
|
@@ -7293,14 +7390,13 @@ var Prompt2 = class _Prompt {
|
|
|
7293
7390
|
"extra messages are not supported for completion prompts"
|
|
7294
7391
|
);
|
|
7295
7392
|
}
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7393
|
+
const content = renderTemplateContent(prompt.content, variables, escape, {
|
|
7394
|
+
strict: options.strict,
|
|
7395
|
+
templateFormat
|
|
7396
|
+
});
|
|
7299
7397
|
return {
|
|
7300
7398
|
type: "completion",
|
|
7301
|
-
content
|
|
7302
|
-
escape
|
|
7303
|
-
})
|
|
7399
|
+
content
|
|
7304
7400
|
};
|
|
7305
7401
|
} else {
|
|
7306
7402
|
const _ = prompt;
|
package/dist/browser.d.mts
CHANGED
|
@@ -15277,6 +15277,14 @@ declare const ToolFunctionDefinition: z.ZodObject<{
|
|
|
15277
15277
|
}>;
|
|
15278
15278
|
type ToolFunctionDefinitionType = z.infer<typeof ToolFunctionDefinition>;
|
|
15279
15279
|
|
|
15280
|
+
type TemplateFormat = "mustache" | "nunjucks" | "none";
|
|
15281
|
+
declare function isTemplateFormat(v: unknown): v is TemplateFormat;
|
|
15282
|
+
declare function parseTemplateFormat(value: unknown, defaultFormat?: TemplateFormat): TemplateFormat;
|
|
15283
|
+
declare function renderTemplateContent(template: string, variables: Record<string, unknown>, escape: (v: unknown) => string, options: {
|
|
15284
|
+
strict?: boolean;
|
|
15285
|
+
templateFormat?: TemplateFormat;
|
|
15286
|
+
}): string;
|
|
15287
|
+
|
|
15280
15288
|
interface IsoAsyncLocalStorage<T> {
|
|
15281
15289
|
enterWith(store: T): void;
|
|
15282
15290
|
run<R>(store: T | undefined, callback: () => R): R;
|
|
@@ -16981,8 +16989,9 @@ declare function deserializePlainStringAsJSON(s: string): {
|
|
|
16981
16989
|
value: string;
|
|
16982
16990
|
error: unknown;
|
|
16983
16991
|
};
|
|
16984
|
-
declare function renderPromptParams(params: ModelParamsType | undefined, args: Record<string, unknown>, options
|
|
16992
|
+
declare function renderPromptParams(params: ModelParamsType | undefined, args: Record<string, unknown>, options?: {
|
|
16985
16993
|
strict?: boolean;
|
|
16994
|
+
templateFormat?: TemplateFormat;
|
|
16986
16995
|
}): ModelParamsType | undefined;
|
|
16987
16996
|
declare class Prompt<HasId extends boolean = true, HasVersion extends boolean = true> {
|
|
16988
16997
|
private metadata;
|
|
@@ -17011,6 +17020,7 @@ declare class Prompt<HasId extends boolean = true, HasVersion extends boolean =
|
|
|
17011
17020
|
flavor?: Flavor;
|
|
17012
17021
|
messages?: ChatCompletionMessageParamType[];
|
|
17013
17022
|
strict?: boolean;
|
|
17023
|
+
templateFormat?: TemplateFormat;
|
|
17014
17024
|
}): CompiledPrompt<Flavor>;
|
|
17015
17025
|
/**
|
|
17016
17026
|
* This is a special build method that first resolves attachment references, and then
|
|
@@ -17024,6 +17034,7 @@ declare class Prompt<HasId extends boolean = true, HasVersion extends boolean =
|
|
|
17024
17034
|
messages?: ChatCompletionMessageParamType[];
|
|
17025
17035
|
strict?: boolean;
|
|
17026
17036
|
state?: BraintrustState;
|
|
17037
|
+
templateFormat?: TemplateFormat;
|
|
17027
17038
|
}): Promise<CompiledPrompt<Flavor>>;
|
|
17028
17039
|
private runBuild;
|
|
17029
17040
|
static renderPrompt({ prompt, buildArgs, options, }: {
|
|
@@ -17032,6 +17043,7 @@ declare class Prompt<HasId extends boolean = true, HasVersion extends boolean =
|
|
|
17032
17043
|
options: {
|
|
17033
17044
|
strict?: boolean;
|
|
17034
17045
|
messages?: ChatCompletionMessageParamType[];
|
|
17046
|
+
templateFormat?: TemplateFormat;
|
|
17035
17047
|
};
|
|
17036
17048
|
}): PromptBlockDataType;
|
|
17037
17049
|
private getParsedPromptData;
|
|
@@ -30787,6 +30799,7 @@ type _exports_SpanContext = SpanContext;
|
|
|
30787
30799
|
type _exports_SpanImpl = SpanImpl;
|
|
30788
30800
|
declare const _exports_SpanImpl: typeof SpanImpl;
|
|
30789
30801
|
type _exports_StartSpanArgs = StartSpanArgs;
|
|
30802
|
+
type _exports_TemplateFormat = TemplateFormat;
|
|
30790
30803
|
type _exports_TestBackgroundLogger = TestBackgroundLogger;
|
|
30791
30804
|
declare const _exports_TestBackgroundLogger: typeof TestBackgroundLogger;
|
|
30792
30805
|
type _exports_ToolBuilder = ToolBuilder;
|
|
@@ -30821,6 +30834,7 @@ declare const _exports_initExperiment: typeof initExperiment;
|
|
|
30821
30834
|
declare const _exports_initFunction: typeof initFunction;
|
|
30822
30835
|
declare const _exports_initLogger: typeof initLogger;
|
|
30823
30836
|
declare const _exports_invoke: typeof invoke;
|
|
30837
|
+
declare const _exports_isTemplateFormat: typeof isTemplateFormat;
|
|
30824
30838
|
declare const _exports_loadPrompt: typeof loadPrompt;
|
|
30825
30839
|
declare const _exports_log: typeof log;
|
|
30826
30840
|
declare const _exports_logError: typeof logError;
|
|
@@ -30828,6 +30842,7 @@ declare const _exports_login: typeof login;
|
|
|
30828
30842
|
declare const _exports_loginToState: typeof loginToState;
|
|
30829
30843
|
declare const _exports_newId: typeof newId;
|
|
30830
30844
|
declare const _exports_parseCachedHeader: typeof parseCachedHeader;
|
|
30845
|
+
declare const _exports_parseTemplateFormat: typeof parseTemplateFormat;
|
|
30831
30846
|
declare const _exports_permalink: typeof permalink;
|
|
30832
30847
|
declare const _exports_projects: typeof projects;
|
|
30833
30848
|
declare const _exports_promptContentsSchema: typeof promptContentsSchema;
|
|
@@ -30836,6 +30851,7 @@ declare const _exports_promptDefinitionToPromptData: typeof promptDefinitionToPr
|
|
|
30836
30851
|
declare const _exports_promptDefinitionWithToolsSchema: typeof promptDefinitionWithToolsSchema;
|
|
30837
30852
|
declare const _exports_renderMessage: typeof renderMessage;
|
|
30838
30853
|
declare const _exports_renderPromptParams: typeof renderPromptParams;
|
|
30854
|
+
declare const _exports_renderTemplateContent: typeof renderTemplateContent;
|
|
30839
30855
|
declare const _exports_reportFailures: typeof reportFailures;
|
|
30840
30856
|
declare const _exports_runEvaluator: typeof runEvaluator;
|
|
30841
30857
|
declare const _exports_setFetch: typeof setFetch;
|
|
@@ -30861,7 +30877,7 @@ declare const _exports_wrapOpenAI: typeof wrapOpenAI;
|
|
|
30861
30877
|
declare const _exports_wrapOpenAIv4: typeof wrapOpenAIv4;
|
|
30862
30878
|
declare const _exports_wrapTraced: typeof wrapTraced;
|
|
30863
30879
|
declare namespace _exports {
|
|
30864
|
-
export { type _exports_AnyDataset as AnyDataset, _exports_Attachment as Attachment, type _exports_AttachmentParams as AttachmentParams, _exports_AttachmentReference as AttachmentReference, type _exports_BackgroundLoggerOpts as BackgroundLoggerOpts, _exports_BaseAttachment as BaseAttachment, _exports_BaseExperiment as BaseExperiment, type _exports_BaseMetadata as BaseMetadata, _exports_BraintrustMiddleware as BraintrustMiddleware, _exports_BraintrustState as BraintrustState, _exports_BraintrustStream as BraintrustStream, type _exports_BraintrustStreamChunk as BraintrustStreamChunk, type _exports_ChatPrompt as ChatPrompt, _exports_CodeFunction as CodeFunction, type _exports_CodeOpts as CodeOpts, _exports_CodePrompt as CodePrompt, type _exports_CommentEvent as CommentEvent, type _exports_CompiledPrompt as CompiledPrompt, type _exports_CompiledPromptParams as CompiledPromptParams, type _exports_CompletionPrompt as CompletionPrompt, _exports_ContextManager as ContextManager, type _exports_ContextParentSpanIds as ContextParentSpanIds, type _exports_CreateProjectOpts as CreateProjectOpts, _exports_DEFAULT_FETCH_BATCH_SIZE as DEFAULT_FETCH_BATCH_SIZE, type _exports_DataSummary as DataSummary, _exports_Dataset as Dataset, type _exports_DatasetRecord as DatasetRecord, type _exports_DatasetSummary as DatasetSummary, type _exports_DefaultMetadataType as DefaultMetadataType, type _exports_DefaultPromptArgs as DefaultPromptArgs, _exports_ERR_PERMALINK as ERR_PERMALINK, type _exports_EndSpanArgs as EndSpanArgs, _exports_Eval as Eval, type _exports_EvalCase as EvalCase, type _exports_EvalHooks as EvalHooks, type _exports_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type _exports_EvalParameters as EvalParameters, type _exports_EvalResult as EvalResult, _exports_EvalResultWithSummary as EvalResultWithSummary, type _exports_EvalScorer as EvalScorer, type _exports_EvalScorerArgs as EvalScorerArgs, type _exports_EvalTask as EvalTask, type _exports_Evaluator as Evaluator, type _exports_EvaluatorDef as EvaluatorDef, type _exports_EvaluatorDefinition as EvaluatorDefinition, type _exports_EvaluatorDefinitions as EvaluatorDefinitions, type _exports_EvaluatorFile as EvaluatorFile, type _exports_EvaluatorManifest as EvaluatorManifest, _exports_Experiment as Experiment, type _exports_ExperimentLogFullArgs as ExperimentLogFullArgs, type _exports_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type _exports_ExperimentSummary as ExperimentSummary, type _exports_Exportable as Exportable, _exports_ExternalAttachment as ExternalAttachment, type _exports_ExternalAttachmentParams as ExternalAttachmentParams, _exports_FailedHTTPResponse as FailedHTTPResponse, type _exports_FullInitDatasetOptions as FullInitDatasetOptions, type _exports_FullInitOptions as FullInitOptions, type _exports_FullLoginOptions as FullLoginOptions, type _exports_FunctionEvent as FunctionEvent, _exports_IDGenerator as IDGenerator, type _exports_IdField as IdField, type _exports_InitDatasetOptions as InitDatasetOptions, type _exports_InitLoggerOptions as InitLoggerOptions, type _exports_InitOptions as InitOptions, type _exports_InputField as InputField, type _exports_InvokeFunctionArgs as InvokeFunctionArgs, type _exports_InvokeReturn as InvokeReturn, _exports_JSONAttachment as JSONAttachment, _exports_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, _exports_LazyValue as LazyValue, type _exports_LoadPromptOptions as LoadPromptOptions, type _exports_LogCommentFullArgs as LogCommentFullArgs, type _exports_LogFeedbackFullArgs as LogFeedbackFullArgs, type _exports_LogOptions as LogOptions, _exports_Logger as Logger, _exports_LoginInvalidOrgError as LoginInvalidOrgError, type _exports_LoginOptions as LoginOptions, type _exports_MetricSummary as MetricSummary, _exports_NOOP_SPAN as NOOP_SPAN, _exports_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, _exports_NoopSpan as NoopSpan, type _exports_ObjectMetadata as ObjectMetadata, type _exports_OtherExperimentLogFields as OtherExperimentLogFields, type _exports_ParentExperimentIds as ParentExperimentIds, type _exports_ParentProjectLogIds as ParentProjectLogIds, _exports_Project as Project, _exports_ProjectNameIdMap as ProjectNameIdMap, type _exports_PromiseUnless as PromiseUnless, _exports_Prompt as Prompt, _exports_PromptBuilder as PromptBuilder, type _exports_PromptContents as PromptContents, type _exports_PromptDefinition as PromptDefinition, type _exports_PromptDefinitionWithTools as PromptDefinitionWithTools, type _exports_PromptOpts as PromptOpts, type _exports_PromptRowWithId as PromptRowWithId, _exports_ReadonlyAttachment as ReadonlyAttachment, _exports_ReadonlyExperiment as ReadonlyExperiment, _exports_Reporter as Reporter, type _exports_ReporterBody as ReporterBody, type _exports_ScoreSummary as ScoreSummary, _exports_ScorerBuilder as ScorerBuilder, type _exports_ScorerOpts as ScorerOpts, type _exports_SerializedBraintrustState as SerializedBraintrustState, type _exports_SetCurrentArg as SetCurrentArg, type _exports_Span as Span, type _exports_SpanContext as SpanContext, _exports_SpanImpl as SpanImpl, type _exports_StartSpanArgs as StartSpanArgs, _exports_TestBackgroundLogger as TestBackgroundLogger, _exports_ToolBuilder as ToolBuilder, _exports_UUIDGenerator as UUIDGenerator, type _exports_WithTransactionId as WithTransactionId, _exports_X_CACHED_HEADER as X_CACHED_HEADER, _exports__exportsForTestingOnly as _exportsForTestingOnly, _exports__internalGetGlobalState as _internalGetGlobalState, _exports__internalSetInitialState as _internalSetInitialState, _exports_braintrustStreamChunkSchema as braintrustStreamChunkSchema, _exports_buildLocalSummary as buildLocalSummary, _exports_createFinalValuePassThroughStream as createFinalValuePassThroughStream, _exports_currentExperiment as currentExperiment, _exports_currentLogger as currentLogger, _exports_currentSpan as currentSpan, _exports_deepCopyEvent as deepCopyEvent, _exports_defaultErrorScoreHandler as defaultErrorScoreHandler, _exports_deserializePlainStringAsJSON as deserializePlainStringAsJSON, _exports_devNullWritableStream as devNullWritableStream, _exports_evaluatorDefinitionSchema as evaluatorDefinitionSchema, _exports_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, _exports_flush as flush, _exports_getContextManager as getContextManager, _exports_getIdGenerator as getIdGenerator, _exports_getPromptVersions as getPromptVersions, _exports_getSpanParentObject as getSpanParentObject, graphFramework as graph, _exports_init as init, _exports_initDataset as initDataset, _exports_initExperiment as initExperiment, _exports_initFunction as initFunction, _exports_initLogger as initLogger, _exports_invoke as invoke, _exports_loadPrompt as loadPrompt, _exports_log as log, _exports_logError as logError, _exports_login as login, _exports_loginToState as loginToState, _exports_newId as newId, _exports_parseCachedHeader as parseCachedHeader, _exports_permalink as permalink, _exports_projects as projects, _exports_promptContentsSchema as promptContentsSchema, _exports_promptDefinitionSchema as promptDefinitionSchema, _exports_promptDefinitionToPromptData as promptDefinitionToPromptData, _exports_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, _exports_renderMessage as renderMessage, _exports_renderPromptParams as renderPromptParams, _exports_reportFailures as reportFailures, _exports_runEvaluator as runEvaluator, _exports_setFetch as setFetch, _exports_setMaskingFunction as setMaskingFunction, _exports_spanComponentsToObjectId as spanComponentsToObjectId, _exports_startSpan as startSpan, _exports_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, _exports_traceable as traceable, _exports_traced as traced, _exports_updateSpan as updateSpan, _exports_withCurrent as withCurrent, _exports_withDataset as withDataset, _exports_withExperiment as withExperiment, _exports_withLogger as withLogger, _exports_withParent as withParent, _exports_wrapAISDK as wrapAISDK, _exports_wrapAISDKModel as wrapAISDKModel, _exports_wrapAnthropic as wrapAnthropic, _exports_wrapClaudeAgentSDK as wrapClaudeAgentSDK, _exports_wrapGoogleGenAI as wrapGoogleGenAI, _exports_wrapMastraAgent as wrapMastraAgent, _exports_wrapOpenAI as wrapOpenAI, _exports_wrapOpenAIv4 as wrapOpenAIv4, _exports_wrapTraced as wrapTraced };
|
|
30880
|
+
export { type _exports_AnyDataset as AnyDataset, _exports_Attachment as Attachment, type _exports_AttachmentParams as AttachmentParams, _exports_AttachmentReference as AttachmentReference, type _exports_BackgroundLoggerOpts as BackgroundLoggerOpts, _exports_BaseAttachment as BaseAttachment, _exports_BaseExperiment as BaseExperiment, type _exports_BaseMetadata as BaseMetadata, _exports_BraintrustMiddleware as BraintrustMiddleware, _exports_BraintrustState as BraintrustState, _exports_BraintrustStream as BraintrustStream, type _exports_BraintrustStreamChunk as BraintrustStreamChunk, type _exports_ChatPrompt as ChatPrompt, _exports_CodeFunction as CodeFunction, type _exports_CodeOpts as CodeOpts, _exports_CodePrompt as CodePrompt, type _exports_CommentEvent as CommentEvent, type _exports_CompiledPrompt as CompiledPrompt, type _exports_CompiledPromptParams as CompiledPromptParams, type _exports_CompletionPrompt as CompletionPrompt, _exports_ContextManager as ContextManager, type _exports_ContextParentSpanIds as ContextParentSpanIds, type _exports_CreateProjectOpts as CreateProjectOpts, _exports_DEFAULT_FETCH_BATCH_SIZE as DEFAULT_FETCH_BATCH_SIZE, type _exports_DataSummary as DataSummary, _exports_Dataset as Dataset, type _exports_DatasetRecord as DatasetRecord, type _exports_DatasetSummary as DatasetSummary, type _exports_DefaultMetadataType as DefaultMetadataType, type _exports_DefaultPromptArgs as DefaultPromptArgs, _exports_ERR_PERMALINK as ERR_PERMALINK, type _exports_EndSpanArgs as EndSpanArgs, _exports_Eval as Eval, type _exports_EvalCase as EvalCase, type _exports_EvalHooks as EvalHooks, type _exports_EvalParameterSerializedSchema as EvalParameterSerializedSchema, type _exports_EvalParameters as EvalParameters, type _exports_EvalResult as EvalResult, _exports_EvalResultWithSummary as EvalResultWithSummary, type _exports_EvalScorer as EvalScorer, type _exports_EvalScorerArgs as EvalScorerArgs, type _exports_EvalTask as EvalTask, type _exports_Evaluator as Evaluator, type _exports_EvaluatorDef as EvaluatorDef, type _exports_EvaluatorDefinition as EvaluatorDefinition, type _exports_EvaluatorDefinitions as EvaluatorDefinitions, type _exports_EvaluatorFile as EvaluatorFile, type _exports_EvaluatorManifest as EvaluatorManifest, _exports_Experiment as Experiment, type _exports_ExperimentLogFullArgs as ExperimentLogFullArgs, type _exports_ExperimentLogPartialArgs as ExperimentLogPartialArgs, type _exports_ExperimentSummary as ExperimentSummary, type _exports_Exportable as Exportable, _exports_ExternalAttachment as ExternalAttachment, type _exports_ExternalAttachmentParams as ExternalAttachmentParams, _exports_FailedHTTPResponse as FailedHTTPResponse, type _exports_FullInitDatasetOptions as FullInitDatasetOptions, type _exports_FullInitOptions as FullInitOptions, type _exports_FullLoginOptions as FullLoginOptions, type _exports_FunctionEvent as FunctionEvent, _exports_IDGenerator as IDGenerator, type _exports_IdField as IdField, type _exports_InitDatasetOptions as InitDatasetOptions, type _exports_InitLoggerOptions as InitLoggerOptions, type _exports_InitOptions as InitOptions, type _exports_InputField as InputField, type _exports_InvokeFunctionArgs as InvokeFunctionArgs, type _exports_InvokeReturn as InvokeReturn, _exports_JSONAttachment as JSONAttachment, _exports_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, _exports_LazyValue as LazyValue, type _exports_LoadPromptOptions as LoadPromptOptions, type _exports_LogCommentFullArgs as LogCommentFullArgs, type _exports_LogFeedbackFullArgs as LogFeedbackFullArgs, type _exports_LogOptions as LogOptions, _exports_Logger as Logger, _exports_LoginInvalidOrgError as LoginInvalidOrgError, type _exports_LoginOptions as LoginOptions, type _exports_MetricSummary as MetricSummary, _exports_NOOP_SPAN as NOOP_SPAN, _exports_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, _exports_NoopSpan as NoopSpan, type _exports_ObjectMetadata as ObjectMetadata, type _exports_OtherExperimentLogFields as OtherExperimentLogFields, type _exports_ParentExperimentIds as ParentExperimentIds, type _exports_ParentProjectLogIds as ParentProjectLogIds, _exports_Project as Project, _exports_ProjectNameIdMap as ProjectNameIdMap, type _exports_PromiseUnless as PromiseUnless, _exports_Prompt as Prompt, _exports_PromptBuilder as PromptBuilder, type _exports_PromptContents as PromptContents, type _exports_PromptDefinition as PromptDefinition, type _exports_PromptDefinitionWithTools as PromptDefinitionWithTools, type _exports_PromptOpts as PromptOpts, type _exports_PromptRowWithId as PromptRowWithId, _exports_ReadonlyAttachment as ReadonlyAttachment, _exports_ReadonlyExperiment as ReadonlyExperiment, _exports_Reporter as Reporter, type _exports_ReporterBody as ReporterBody, type _exports_ScoreSummary as ScoreSummary, _exports_ScorerBuilder as ScorerBuilder, type _exports_ScorerOpts as ScorerOpts, type _exports_SerializedBraintrustState as SerializedBraintrustState, type _exports_SetCurrentArg as SetCurrentArg, type _exports_Span as Span, type _exports_SpanContext as SpanContext, _exports_SpanImpl as SpanImpl, type _exports_StartSpanArgs as StartSpanArgs, type _exports_TemplateFormat as TemplateFormat, _exports_TestBackgroundLogger as TestBackgroundLogger, _exports_ToolBuilder as ToolBuilder, _exports_UUIDGenerator as UUIDGenerator, type _exports_WithTransactionId as WithTransactionId, _exports_X_CACHED_HEADER as X_CACHED_HEADER, _exports__exportsForTestingOnly as _exportsForTestingOnly, _exports__internalGetGlobalState as _internalGetGlobalState, _exports__internalSetInitialState as _internalSetInitialState, _exports_braintrustStreamChunkSchema as braintrustStreamChunkSchema, _exports_buildLocalSummary as buildLocalSummary, _exports_createFinalValuePassThroughStream as createFinalValuePassThroughStream, _exports_currentExperiment as currentExperiment, _exports_currentLogger as currentLogger, _exports_currentSpan as currentSpan, _exports_deepCopyEvent as deepCopyEvent, _exports_defaultErrorScoreHandler as defaultErrorScoreHandler, _exports_deserializePlainStringAsJSON as deserializePlainStringAsJSON, _exports_devNullWritableStream as devNullWritableStream, _exports_evaluatorDefinitionSchema as evaluatorDefinitionSchema, _exports_evaluatorDefinitionsSchema as evaluatorDefinitionsSchema, _exports_flush as flush, _exports_getContextManager as getContextManager, _exports_getIdGenerator as getIdGenerator, _exports_getPromptVersions as getPromptVersions, _exports_getSpanParentObject as getSpanParentObject, graphFramework as graph, _exports_init as init, _exports_initDataset as initDataset, _exports_initExperiment as initExperiment, _exports_initFunction as initFunction, _exports_initLogger as initLogger, _exports_invoke as invoke, _exports_isTemplateFormat as isTemplateFormat, _exports_loadPrompt as loadPrompt, _exports_log as log, _exports_logError as logError, _exports_login as login, _exports_loginToState as loginToState, _exports_newId as newId, _exports_parseCachedHeader as parseCachedHeader, _exports_parseTemplateFormat as parseTemplateFormat, _exports_permalink as permalink, _exports_projects as projects, _exports_promptContentsSchema as promptContentsSchema, _exports_promptDefinitionSchema as promptDefinitionSchema, _exports_promptDefinitionToPromptData as promptDefinitionToPromptData, _exports_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, _exports_renderMessage as renderMessage, _exports_renderPromptParams as renderPromptParams, _exports_renderTemplateContent as renderTemplateContent, _exports_reportFailures as reportFailures, _exports_runEvaluator as runEvaluator, _exports_setFetch as setFetch, _exports_setMaskingFunction as setMaskingFunction, _exports_spanComponentsToObjectId as spanComponentsToObjectId, _exports_startSpan as startSpan, _exports_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, _exports_traceable as traceable, _exports_traced as traced, _exports_updateSpan as updateSpan, _exports_withCurrent as withCurrent, _exports_withDataset as withDataset, _exports_withExperiment as withExperiment, _exports_withLogger as withLogger, _exports_withParent as withParent, _exports_wrapAISDK as wrapAISDK, _exports_wrapAISDKModel as wrapAISDKModel, _exports_wrapAnthropic as wrapAnthropic, _exports_wrapClaudeAgentSDK as wrapClaudeAgentSDK, _exports_wrapGoogleGenAI as wrapGoogleGenAI, _exports_wrapMastraAgent as wrapMastraAgent, _exports_wrapOpenAI as wrapOpenAI, _exports_wrapOpenAIv4 as wrapOpenAIv4, _exports_wrapTraced as wrapTraced };
|
|
30865
30881
|
}
|
|
30866
30882
|
|
|
30867
|
-
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, DEFAULT_FETCH_BATCH_SIZE, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, LoginInvalidOrgError, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, _exports as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|
|
30883
|
+
export { type AnyDataset, Attachment, type AttachmentParams, AttachmentReference, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustMiddleware, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, DEFAULT_FETCH_BATCH_SIZE, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitDatasetOptions, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, type IdField, type InitDatasetOptions, type InitLoggerOptions, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, JSONAttachment, LEGACY_CACHED_HEADER, LazyValue, type LoadPromptOptions, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, LoginInvalidOrgError, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span, type SpanContext, SpanImpl, type StartSpanArgs, type TemplateFormat, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, _exports as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, isTemplateFormat, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, parseTemplateFormat, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, renderTemplateContent, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapGoogleGenAI, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
|