braintrust 3.27.0 → 3.29.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/README.md +1 -1
- package/dev/dist/index.d.mts +879 -197
- package/dev/dist/index.d.ts +879 -197
- package/dev/dist/index.js +2960 -1865
- package/dev/dist/index.mjs +2217 -1122
- package/dist/apply-auto-instrumentation.js +345 -260
- package/dist/apply-auto-instrumentation.mjs +137 -52
- package/dist/auto-instrumentations/bundler/esbuild.cjs +124 -7
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +124 -7
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +124 -7
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +124 -7
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +124 -7
- package/dist/auto-instrumentations/bundler/webpack.cjs +124 -7
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-ZNHTSSGI.mjs → chunk-AOIYCVEL.mjs} +34 -3
- package/dist/auto-instrumentations/{chunk-XEYKUBLY.mjs → chunk-DKTGDNA7.mjs} +91 -5
- package/dist/auto-instrumentations/{chunk-BW33ULMW.mjs → chunk-OMCZ3MV2.mjs} +1 -1
- package/dist/auto-instrumentations/hook.mjs +1186 -161
- package/dist/auto-instrumentations/index.cjs +34 -3
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +1388 -75
- package/dist/browser.d.ts +1388 -75
- package/dist/browser.js +3954 -1124
- package/dist/browser.mjs +3954 -1124
- package/dist/{chunk-MF7NU6BT.js → chunk-6Z5S7VOU.js} +175 -25
- package/dist/{chunk-CZM5JIQL.mjs → chunk-7FA6VP2S.mjs} +172 -22
- package/dist/{chunk-YKD22IMR.mjs → chunk-M6XPNJC4.mjs} +2102 -1113
- package/dist/{chunk-QRHGVBKU.js → chunk-XLLGRXGR.js} +3273 -2284
- package/dist/cli.js +6353 -1483
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +3954 -1124
- package/dist/edge-light.mjs +3954 -1124
- package/dist/index.d.mts +1972 -659
- package/dist/index.d.ts +1972 -659
- package/dist/index.js +2453 -676
- package/dist/index.mjs +1973 -196
- package/dist/instrumentation/index.d.mts +738 -15
- package/dist/instrumentation/index.d.ts +738 -15
- package/dist/instrumentation/index.js +2791 -874
- package/dist/instrumentation/index.mjs +2791 -874
- package/dist/vitest-evals-reporter.js +16 -16
- package/dist/vitest-evals-reporter.mjs +2 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +3954 -1124
- package/dist/workerd.mjs +3954 -1124
- package/package.json +2 -3
- package/util/dist/index.d.mts +1596 -109
- package/util/dist/index.d.ts +1596 -109
|
@@ -3334,6 +3334,15 @@ declare const PromptData: z.ZodObject<{
|
|
|
3334
3334
|
type: "global";
|
|
3335
3335
|
name: string;
|
|
3336
3336
|
function_type?: "preprocessor" | undefined;
|
|
3337
|
+
}>, z.ZodObject<{
|
|
3338
|
+
type: z.ZodLiteral<"inline">;
|
|
3339
|
+
code: z.ZodString;
|
|
3340
|
+
}, "strip", z.ZodTypeAny, {
|
|
3341
|
+
code: string;
|
|
3342
|
+
type: "inline";
|
|
3343
|
+
}, {
|
|
3344
|
+
code: string;
|
|
3345
|
+
type: "inline";
|
|
3337
3346
|
}>, z.ZodNull]>>;
|
|
3338
3347
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
3339
3348
|
type: z.ZodLiteral<"function">;
|
|
@@ -3644,6 +3653,9 @@ declare const PromptData: z.ZodObject<{
|
|
|
3644
3653
|
type: "global";
|
|
3645
3654
|
name: string;
|
|
3646
3655
|
function_type: "preprocessor";
|
|
3656
|
+
} | {
|
|
3657
|
+
code: string;
|
|
3658
|
+
type: "inline";
|
|
3647
3659
|
} | null | undefined;
|
|
3648
3660
|
origin?: {
|
|
3649
3661
|
project_id?: string | undefined;
|
|
@@ -3918,6 +3930,9 @@ declare const PromptData: z.ZodObject<{
|
|
|
3918
3930
|
type: "global";
|
|
3919
3931
|
name: string;
|
|
3920
3932
|
function_type?: "preprocessor" | undefined;
|
|
3933
|
+
} | {
|
|
3934
|
+
code: string;
|
|
3935
|
+
type: "inline";
|
|
3921
3936
|
} | null | undefined;
|
|
3922
3937
|
origin?: {
|
|
3923
3938
|
project_id?: string | undefined;
|
|
@@ -5361,6 +5376,15 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5361
5376
|
type: "global";
|
|
5362
5377
|
name: string;
|
|
5363
5378
|
function_type?: "preprocessor" | undefined;
|
|
5379
|
+
}>, z.ZodObject<{
|
|
5380
|
+
type: z.ZodLiteral<"inline">;
|
|
5381
|
+
code: z.ZodString;
|
|
5382
|
+
}, "strip", z.ZodTypeAny, {
|
|
5383
|
+
code: string;
|
|
5384
|
+
type: "inline";
|
|
5385
|
+
}, {
|
|
5386
|
+
code: string;
|
|
5387
|
+
type: "inline";
|
|
5364
5388
|
}>, z.ZodNull]>>;
|
|
5365
5389
|
tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
5366
5390
|
type: z.ZodLiteral<"function">;
|
|
@@ -5671,6 +5695,9 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5671
5695
|
type: "global";
|
|
5672
5696
|
name: string;
|
|
5673
5697
|
function_type: "preprocessor";
|
|
5698
|
+
} | {
|
|
5699
|
+
code: string;
|
|
5700
|
+
type: "inline";
|
|
5674
5701
|
} | null | undefined;
|
|
5675
5702
|
origin?: {
|
|
5676
5703
|
project_id?: string | undefined;
|
|
@@ -5945,6 +5972,9 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
5945
5972
|
type: "global";
|
|
5946
5973
|
name: string;
|
|
5947
5974
|
function_type?: "preprocessor" | undefined;
|
|
5975
|
+
} | {
|
|
5976
|
+
code: string;
|
|
5977
|
+
type: "inline";
|
|
5948
5978
|
} | null | undefined;
|
|
5949
5979
|
origin?: {
|
|
5950
5980
|
project_id?: string | undefined;
|
|
@@ -6236,6 +6266,9 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
6236
6266
|
type: "global";
|
|
6237
6267
|
name: string;
|
|
6238
6268
|
function_type: "preprocessor";
|
|
6269
|
+
} | {
|
|
6270
|
+
code: string;
|
|
6271
|
+
type: "inline";
|
|
6239
6272
|
} | null | undefined;
|
|
6240
6273
|
origin?: {
|
|
6241
6274
|
project_id?: string | undefined;
|
|
@@ -6524,6 +6557,9 @@ declare const Prompt$1: z.ZodObject<{
|
|
|
6524
6557
|
type: "global";
|
|
6525
6558
|
name: string;
|
|
6526
6559
|
function_type?: "preprocessor" | undefined;
|
|
6560
|
+
} | {
|
|
6561
|
+
code: string;
|
|
6562
|
+
type: "inline";
|
|
6527
6563
|
} | null | undefined;
|
|
6528
6564
|
origin?: {
|
|
6529
6565
|
project_id?: string | undefined;
|
|
@@ -6608,7 +6644,6 @@ declare const PromptSessionEvent: z.ZodObject<{
|
|
|
6608
6644
|
type PromptSessionEventType = z.infer<typeof PromptSessionEvent>;
|
|
6609
6645
|
|
|
6610
6646
|
interface GlobalHookAsyncLocalStorage<T> {
|
|
6611
|
-
enterWith(store: T): void;
|
|
6612
6647
|
run<R>(store: T | undefined, callback: () => R): R;
|
|
6613
6648
|
getStore(): T | undefined;
|
|
6614
6649
|
}
|
|
@@ -6881,6 +6916,7 @@ interface InstrumentationIntegrationsConfig {
|
|
|
6881
6916
|
langchain?: boolean;
|
|
6882
6917
|
langgraph?: boolean;
|
|
6883
6918
|
langsmith?: boolean;
|
|
6919
|
+
voyageai?: boolean;
|
|
6884
6920
|
}
|
|
6885
6921
|
interface InstrumentationConfig {
|
|
6886
6922
|
/**
|
|
@@ -6907,6 +6943,7 @@ interface BraintrustPluginConfig {
|
|
|
6907
6943
|
* - Mistral SDK
|
|
6908
6944
|
* - Ollama SDK
|
|
6909
6945
|
* - Cohere SDK
|
|
6946
|
+
* - Voyage AI SDK
|
|
6910
6947
|
*
|
|
6911
6948
|
* The plugin is automatically enabled when the Braintrust library is loaded.
|
|
6912
6949
|
* Individual integrations can be disabled via configuration.
|
|
@@ -6939,6 +6976,7 @@ declare class BraintrustPlugin extends BasePlugin {
|
|
|
6939
6976
|
private langSmithPlugin;
|
|
6940
6977
|
private piCodingAgentPlugin;
|
|
6941
6978
|
private strandsAgentSDKPlugin;
|
|
6979
|
+
private voyageAIPlugin;
|
|
6942
6980
|
private cloudflareAIChatPlugin;
|
|
6943
6981
|
private cloudflareAgentsPlugin;
|
|
6944
6982
|
constructor(config?: BraintrustPluginConfig);
|
|
@@ -7019,16 +7057,108 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
7019
7057
|
token: z.ZodString;
|
|
7020
7058
|
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
7021
7059
|
skip_logging: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
7060
|
+
triggered_functions: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
7061
|
+
triggered_xact_id: z.ZodString;
|
|
7062
|
+
completed_xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
7063
|
+
idempotency_key: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
7064
|
+
attempts: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7065
|
+
scope: z.ZodUnion<[z.ZodObject<{
|
|
7066
|
+
type: z.ZodLiteral<"span">;
|
|
7067
|
+
}, "strip", z.ZodTypeAny, {
|
|
7068
|
+
type: "span";
|
|
7069
|
+
}, {
|
|
7070
|
+
type: "span";
|
|
7071
|
+
}>, z.ZodObject<{
|
|
7072
|
+
type: z.ZodLiteral<"trace">;
|
|
7073
|
+
}, "strip", z.ZodTypeAny, {
|
|
7074
|
+
type: "trace";
|
|
7075
|
+
}, {
|
|
7076
|
+
type: "trace";
|
|
7077
|
+
}>, z.ZodObject<{
|
|
7078
|
+
type: z.ZodLiteral<"group">;
|
|
7079
|
+
key: z.ZodString;
|
|
7080
|
+
value: z.ZodString;
|
|
7081
|
+
}, "strip", z.ZodTypeAny, {
|
|
7082
|
+
value: string;
|
|
7083
|
+
type: "group";
|
|
7084
|
+
key: string;
|
|
7085
|
+
}, {
|
|
7086
|
+
value: string;
|
|
7087
|
+
type: "group";
|
|
7088
|
+
key: string;
|
|
7089
|
+
}>]>;
|
|
7090
|
+
}, "strip", z.ZodTypeAny, {
|
|
7091
|
+
triggered_xact_id: string;
|
|
7092
|
+
attempts: number;
|
|
7093
|
+
scope: {
|
|
7094
|
+
type: "span";
|
|
7095
|
+
} | {
|
|
7096
|
+
type: "trace";
|
|
7097
|
+
} | {
|
|
7098
|
+
value: string;
|
|
7099
|
+
type: "group";
|
|
7100
|
+
key: string;
|
|
7101
|
+
};
|
|
7102
|
+
completed_xact_id?: string | null | undefined;
|
|
7103
|
+
idempotency_key?: string | null | undefined;
|
|
7104
|
+
}, {
|
|
7105
|
+
triggered_xact_id: string;
|
|
7106
|
+
scope: {
|
|
7107
|
+
type: "span";
|
|
7108
|
+
} | {
|
|
7109
|
+
type: "trace";
|
|
7110
|
+
} | {
|
|
7111
|
+
value: string;
|
|
7112
|
+
type: "group";
|
|
7113
|
+
key: string;
|
|
7114
|
+
};
|
|
7115
|
+
completed_xact_id?: string | null | undefined;
|
|
7116
|
+
idempotency_key?: string | null | undefined;
|
|
7117
|
+
attempts?: number | undefined;
|
|
7118
|
+
}>>, z.ZodNull]>>;
|
|
7119
|
+
last_triggered_xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
7022
7120
|
}, "strip", z.ZodTypeAny, {
|
|
7023
7121
|
status: "enabled";
|
|
7024
7122
|
token: string;
|
|
7025
7123
|
function_ids: unknown[];
|
|
7026
7124
|
skip_logging?: boolean | null | undefined;
|
|
7125
|
+
triggered_functions?: Record<string, {
|
|
7126
|
+
triggered_xact_id: string;
|
|
7127
|
+
attempts: number;
|
|
7128
|
+
scope: {
|
|
7129
|
+
type: "span";
|
|
7130
|
+
} | {
|
|
7131
|
+
type: "trace";
|
|
7132
|
+
} | {
|
|
7133
|
+
value: string;
|
|
7134
|
+
type: "group";
|
|
7135
|
+
key: string;
|
|
7136
|
+
};
|
|
7137
|
+
completed_xact_id?: string | null | undefined;
|
|
7138
|
+
idempotency_key?: string | null | undefined;
|
|
7139
|
+
}> | null | undefined;
|
|
7140
|
+
last_triggered_xact_id?: string | number | null | undefined;
|
|
7027
7141
|
}, {
|
|
7028
7142
|
status: "enabled";
|
|
7029
7143
|
token: string;
|
|
7030
7144
|
function_ids: unknown[];
|
|
7031
7145
|
skip_logging?: boolean | null | undefined;
|
|
7146
|
+
triggered_functions?: Record<string, {
|
|
7147
|
+
triggered_xact_id: string;
|
|
7148
|
+
scope: {
|
|
7149
|
+
type: "span";
|
|
7150
|
+
} | {
|
|
7151
|
+
type: "trace";
|
|
7152
|
+
} | {
|
|
7153
|
+
value: string;
|
|
7154
|
+
type: "group";
|
|
7155
|
+
key: string;
|
|
7156
|
+
};
|
|
7157
|
+
completed_xact_id?: string | null | undefined;
|
|
7158
|
+
idempotency_key?: string | null | undefined;
|
|
7159
|
+
attempts?: number | undefined;
|
|
7160
|
+
}> | null | undefined;
|
|
7161
|
+
last_triggered_xact_id?: string | number | null | undefined;
|
|
7032
7162
|
}>, z.ZodObject<{
|
|
7033
7163
|
status: z.ZodLiteral<"disabled">;
|
|
7034
7164
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -7043,6 +7173,22 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
7043
7173
|
token: string;
|
|
7044
7174
|
function_ids: unknown[];
|
|
7045
7175
|
skip_logging?: boolean | null | undefined;
|
|
7176
|
+
triggered_functions?: Record<string, {
|
|
7177
|
+
triggered_xact_id: string;
|
|
7178
|
+
attempts: number;
|
|
7179
|
+
scope: {
|
|
7180
|
+
type: "span";
|
|
7181
|
+
} | {
|
|
7182
|
+
type: "trace";
|
|
7183
|
+
} | {
|
|
7184
|
+
value: string;
|
|
7185
|
+
type: "group";
|
|
7186
|
+
key: string;
|
|
7187
|
+
};
|
|
7188
|
+
completed_xact_id?: string | null | undefined;
|
|
7189
|
+
idempotency_key?: string | null | undefined;
|
|
7190
|
+
}> | null | undefined;
|
|
7191
|
+
last_triggered_xact_id?: string | number | null | undefined;
|
|
7046
7192
|
} | {
|
|
7047
7193
|
status: "disabled";
|
|
7048
7194
|
} | null;
|
|
@@ -7053,6 +7199,22 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
7053
7199
|
token: string;
|
|
7054
7200
|
function_ids: unknown[];
|
|
7055
7201
|
skip_logging?: boolean | null | undefined;
|
|
7202
|
+
triggered_functions?: Record<string, {
|
|
7203
|
+
triggered_xact_id: string;
|
|
7204
|
+
scope: {
|
|
7205
|
+
type: "span";
|
|
7206
|
+
} | {
|
|
7207
|
+
type: "trace";
|
|
7208
|
+
} | {
|
|
7209
|
+
value: string;
|
|
7210
|
+
type: "group";
|
|
7211
|
+
key: string;
|
|
7212
|
+
};
|
|
7213
|
+
completed_xact_id?: string | null | undefined;
|
|
7214
|
+
idempotency_key?: string | null | undefined;
|
|
7215
|
+
attempts?: number | undefined;
|
|
7216
|
+
}> | null | undefined;
|
|
7217
|
+
last_triggered_xact_id?: string | number | null | undefined;
|
|
7056
7218
|
} | {
|
|
7057
7219
|
status: "disabled";
|
|
7058
7220
|
} | null;
|
|
@@ -7069,14 +7231,62 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
7069
7231
|
}, {
|
|
7070
7232
|
kind: "state_enabled_force_rescore";
|
|
7071
7233
|
}>, z.ZodObject<{
|
|
7072
|
-
kind: z.ZodLiteral<"
|
|
7073
|
-
|
|
7234
|
+
kind: z.ZodLiteral<"trigger_functions">;
|
|
7235
|
+
triggered_functions: z.ZodArray<z.ZodObject<{
|
|
7236
|
+
function_id: z.ZodOptional<z.ZodUnknown>;
|
|
7237
|
+
scope: z.ZodUnion<[z.ZodObject<{
|
|
7238
|
+
type: z.ZodLiteral<"span">;
|
|
7239
|
+
}, "strip", z.ZodTypeAny, {
|
|
7240
|
+
type: "span";
|
|
7241
|
+
}, {
|
|
7242
|
+
type: "span";
|
|
7243
|
+
}>, z.ZodObject<{
|
|
7244
|
+
type: z.ZodLiteral<"trace">;
|
|
7245
|
+
}, "strip", z.ZodTypeAny, {
|
|
7246
|
+
type: "trace";
|
|
7247
|
+
}, {
|
|
7248
|
+
type: "trace";
|
|
7249
|
+
}>]>;
|
|
7250
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
7251
|
+
}, "strip", z.ZodTypeAny, {
|
|
7252
|
+
scope: {
|
|
7253
|
+
type: "span";
|
|
7254
|
+
} | {
|
|
7255
|
+
type: "trace";
|
|
7256
|
+
};
|
|
7257
|
+
idempotency_key?: string | undefined;
|
|
7258
|
+
function_id?: unknown;
|
|
7259
|
+
}, {
|
|
7260
|
+
scope: {
|
|
7261
|
+
type: "span";
|
|
7262
|
+
} | {
|
|
7263
|
+
type: "trace";
|
|
7264
|
+
};
|
|
7265
|
+
idempotency_key?: string | undefined;
|
|
7266
|
+
function_id?: unknown;
|
|
7267
|
+
}>, "many">;
|
|
7074
7268
|
}, "strip", z.ZodTypeAny, {
|
|
7075
|
-
kind: "
|
|
7076
|
-
|
|
7269
|
+
kind: "trigger_functions";
|
|
7270
|
+
triggered_functions: {
|
|
7271
|
+
scope: {
|
|
7272
|
+
type: "span";
|
|
7273
|
+
} | {
|
|
7274
|
+
type: "trace";
|
|
7275
|
+
};
|
|
7276
|
+
idempotency_key?: string | undefined;
|
|
7277
|
+
function_id?: unknown;
|
|
7278
|
+
}[];
|
|
7077
7279
|
}, {
|
|
7078
|
-
kind: "
|
|
7079
|
-
|
|
7280
|
+
kind: "trigger_functions";
|
|
7281
|
+
triggered_functions: {
|
|
7282
|
+
scope: {
|
|
7283
|
+
type: "span";
|
|
7284
|
+
} | {
|
|
7285
|
+
type: "trace";
|
|
7286
|
+
};
|
|
7287
|
+
idempotency_key?: string | undefined;
|
|
7288
|
+
function_id?: unknown;
|
|
7289
|
+
}[];
|
|
7080
7290
|
}>, z.ZodObject<{
|
|
7081
7291
|
kind: z.ZodLiteral<"complete_triggered_functions">;
|
|
7082
7292
|
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
@@ -7089,6 +7299,15 @@ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
|
|
|
7089
7299
|
kind: "complete_triggered_functions";
|
|
7090
7300
|
triggered_xact_id: string;
|
|
7091
7301
|
function_ids: unknown[];
|
|
7302
|
+
}>, z.ZodObject<{
|
|
7303
|
+
kind: z.ZodLiteral<"mark_attempt_failed">;
|
|
7304
|
+
function_ids: z.ZodArray<z.ZodUnknown, "many">;
|
|
7305
|
+
}, "strip", z.ZodTypeAny, {
|
|
7306
|
+
kind: "mark_attempt_failed";
|
|
7307
|
+
function_ids: unknown[];
|
|
7308
|
+
}, {
|
|
7309
|
+
kind: "mark_attempt_failed";
|
|
7310
|
+
function_ids: unknown[];
|
|
7092
7311
|
}>]>;
|
|
7093
7312
|
type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
|
|
7094
7313
|
declare const ObjectReference: z.ZodObject<{
|
|
@@ -7526,6 +7745,14 @@ interface PromptKey {
|
|
|
7526
7745
|
*/
|
|
7527
7746
|
id?: string;
|
|
7528
7747
|
}
|
|
7748
|
+
type PromptMemoryCacheEntry = {
|
|
7749
|
+
value: Prompt;
|
|
7750
|
+
resolvedOrgIdentity?: string;
|
|
7751
|
+
};
|
|
7752
|
+
type PromptDiskCacheEntry = {
|
|
7753
|
+
value: ReturnType<Prompt["_internalSerializeForCache"]>;
|
|
7754
|
+
resolvedOrgIdentity?: string;
|
|
7755
|
+
};
|
|
7529
7756
|
/**
|
|
7530
7757
|
* A configurable cache for Braintrust prompts with optional in-memory and filesystem storage.
|
|
7531
7758
|
*
|
|
@@ -7534,10 +7761,19 @@ interface PromptKey {
|
|
|
7534
7761
|
declare class PromptCache {
|
|
7535
7762
|
private readonly memoryCache?;
|
|
7536
7763
|
private readonly diskCache?;
|
|
7764
|
+
private readonly namespace?;
|
|
7765
|
+
private readonly expectedResolvedOrgIdentity?;
|
|
7537
7766
|
constructor(options: {
|
|
7538
|
-
memoryCache?: LRUCache<string,
|
|
7539
|
-
diskCache?: DiskCache<
|
|
7767
|
+
memoryCache?: LRUCache<string, PromptMemoryCacheEntry>;
|
|
7768
|
+
diskCache?: DiskCache<PromptDiskCacheEntry>;
|
|
7769
|
+
namespace?: string;
|
|
7770
|
+
expectedResolvedOrgIdentity?: string;
|
|
7540
7771
|
});
|
|
7772
|
+
/**
|
|
7773
|
+
* Returns a cache view that shares the same storage layers but isolates all
|
|
7774
|
+
* entries under the provided namespace.
|
|
7775
|
+
*/
|
|
7776
|
+
withNamespace(namespace: string, expectedResolvedOrgIdentity?: string): PromptCache;
|
|
7541
7777
|
/**
|
|
7542
7778
|
* Retrieves a prompt from the cache.
|
|
7543
7779
|
* First checks the in-memory LRU cache, then falls back to checking the disk cache if available.
|
|
@@ -7561,13 +7797,26 @@ interface ParametersKey {
|
|
|
7561
7797
|
projectName?: string;
|
|
7562
7798
|
id?: string;
|
|
7563
7799
|
}
|
|
7800
|
+
type ParametersMemoryCacheEntry = {
|
|
7801
|
+
value: RemoteEvalParameters;
|
|
7802
|
+
resolvedOrgIdentity?: string;
|
|
7803
|
+
};
|
|
7804
|
+
type ParametersDiskCacheEntry = {
|
|
7805
|
+
value: ReturnType<RemoteEvalParameters["_internalSerializeForCache"]>;
|
|
7806
|
+
resolvedOrgIdentity?: string;
|
|
7807
|
+
};
|
|
7564
7808
|
declare class ParametersCache {
|
|
7565
7809
|
private readonly memoryCache?;
|
|
7566
7810
|
private readonly diskCache?;
|
|
7811
|
+
private readonly namespace?;
|
|
7812
|
+
private readonly expectedResolvedOrgIdentity?;
|
|
7567
7813
|
constructor(options: {
|
|
7568
|
-
memoryCache?: LRUCache<string,
|
|
7569
|
-
diskCache?: DiskCache<
|
|
7814
|
+
memoryCache?: LRUCache<string, ParametersMemoryCacheEntry>;
|
|
7815
|
+
diskCache?: DiskCache<ParametersDiskCacheEntry>;
|
|
7816
|
+
namespace?: string;
|
|
7817
|
+
expectedResolvedOrgIdentity?: string;
|
|
7570
7818
|
});
|
|
7819
|
+
withNamespace(namespace: string, expectedResolvedOrgIdentity?: string): ParametersCache;
|
|
7571
7820
|
get(key: ParametersKey): Promise<RemoteEvalParameters | undefined>;
|
|
7572
7821
|
set(key: ParametersKey, value: RemoteEvalParameters): Promise<void>;
|
|
7573
7822
|
}
|
|
@@ -8040,8 +8289,17 @@ declare const loginSchema: z.ZodObject<{
|
|
|
8040
8289
|
debugLogLevelDisabled?: boolean | undefined;
|
|
8041
8290
|
}>;
|
|
8042
8291
|
type SerializedBraintrustState = z.infer<typeof loginSchema>;
|
|
8292
|
+
type ResolvedLoaderLoginOptions = Required<Pick<LoginOptions, "apiKey" | "appUrl" | "fetch">> & Pick<LoginOptions, "orgName"> & {
|
|
8293
|
+
forceLogin?: boolean;
|
|
8294
|
+
credentialCacheNamespace: string;
|
|
8295
|
+
existingState?: BraintrustState;
|
|
8296
|
+
};
|
|
8297
|
+
type LoaderCacheViews = {
|
|
8298
|
+
promptCache: PromptCache;
|
|
8299
|
+
parametersCache: ParametersCache;
|
|
8300
|
+
};
|
|
8301
|
+
type LoaderRequestState = Pick<BraintrustState, "appUrl" | "orgId" | "apiConn">;
|
|
8043
8302
|
declare class BraintrustState {
|
|
8044
|
-
private loginParams;
|
|
8045
8303
|
id: string;
|
|
8046
8304
|
currentExperiment: Experiment | undefined;
|
|
8047
8305
|
currentLogger: Logger<false> | undefined;
|
|
@@ -8072,12 +8330,23 @@ declare class BraintrustState {
|
|
|
8072
8330
|
private _otelFlushCallback;
|
|
8073
8331
|
spanOriginEnvironment: SpanOriginEnvironment | undefined;
|
|
8074
8332
|
private traceContextSigningSecret;
|
|
8333
|
+
private loaderLoginCache;
|
|
8334
|
+
private readonly loginParams;
|
|
8335
|
+
private activeLoginOrgNameSelector;
|
|
8075
8336
|
constructor(loginParams: LoginOptions);
|
|
8076
8337
|
/** @internal */
|
|
8077
8338
|
_internalSetTraceContextSigningSecret(secret: string | undefined): void;
|
|
8078
8339
|
/** @internal */
|
|
8079
8340
|
_internalGetTraceContextSigningSecret(): string | undefined;
|
|
8080
8341
|
resetLoginInfo(): void;
|
|
8342
|
+
/** @internal */
|
|
8343
|
+
_internalResolveLoaderLoginOptions({ apiKey, appUrl, orgName, fetch, forceLogin, }: Pick<LoginOptions, "apiKey" | "appUrl" | "orgName" | "fetch"> & {
|
|
8344
|
+
forceLogin?: boolean;
|
|
8345
|
+
}): Promise<ResolvedLoaderLoginOptions>;
|
|
8346
|
+
/** @internal */
|
|
8347
|
+
_internalGetLoaderCacheViews(loginOptions: ResolvedLoaderLoginOptions, requestState?: LoaderRequestState): LoaderCacheViews;
|
|
8348
|
+
/** @internal */
|
|
8349
|
+
_internalGetLoaderState({ apiKey, appUrl, orgName, fetch, forceLogin, existingState, }: ResolvedLoaderLoginOptions): Promise<LoaderRequestState>;
|
|
8081
8350
|
resetIdGenState(): void;
|
|
8082
8351
|
[RESET_CONTEXT_MANAGER_STATE](): void;
|
|
8083
8352
|
get idGenerator(): IDGenerator;
|
|
@@ -8116,11 +8385,12 @@ declare class BraintrustState {
|
|
|
8116
8385
|
toString(): string;
|
|
8117
8386
|
}
|
|
8118
8387
|
declare class HTTPConnection {
|
|
8388
|
+
private readonly classifyTransportErrors;
|
|
8119
8389
|
base_url: string;
|
|
8120
8390
|
token: string | null;
|
|
8121
8391
|
headers: Record<string, string>;
|
|
8122
8392
|
fetch: typeof globalThis.fetch;
|
|
8123
|
-
constructor(base_url: string, fetch: typeof globalThis.fetch);
|
|
8393
|
+
constructor(base_url: string, fetch: typeof globalThis.fetch, classifyTransportErrors?: boolean);
|
|
8124
8394
|
setFetch(fetch: typeof globalThis.fetch): void;
|
|
8125
8395
|
ping(): Promise<boolean>;
|
|
8126
8396
|
make_long_lived(): void;
|
|
@@ -8769,6 +9039,251 @@ declare class Prompt<HasId extends boolean = true, HasVersion extends boolean =
|
|
|
8769
9039
|
}): PromptBlockDataType;
|
|
8770
9040
|
private getParsedPromptData;
|
|
8771
9041
|
static isPrompt(data: unknown): data is Prompt<boolean, boolean>;
|
|
9042
|
+
/** @internal */
|
|
9043
|
+
_internalSerializeForCache(): {
|
|
9044
|
+
metadata: {
|
|
9045
|
+
id: string;
|
|
9046
|
+
created: string;
|
|
9047
|
+
project_id: string;
|
|
9048
|
+
_xact_id: string;
|
|
9049
|
+
prompt_session_id: string;
|
|
9050
|
+
function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
|
|
9051
|
+
tags?: string[] | null | undefined;
|
|
9052
|
+
_pagination_key?: string | null | undefined;
|
|
9053
|
+
completion?: unknown;
|
|
9054
|
+
prompt_data?: unknown;
|
|
9055
|
+
function_data?: unknown;
|
|
9056
|
+
prompt_session_data?: unknown;
|
|
9057
|
+
object_data?: unknown;
|
|
9058
|
+
} | PromptRowWithId<HasId, HasVersion>;
|
|
9059
|
+
defaults: Partial<Omit<z.objectOutputType<{
|
|
9060
|
+
use_cache: z.ZodOptional<z.ZodBoolean>;
|
|
9061
|
+
reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9062
|
+
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
9063
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
9064
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
9065
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
9066
|
+
max_completion_tokens: z.ZodOptional<z.ZodNumber>;
|
|
9067
|
+
frequency_penalty: z.ZodOptional<z.ZodNumber>;
|
|
9068
|
+
presence_penalty: z.ZodOptional<z.ZodNumber>;
|
|
9069
|
+
response_format: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
9070
|
+
type: z.ZodLiteral<"json_object">;
|
|
9071
|
+
}, "strip", z.ZodTypeAny, {
|
|
9072
|
+
type: "json_object";
|
|
9073
|
+
}, {
|
|
9074
|
+
type: "json_object";
|
|
9075
|
+
}>, z.ZodObject<{
|
|
9076
|
+
type: z.ZodLiteral<"json_schema">;
|
|
9077
|
+
json_schema: z.ZodObject<{
|
|
9078
|
+
name: z.ZodString;
|
|
9079
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9080
|
+
schema: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodString]>>;
|
|
9081
|
+
strict: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
9082
|
+
}, "strip", z.ZodTypeAny, {
|
|
9083
|
+
name: string;
|
|
9084
|
+
description?: string | undefined;
|
|
9085
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9086
|
+
strict?: boolean | null | undefined;
|
|
9087
|
+
}, {
|
|
9088
|
+
name: string;
|
|
9089
|
+
description?: string | undefined;
|
|
9090
|
+
schema?: string | z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9091
|
+
strict?: boolean | null | undefined;
|
|
9092
|
+
}>;
|
|
9093
|
+
}, "strip", z.ZodTypeAny, {
|
|
9094
|
+
type: "json_schema";
|
|
9095
|
+
json_schema: {
|
|
9096
|
+
name: string;
|
|
9097
|
+
description?: string | undefined;
|
|
9098
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9099
|
+
strict?: boolean | null | undefined;
|
|
9100
|
+
};
|
|
9101
|
+
}, {
|
|
9102
|
+
type: "json_schema";
|
|
9103
|
+
json_schema: {
|
|
9104
|
+
name: string;
|
|
9105
|
+
description?: string | undefined;
|
|
9106
|
+
schema?: string | z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9107
|
+
strict?: boolean | null | undefined;
|
|
9108
|
+
};
|
|
9109
|
+
}>, z.ZodObject<{
|
|
9110
|
+
type: z.ZodLiteral<"text">;
|
|
9111
|
+
}, "strip", z.ZodTypeAny, {
|
|
9112
|
+
type: "text";
|
|
9113
|
+
}, {
|
|
9114
|
+
type: "text";
|
|
9115
|
+
}>, z.ZodNull]>>;
|
|
9116
|
+
tool_choice: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{
|
|
9117
|
+
type: z.ZodLiteral<"function">;
|
|
9118
|
+
function: z.ZodObject<{
|
|
9119
|
+
name: z.ZodString;
|
|
9120
|
+
}, "strip", z.ZodTypeAny, {
|
|
9121
|
+
name: string;
|
|
9122
|
+
}, {
|
|
9123
|
+
name: string;
|
|
9124
|
+
}>;
|
|
9125
|
+
}, "strip", z.ZodTypeAny, {
|
|
9126
|
+
function: {
|
|
9127
|
+
name: string;
|
|
9128
|
+
};
|
|
9129
|
+
type: "function";
|
|
9130
|
+
}, {
|
|
9131
|
+
function: {
|
|
9132
|
+
name: string;
|
|
9133
|
+
};
|
|
9134
|
+
type: "function";
|
|
9135
|
+
}>]>>;
|
|
9136
|
+
function_call: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodObject<{
|
|
9137
|
+
name: z.ZodString;
|
|
9138
|
+
}, "strip", z.ZodTypeAny, {
|
|
9139
|
+
name: string;
|
|
9140
|
+
}, {
|
|
9141
|
+
name: string;
|
|
9142
|
+
}>]>>;
|
|
9143
|
+
n: z.ZodOptional<z.ZodNumber>;
|
|
9144
|
+
stop: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9145
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high"]>>;
|
|
9146
|
+
verbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
9147
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
9148
|
+
use_cache: z.ZodOptional<z.ZodBoolean>;
|
|
9149
|
+
reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9150
|
+
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
9151
|
+
max_tokens: z.ZodNumber;
|
|
9152
|
+
temperature: z.ZodNumber;
|
|
9153
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
9154
|
+
top_k: z.ZodOptional<z.ZodNumber>;
|
|
9155
|
+
stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9156
|
+
max_tokens_to_sample: z.ZodOptional<z.ZodNumber>;
|
|
9157
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
9158
|
+
use_cache: z.ZodOptional<z.ZodBoolean>;
|
|
9159
|
+
reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9160
|
+
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
9161
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
9162
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
9163
|
+
topP: z.ZodOptional<z.ZodNumber>;
|
|
9164
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
9165
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
9166
|
+
use_cache: z.ZodOptional<z.ZodBoolean>;
|
|
9167
|
+
reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9168
|
+
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
9169
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
9170
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
9171
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
9172
|
+
use_cache: z.ZodOptional<z.ZodBoolean>;
|
|
9173
|
+
reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
9174
|
+
reasoning_budget: z.ZodOptional<z.ZodNumber>;
|
|
9175
|
+
}, z.ZodTypeAny, "passthrough"> | undefined, "response_format" | "reasoning_effort" | "use_cache"> & Omit<{
|
|
9176
|
+
max_tokens: number;
|
|
9177
|
+
temperature?: number | undefined;
|
|
9178
|
+
top_p?: number | undefined;
|
|
9179
|
+
max_completion_tokens?: number | undefined;
|
|
9180
|
+
frequency_penalty?: number | undefined;
|
|
9181
|
+
presence_penalty?: number | undefined;
|
|
9182
|
+
response_format?: {
|
|
9183
|
+
type: "json_object";
|
|
9184
|
+
} | {
|
|
9185
|
+
type: "json_schema";
|
|
9186
|
+
json_schema: {
|
|
9187
|
+
name: string;
|
|
9188
|
+
description?: string | undefined;
|
|
9189
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9190
|
+
strict?: boolean | null | undefined;
|
|
9191
|
+
};
|
|
9192
|
+
} | {
|
|
9193
|
+
type: "text";
|
|
9194
|
+
} | null | undefined;
|
|
9195
|
+
tool_choice?: "auto" | "none" | "required" | {
|
|
9196
|
+
function: {
|
|
9197
|
+
name: string;
|
|
9198
|
+
};
|
|
9199
|
+
type: "function";
|
|
9200
|
+
} | undefined;
|
|
9201
|
+
function_call?: "auto" | "none" | {
|
|
9202
|
+
name: string;
|
|
9203
|
+
} | undefined;
|
|
9204
|
+
n?: number | undefined;
|
|
9205
|
+
stop?: string[] | undefined;
|
|
9206
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
|
|
9207
|
+
verbosity?: "low" | "medium" | "high" | undefined;
|
|
9208
|
+
top_k?: number | undefined;
|
|
9209
|
+
stop_sequences?: string[] | undefined;
|
|
9210
|
+
reasoning_enabled?: boolean | undefined;
|
|
9211
|
+
reasoning_budget?: number | undefined;
|
|
9212
|
+
max_tokens_to_sample?: number | undefined;
|
|
9213
|
+
maxOutputTokens?: number | undefined;
|
|
9214
|
+
topP?: number | undefined;
|
|
9215
|
+
topK?: number | undefined;
|
|
9216
|
+
use_cache?: boolean | undefined;
|
|
9217
|
+
}, "response_format" | "reasoning_effort" | "use_cache"> & {
|
|
9218
|
+
reasoning_effort?: CompiledPromptReasoningEffort;
|
|
9219
|
+
response_format?: {
|
|
9220
|
+
type: "json_object";
|
|
9221
|
+
} | {
|
|
9222
|
+
type: "text";
|
|
9223
|
+
} | (Omit<{
|
|
9224
|
+
type: "json_schema";
|
|
9225
|
+
json_schema: {
|
|
9226
|
+
name: string;
|
|
9227
|
+
description?: string | undefined;
|
|
9228
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9229
|
+
strict?: boolean | null | undefined;
|
|
9230
|
+
};
|
|
9231
|
+
}, "json_schema"> & {
|
|
9232
|
+
json_schema: Omit<{
|
|
9233
|
+
name: string;
|
|
9234
|
+
description?: string | undefined;
|
|
9235
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9236
|
+
strict?: boolean | null | undefined;
|
|
9237
|
+
}, "schema"> & {
|
|
9238
|
+
schema?: Record<string, unknown> | undefined;
|
|
9239
|
+
};
|
|
9240
|
+
}) | undefined;
|
|
9241
|
+
model: string;
|
|
9242
|
+
} & {
|
|
9243
|
+
max_tokens: number;
|
|
9244
|
+
temperature?: number | undefined;
|
|
9245
|
+
top_p?: number | undefined;
|
|
9246
|
+
max_completion_tokens?: number | undefined;
|
|
9247
|
+
frequency_penalty?: number | undefined;
|
|
9248
|
+
presence_penalty?: number | undefined;
|
|
9249
|
+
response_format?: {
|
|
9250
|
+
type: "json_object";
|
|
9251
|
+
} | {
|
|
9252
|
+
type: "json_schema";
|
|
9253
|
+
json_schema: {
|
|
9254
|
+
name: string;
|
|
9255
|
+
description?: string | undefined;
|
|
9256
|
+
schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
9257
|
+
strict?: boolean | null | undefined;
|
|
9258
|
+
};
|
|
9259
|
+
} | {
|
|
9260
|
+
type: "text";
|
|
9261
|
+
} | null | undefined;
|
|
9262
|
+
tool_choice?: "auto" | "none" | "required" | {
|
|
9263
|
+
function: {
|
|
9264
|
+
name: string;
|
|
9265
|
+
};
|
|
9266
|
+
type: "function";
|
|
9267
|
+
} | undefined;
|
|
9268
|
+
function_call?: "auto" | "none" | {
|
|
9269
|
+
name: string;
|
|
9270
|
+
} | undefined;
|
|
9271
|
+
n?: number | undefined;
|
|
9272
|
+
stop?: string[] | undefined;
|
|
9273
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
|
|
9274
|
+
verbosity?: "low" | "medium" | "high" | undefined;
|
|
9275
|
+
top_k?: number | undefined;
|
|
9276
|
+
stop_sequences?: string[] | undefined;
|
|
9277
|
+
reasoning_enabled?: boolean | undefined;
|
|
9278
|
+
reasoning_budget?: number | undefined;
|
|
9279
|
+
max_tokens_to_sample?: number | undefined;
|
|
9280
|
+
maxOutputTokens?: number | undefined;
|
|
9281
|
+
topP?: number | undefined;
|
|
9282
|
+
topK?: number | undefined;
|
|
9283
|
+
use_cache?: boolean | undefined;
|
|
9284
|
+
} & ChatPrompt & CompletionPrompt>;
|
|
9285
|
+
noTrace: boolean;
|
|
9286
|
+
};
|
|
8772
9287
|
static fromPromptData(name: string, promptData: PromptDataType): Prompt<false, false>;
|
|
8773
9288
|
}
|
|
8774
9289
|
declare class RemoteEvalParameters<HasId extends boolean = true, HasVersion extends boolean = true, T extends Record<string, unknown> = Record<string, unknown>> {
|
|
@@ -8782,6 +9297,24 @@ declare class RemoteEvalParameters<HasId extends boolean = true, HasVersion exte
|
|
|
8782
9297
|
get version(): HasVersion extends true ? TransactionId : TransactionId | undefined;
|
|
8783
9298
|
get schema(): Record<string, unknown>;
|
|
8784
9299
|
get data(): T;
|
|
9300
|
+
/** @internal */
|
|
9301
|
+
_internalSerializeForCache(): {
|
|
9302
|
+
metadata: {
|
|
9303
|
+
id: string;
|
|
9304
|
+
project_id: string;
|
|
9305
|
+
name: string;
|
|
9306
|
+
slug: string;
|
|
9307
|
+
function_type: "parameters";
|
|
9308
|
+
_xact_id: string;
|
|
9309
|
+
function_data: {
|
|
9310
|
+
type: "parameters";
|
|
9311
|
+
__schema: Record<string, unknown>;
|
|
9312
|
+
data?: Record<string, unknown> | undefined;
|
|
9313
|
+
};
|
|
9314
|
+
description?: string | null | undefined;
|
|
9315
|
+
metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
9316
|
+
};
|
|
9317
|
+
};
|
|
8785
9318
|
validate(data: unknown): boolean;
|
|
8786
9319
|
static isParameters(x: unknown): x is RemoteEvalParameters<boolean, boolean, Record<string, unknown>>;
|
|
8787
9320
|
}
|
|
@@ -9458,7 +9991,7 @@ type EveModelMessage = EveSystemModelMessage | {
|
|
|
9458
9991
|
readonly role: "tool";
|
|
9459
9992
|
};
|
|
9460
9993
|
interface EveInstrumentationModelInput {
|
|
9461
|
-
readonly instructions?: string | readonly EveSystemModelMessage[];
|
|
9994
|
+
readonly instructions?: string | EveSystemModelMessage | readonly EveSystemModelMessage[];
|
|
9462
9995
|
readonly messages: readonly EveModelMessage[];
|
|
9463
9996
|
}
|
|
9464
9997
|
interface EveInstrumentationStepStartedEventInput {
|
|
@@ -9487,6 +10020,183 @@ interface EveInstrumentationDefinition {
|
|
|
9487
10020
|
readonly recordOutputs?: boolean;
|
|
9488
10021
|
readonly setup?: (context: EveInstrumentationSetupContext) => void;
|
|
9489
10022
|
}
|
|
10023
|
+
/**
|
|
10024
|
+
* Vendored types for Eve's instrumentation-provider API, introduced in
|
|
10025
|
+
* eve@0.34.0. Keep this limited to lifecycle events consumed by Braintrust.
|
|
10026
|
+
*/
|
|
10027
|
+
interface EveProviderSetupContext {
|
|
10028
|
+
readonly agentName: string;
|
|
10029
|
+
readonly environment?: "development" | "preview" | "production";
|
|
10030
|
+
readonly evaluation?: {
|
|
10031
|
+
readonly runId: string;
|
|
10032
|
+
};
|
|
10033
|
+
readonly frameworkVersion?: string;
|
|
10034
|
+
}
|
|
10035
|
+
interface EveProviderState {
|
|
10036
|
+
get(): EveJsonValue | undefined;
|
|
10037
|
+
set(value: EveJsonValue | undefined): void;
|
|
10038
|
+
}
|
|
10039
|
+
interface EveProviderContext {
|
|
10040
|
+
readonly state: EveProviderState;
|
|
10041
|
+
}
|
|
10042
|
+
interface EveInstrumentationAttemptScope {
|
|
10043
|
+
readonly attemptId: string;
|
|
10044
|
+
readonly attemptIndex: number;
|
|
10045
|
+
readonly functionId?: string;
|
|
10046
|
+
readonly rootSessionId?: string;
|
|
10047
|
+
readonly sessionId: string;
|
|
10048
|
+
readonly stepIndex: number;
|
|
10049
|
+
readonly turnId: string;
|
|
10050
|
+
}
|
|
10051
|
+
interface EveInstrumentationParentLineage {
|
|
10052
|
+
readonly callId: string;
|
|
10053
|
+
readonly sessionId: string;
|
|
10054
|
+
readonly subagentName?: string;
|
|
10055
|
+
readonly turnId: string;
|
|
10056
|
+
}
|
|
10057
|
+
interface EveInstrumentationTraceContext {
|
|
10058
|
+
readonly isRemote?: boolean;
|
|
10059
|
+
readonly spanId: string;
|
|
10060
|
+
readonly traceFlags: number;
|
|
10061
|
+
readonly traceId: string;
|
|
10062
|
+
}
|
|
10063
|
+
interface EveProviderTurnStartedEvent {
|
|
10064
|
+
readonly idempotencyKey: string;
|
|
10065
|
+
readonly parentLineage?: EveInstrumentationParentLineage;
|
|
10066
|
+
readonly parentTraceContext?: EveInstrumentationTraceContext;
|
|
10067
|
+
readonly rootSessionId: string;
|
|
10068
|
+
readonly sequence: number;
|
|
10069
|
+
readonly sessionId: string;
|
|
10070
|
+
readonly turnId: string;
|
|
10071
|
+
readonly type: "turn.started";
|
|
10072
|
+
}
|
|
10073
|
+
type EveProviderTurnTerminalEvent = {
|
|
10074
|
+
readonly idempotencyKey: string;
|
|
10075
|
+
readonly sessionId: string;
|
|
10076
|
+
readonly turnId: string;
|
|
10077
|
+
readonly type: "turn.cancelled" | "turn.completed";
|
|
10078
|
+
} | {
|
|
10079
|
+
readonly error?: unknown;
|
|
10080
|
+
readonly idempotencyKey: string;
|
|
10081
|
+
readonly sessionId: string;
|
|
10082
|
+
readonly turnId: string;
|
|
10083
|
+
readonly type: "turn.failed";
|
|
10084
|
+
};
|
|
10085
|
+
interface EveProviderModelCallStartedEvent {
|
|
10086
|
+
readonly idempotencyKey: string;
|
|
10087
|
+
readonly input?: EveInstrumentationModelInput;
|
|
10088
|
+
readonly model: {
|
|
10089
|
+
readonly modelId: string;
|
|
10090
|
+
readonly provider: string;
|
|
10091
|
+
};
|
|
10092
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10093
|
+
readonly type: "model.call.started";
|
|
10094
|
+
}
|
|
10095
|
+
type EveProviderContentPart = {
|
|
10096
|
+
readonly text: string;
|
|
10097
|
+
readonly type: "text";
|
|
10098
|
+
} | {
|
|
10099
|
+
readonly text: string;
|
|
10100
|
+
readonly type: "reasoning";
|
|
10101
|
+
} | {
|
|
10102
|
+
readonly callId: string;
|
|
10103
|
+
readonly input: unknown;
|
|
10104
|
+
readonly toolName: string;
|
|
10105
|
+
readonly type: "tool-call";
|
|
10106
|
+
} | {
|
|
10107
|
+
readonly callId: string;
|
|
10108
|
+
readonly input: unknown;
|
|
10109
|
+
readonly output: unknown;
|
|
10110
|
+
readonly toolName: string;
|
|
10111
|
+
readonly type: "tool-result";
|
|
10112
|
+
} | {
|
|
10113
|
+
readonly callId: string;
|
|
10114
|
+
readonly error: unknown;
|
|
10115
|
+
readonly input: unknown;
|
|
10116
|
+
readonly toolName: string;
|
|
10117
|
+
readonly type: "tool-error";
|
|
10118
|
+
};
|
|
10119
|
+
interface EveProviderUsage {
|
|
10120
|
+
readonly inputTokenDetails?: {
|
|
10121
|
+
readonly cacheReadTokens?: number;
|
|
10122
|
+
readonly cacheWriteTokens?: number;
|
|
10123
|
+
};
|
|
10124
|
+
readonly inputTokens?: number;
|
|
10125
|
+
readonly outputTokens?: number;
|
|
10126
|
+
}
|
|
10127
|
+
type EveProviderModelCallTerminalEvent = {
|
|
10128
|
+
readonly content?: readonly EveProviderContentPart[];
|
|
10129
|
+
readonly finishReason: string;
|
|
10130
|
+
readonly idempotencyKey: string;
|
|
10131
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10132
|
+
readonly type: "model.call.completed";
|
|
10133
|
+
readonly usage: EveProviderUsage;
|
|
10134
|
+
} | {
|
|
10135
|
+
readonly error?: unknown;
|
|
10136
|
+
readonly idempotencyKey: string;
|
|
10137
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10138
|
+
readonly type: "model.call.failed";
|
|
10139
|
+
};
|
|
10140
|
+
type EveProviderActionKind = "load-skill" | "remote-agent-call" | "subagent-call" | "tool-call";
|
|
10141
|
+
interface EveProviderActionStartedEvent {
|
|
10142
|
+
readonly callId: string;
|
|
10143
|
+
readonly idempotencyKey: string;
|
|
10144
|
+
readonly input?: unknown;
|
|
10145
|
+
readonly kind: EveProviderActionKind;
|
|
10146
|
+
readonly name: string;
|
|
10147
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10148
|
+
readonly type: "action.started";
|
|
10149
|
+
}
|
|
10150
|
+
type EveProviderActionTerminalEvent = {
|
|
10151
|
+
readonly acceptedAtMs?: number;
|
|
10152
|
+
readonly idempotencyKey: string;
|
|
10153
|
+
readonly outcome: "completed";
|
|
10154
|
+
readonly output: {
|
|
10155
|
+
readonly output?: unknown;
|
|
10156
|
+
readonly type: "result";
|
|
10157
|
+
} | {
|
|
10158
|
+
readonly error?: unknown;
|
|
10159
|
+
readonly type: "error";
|
|
10160
|
+
};
|
|
10161
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10162
|
+
readonly type: "action.completed";
|
|
10163
|
+
readonly usage?: EveProviderUsage;
|
|
10164
|
+
} | {
|
|
10165
|
+
readonly acceptedAtMs?: number;
|
|
10166
|
+
readonly error?: unknown;
|
|
10167
|
+
readonly errorCode?: string;
|
|
10168
|
+
readonly idempotencyKey: string;
|
|
10169
|
+
readonly outcome: "abandoned" | "cancelled" | "failed" | "rejected";
|
|
10170
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10171
|
+
readonly type: "action.failed";
|
|
10172
|
+
};
|
|
10173
|
+
type EveProviderStepAttemptTerminalEvent = {
|
|
10174
|
+
readonly error?: unknown;
|
|
10175
|
+
readonly idempotencyKey: string;
|
|
10176
|
+
readonly scope: EveInstrumentationAttemptScope;
|
|
10177
|
+
readonly type: "step.attempt.completed" | "step.attempt.failed";
|
|
10178
|
+
};
|
|
10179
|
+
type EveProviderHandler<TEvent> = (event: TEvent, context: EveProviderContext) => void | PromiseLike<void>;
|
|
10180
|
+
interface EveProviderDefinition {
|
|
10181
|
+
readonly capture?: "content" | "metadata";
|
|
10182
|
+
readonly events?: {
|
|
10183
|
+
readonly "action.completed"?: EveProviderHandler<EveProviderActionTerminalEvent>;
|
|
10184
|
+
readonly "action.failed"?: EveProviderHandler<EveProviderActionTerminalEvent>;
|
|
10185
|
+
readonly "action.started"?: EveProviderHandler<EveProviderActionStartedEvent>;
|
|
10186
|
+
readonly "model.call.completed"?: EveProviderHandler<EveProviderModelCallTerminalEvent>;
|
|
10187
|
+
readonly "model.call.failed"?: EveProviderHandler<EveProviderModelCallTerminalEvent>;
|
|
10188
|
+
readonly "model.call.started"?: EveProviderHandler<EveProviderModelCallStartedEvent>;
|
|
10189
|
+
readonly "step.attempt.completed"?: EveProviderHandler<EveProviderStepAttemptTerminalEvent>;
|
|
10190
|
+
readonly "step.attempt.failed"?: EveProviderHandler<EveProviderStepAttemptTerminalEvent>;
|
|
10191
|
+
readonly "turn.cancelled"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
|
|
10192
|
+
readonly "turn.completed"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
|
|
10193
|
+
readonly "turn.failed"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
|
|
10194
|
+
readonly "turn.started"?: EveProviderHandler<EveProviderTurnStartedEvent>;
|
|
10195
|
+
};
|
|
10196
|
+
readonly flush?: () => void | PromiseLike<void>;
|
|
10197
|
+
readonly setup?: (context: EveProviderSetupContext) => void | PromiseLike<void>;
|
|
10198
|
+
readonly shutdown?: () => void | PromiseLike<void>;
|
|
10199
|
+
}
|
|
9490
10200
|
|
|
9491
10201
|
type EveStateHandle<T> = {
|
|
9492
10202
|
get(): T;
|
|
@@ -9498,7 +10208,20 @@ declare function braintrustEveHook(options: {
|
|
|
9498
10208
|
defineState: EveDefineState;
|
|
9499
10209
|
metadata?: Record<string, unknown>;
|
|
9500
10210
|
}): EveHookDefinition;
|
|
9501
|
-
|
|
10211
|
+
|
|
10212
|
+
type EveProviderInstrumentationOptions = {
|
|
10213
|
+
metadata?: Record<string, unknown>;
|
|
10214
|
+
setup?: EveProviderDefinition["setup"];
|
|
10215
|
+
};
|
|
10216
|
+
/**
|
|
10217
|
+
* Braintrust instrumentation for Eve.
|
|
10218
|
+
*
|
|
10219
|
+
* Pass `defineState` when using Eve's legacy authored instrumentation API.
|
|
10220
|
+
* With Eve 0.34+, omit `defineState` to use the instrumentation-provider
|
|
10221
|
+
* lifecycle and enable `experimental.instrumentationProviders` on the agent.
|
|
10222
|
+
* The result is ready to export directly from the instrumentation module.
|
|
10223
|
+
*/
|
|
10224
|
+
declare function braintrustEveInstrumentation(options: EveProviderInstrumentationOptions): EveProviderDefinition;
|
|
9502
10225
|
declare function braintrustEveInstrumentation(options: {
|
|
9503
10226
|
defineState: EveDefineState;
|
|
9504
10227
|
setup?: EveInstrumentationDefinition["setup"];
|