braintrust 3.23.0 → 3.23.1
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.js +0 -2
- package/dev/dist/index.mjs +0 -2
- package/dist/browser.js +0 -2
- package/dist/browser.mjs +0 -2
- package/dist/{chunk-FZWPFCVE.js → chunk-B6ZQIAK3.js} +0 -2
- package/dist/{chunk-IXL4PMY4.mjs → chunk-RBXD2KYN.mjs} +0 -2
- package/dist/cli.js +1 -3
- package/dist/edge-light.js +0 -2
- package/dist/edge-light.mjs +0 -2
- package/dist/index.js +267 -267
- package/dist/index.mjs +1 -1
- package/dist/instrumentation/index.js +0 -2
- package/dist/instrumentation/index.mjs +0 -2
- package/dist/vitest-evals-reporter.js +15 -15
- package/dist/vitest-evals-reporter.mjs +1 -1
- package/dist/workerd.js +0 -2
- package/dist/workerd.mjs +0 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
var
|
|
142
|
+
var _chunkB6ZQIAK3js = require('./chunk-B6ZQIAK3.js');
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
@@ -168,146 +168,146 @@ var _chunkCDIKAHDZjs = require('./chunk-CDIKAHDZ.js');
|
|
|
168
168
|
// src/exports.ts
|
|
169
169
|
var exports_exports = {};
|
|
170
170
|
_chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
171
|
-
Attachment: () =>
|
|
172
|
-
AttachmentReference: () =>
|
|
173
|
-
BAGGAGE_HEADER: () =>
|
|
174
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
175
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
176
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
177
|
-
BaseAttachment: () =>
|
|
171
|
+
Attachment: () => _chunkB6ZQIAK3js.Attachment,
|
|
172
|
+
AttachmentReference: () => _chunkB6ZQIAK3js.AttachmentReference,
|
|
173
|
+
BAGGAGE_HEADER: () => _chunkB6ZQIAK3js.BAGGAGE_HEADER,
|
|
174
|
+
BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkB6ZQIAK3js.BRAINTRUST_CURRENT_SPAN_STORE,
|
|
175
|
+
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkB6ZQIAK3js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
|
|
176
|
+
BRAINTRUST_PARENT_KEY: () => _chunkB6ZQIAK3js.BRAINTRUST_PARENT_KEY,
|
|
177
|
+
BaseAttachment: () => _chunkB6ZQIAK3js.BaseAttachment,
|
|
178
178
|
BaseExperiment: () => BaseExperiment,
|
|
179
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
179
|
+
BraintrustLangChainCallbackHandler: () => _chunkB6ZQIAK3js.BraintrustLangChainCallbackHandler,
|
|
180
180
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
181
|
-
BraintrustObservabilityExporter: () =>
|
|
182
|
-
BraintrustState: () =>
|
|
183
|
-
BraintrustStream: () =>
|
|
181
|
+
BraintrustObservabilityExporter: () => _chunkB6ZQIAK3js.BraintrustObservabilityExporter,
|
|
182
|
+
BraintrustState: () => _chunkB6ZQIAK3js.BraintrustState,
|
|
183
|
+
BraintrustStream: () => _chunkB6ZQIAK3js.BraintrustStream,
|
|
184
184
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
185
185
|
CodeFunction: () => CodeFunction,
|
|
186
186
|
CodePrompt: () => CodePrompt,
|
|
187
|
-
ContextManager: () =>
|
|
188
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
189
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
190
|
-
Dataset: () =>
|
|
187
|
+
ContextManager: () => _chunkB6ZQIAK3js.ContextManager,
|
|
188
|
+
DEFAULT_FETCH_BATCH_SIZE: () => _chunkB6ZQIAK3js.DEFAULT_FETCH_BATCH_SIZE,
|
|
189
|
+
DEFAULT_MAX_REQUEST_SIZE: () => _chunkB6ZQIAK3js.DEFAULT_MAX_REQUEST_SIZE,
|
|
190
|
+
Dataset: () => _chunkB6ZQIAK3js.Dataset,
|
|
191
191
|
DatasetPipeline: () => DatasetPipeline,
|
|
192
|
-
ERR_PERMALINK: () =>
|
|
192
|
+
ERR_PERMALINK: () => _chunkB6ZQIAK3js.ERR_PERMALINK,
|
|
193
193
|
Eval: () => Eval,
|
|
194
194
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
195
|
-
Experiment: () =>
|
|
196
|
-
ExternalAttachment: () =>
|
|
197
|
-
FailedHTTPResponse: () =>
|
|
198
|
-
IDGenerator: () =>
|
|
199
|
-
JSONAttachment: () =>
|
|
200
|
-
LEGACY_CACHED_HEADER: () =>
|
|
201
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
202
|
-
LazyValue: () =>
|
|
195
|
+
Experiment: () => _chunkB6ZQIAK3js.Experiment,
|
|
196
|
+
ExternalAttachment: () => _chunkB6ZQIAK3js.ExternalAttachment,
|
|
197
|
+
FailedHTTPResponse: () => _chunkB6ZQIAK3js.FailedHTTPResponse,
|
|
198
|
+
IDGenerator: () => _chunkB6ZQIAK3js.IDGenerator,
|
|
199
|
+
JSONAttachment: () => _chunkB6ZQIAK3js.JSONAttachment,
|
|
200
|
+
LEGACY_CACHED_HEADER: () => _chunkB6ZQIAK3js.LEGACY_CACHED_HEADER,
|
|
201
|
+
LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkB6ZQIAK3js.LOGS3_OVERFLOW_REFERENCE_TYPE,
|
|
202
|
+
LazyValue: () => _chunkB6ZQIAK3js.LazyValue,
|
|
203
203
|
LocalTrace: () => LocalTrace,
|
|
204
|
-
Logger: () =>
|
|
205
|
-
LoginInvalidOrgError: () =>
|
|
206
|
-
NOOP_SPAN: () =>
|
|
207
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
208
|
-
NoopSpan: () =>
|
|
209
|
-
OTELIDGenerator: () =>
|
|
210
|
-
ObjectFetcher: () =>
|
|
204
|
+
Logger: () => _chunkB6ZQIAK3js.Logger,
|
|
205
|
+
LoginInvalidOrgError: () => _chunkB6ZQIAK3js.LoginInvalidOrgError,
|
|
206
|
+
NOOP_SPAN: () => _chunkB6ZQIAK3js.NOOP_SPAN,
|
|
207
|
+
NOOP_SPAN_PERMALINK: () => _chunkB6ZQIAK3js.NOOP_SPAN_PERMALINK,
|
|
208
|
+
NoopSpan: () => _chunkB6ZQIAK3js.NoopSpan,
|
|
209
|
+
OTELIDGenerator: () => _chunkB6ZQIAK3js.OTELIDGenerator,
|
|
210
|
+
ObjectFetcher: () => _chunkB6ZQIAK3js.ObjectFetcher,
|
|
211
211
|
Project: () => Project2,
|
|
212
212
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
213
|
-
Prompt: () =>
|
|
213
|
+
Prompt: () => _chunkB6ZQIAK3js.Prompt,
|
|
214
214
|
PromptBuilder: () => PromptBuilder,
|
|
215
|
-
ReadonlyAttachment: () =>
|
|
216
|
-
ReadonlyExperiment: () =>
|
|
215
|
+
ReadonlyAttachment: () => _chunkB6ZQIAK3js.ReadonlyAttachment,
|
|
216
|
+
ReadonlyExperiment: () => _chunkB6ZQIAK3js.ReadonlyExperiment,
|
|
217
217
|
Reporter: () => Reporter,
|
|
218
218
|
ScorerBuilder: () => ScorerBuilder,
|
|
219
219
|
SpanFetcher: () => SpanFetcher,
|
|
220
|
-
SpanImpl: () =>
|
|
221
|
-
TRACEPARENT_HEADER: () =>
|
|
222
|
-
TRACESTATE_HEADER: () =>
|
|
223
|
-
TestBackgroundLogger: () =>
|
|
220
|
+
SpanImpl: () => _chunkB6ZQIAK3js.SpanImpl,
|
|
221
|
+
TRACEPARENT_HEADER: () => _chunkB6ZQIAK3js.TRACEPARENT_HEADER,
|
|
222
|
+
TRACESTATE_HEADER: () => _chunkB6ZQIAK3js.TRACESTATE_HEADER,
|
|
223
|
+
TestBackgroundLogger: () => _chunkB6ZQIAK3js.TestBackgroundLogger,
|
|
224
224
|
ToolBuilder: () => ToolBuilder,
|
|
225
|
-
UUIDGenerator: () =>
|
|
226
|
-
X_CACHED_HEADER: () =>
|
|
227
|
-
_exportsForTestingOnly: () =>
|
|
228
|
-
_internalGetGlobalState: () =>
|
|
225
|
+
UUIDGenerator: () => _chunkB6ZQIAK3js.UUIDGenerator,
|
|
226
|
+
X_CACHED_HEADER: () => _chunkB6ZQIAK3js.X_CACHED_HEADER,
|
|
227
|
+
_exportsForTestingOnly: () => _chunkB6ZQIAK3js._exportsForTestingOnly,
|
|
228
|
+
_internalGetGlobalState: () => _chunkB6ZQIAK3js._internalGetGlobalState,
|
|
229
229
|
_internalIso: () => _chunkCDIKAHDZjs.isomorph_default,
|
|
230
|
-
_internalSetInitialState: () =>
|
|
231
|
-
addAzureBlobHeaders: () =>
|
|
230
|
+
_internalSetInitialState: () => _chunkB6ZQIAK3js._internalSetInitialState,
|
|
231
|
+
addAzureBlobHeaders: () => _chunkB6ZQIAK3js.addAzureBlobHeaders,
|
|
232
232
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
233
|
-
braintrustAISDKTelemetry: () =>
|
|
233
|
+
braintrustAISDKTelemetry: () => _chunkB6ZQIAK3js.braintrustAISDKTelemetry,
|
|
234
234
|
braintrustEveHook: () => braintrustEveHook,
|
|
235
235
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
236
|
-
braintrustFlueInstrumentation: () =>
|
|
237
|
-
braintrustFlueObserver: () =>
|
|
238
|
-
braintrustStreamChunkSchema: () =>
|
|
236
|
+
braintrustFlueInstrumentation: () => _chunkB6ZQIAK3js.braintrustFlueInstrumentation,
|
|
237
|
+
braintrustFlueObserver: () => _chunkB6ZQIAK3js.braintrustFlueObserver,
|
|
238
|
+
braintrustStreamChunkSchema: () => _chunkB6ZQIAK3js.braintrustStreamChunkSchema,
|
|
239
239
|
buildLocalSummary: () => buildLocalSummary,
|
|
240
|
-
configureInstrumentation: () =>
|
|
241
|
-
constructLogs3OverflowRequest: () =>
|
|
242
|
-
createFinalValuePassThroughStream: () =>
|
|
243
|
-
currentExperiment: () =>
|
|
244
|
-
currentLogger: () =>
|
|
245
|
-
currentSpan: () =>
|
|
246
|
-
deepCopyEvent: () =>
|
|
240
|
+
configureInstrumentation: () => _chunkB6ZQIAK3js.configureInstrumentation,
|
|
241
|
+
constructLogs3OverflowRequest: () => _chunkB6ZQIAK3js.constructLogs3OverflowRequest,
|
|
242
|
+
createFinalValuePassThroughStream: () => _chunkB6ZQIAK3js.createFinalValuePassThroughStream,
|
|
243
|
+
currentExperiment: () => _chunkB6ZQIAK3js.currentExperiment,
|
|
244
|
+
currentLogger: () => _chunkB6ZQIAK3js.currentLogger,
|
|
245
|
+
currentSpan: () => _chunkB6ZQIAK3js.currentSpan,
|
|
246
|
+
deepCopyEvent: () => _chunkB6ZQIAK3js.deepCopyEvent,
|
|
247
247
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
248
|
-
deserializePlainStringAsJSON: () =>
|
|
249
|
-
devNullWritableStream: () =>
|
|
248
|
+
deserializePlainStringAsJSON: () => _chunkB6ZQIAK3js.deserializePlainStringAsJSON,
|
|
249
|
+
devNullWritableStream: () => _chunkB6ZQIAK3js.devNullWritableStream,
|
|
250
250
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
251
251
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
252
|
-
extractTraceContextFromHeaders: () =>
|
|
253
|
-
flush: () =>
|
|
254
|
-
getContextManager: () =>
|
|
255
|
-
getIdGenerator: () =>
|
|
256
|
-
getPromptVersions: () =>
|
|
257
|
-
getSpanParentObject: () =>
|
|
258
|
-
getTemplateRenderer: () =>
|
|
252
|
+
extractTraceContextFromHeaders: () => _chunkB6ZQIAK3js.extractTraceContextFromHeaders,
|
|
253
|
+
flush: () => _chunkB6ZQIAK3js.flush,
|
|
254
|
+
getContextManager: () => _chunkB6ZQIAK3js.getContextManager,
|
|
255
|
+
getIdGenerator: () => _chunkB6ZQIAK3js.getIdGenerator,
|
|
256
|
+
getPromptVersions: () => _chunkB6ZQIAK3js.getPromptVersions,
|
|
257
|
+
getSpanParentObject: () => _chunkB6ZQIAK3js.getSpanParentObject,
|
|
258
|
+
getTemplateRenderer: () => _chunkB6ZQIAK3js.getTemplateRenderer,
|
|
259
259
|
graph: () => graph_framework_exports,
|
|
260
|
-
init: () =>
|
|
261
|
-
initDataset: () =>
|
|
262
|
-
initExperiment: () =>
|
|
260
|
+
init: () => _chunkB6ZQIAK3js.init,
|
|
261
|
+
initDataset: () => _chunkB6ZQIAK3js.initDataset,
|
|
262
|
+
initExperiment: () => _chunkB6ZQIAK3js.initExperiment,
|
|
263
263
|
initFunction: () => initFunction,
|
|
264
|
-
initLogger: () =>
|
|
264
|
+
initLogger: () => _chunkB6ZQIAK3js.initLogger,
|
|
265
265
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
266
|
-
injectTraceContext: () =>
|
|
266
|
+
injectTraceContext: () => _chunkB6ZQIAK3js.injectTraceContext,
|
|
267
267
|
invoke: () => invoke,
|
|
268
|
-
isTemplateFormat: () =>
|
|
269
|
-
loadParameters: () =>
|
|
270
|
-
loadPrompt: () =>
|
|
271
|
-
log: () =>
|
|
272
|
-
logError: () =>
|
|
273
|
-
login: () =>
|
|
274
|
-
loginToState: () =>
|
|
275
|
-
logs3OverflowUploadSchema: () =>
|
|
276
|
-
newId: () =>
|
|
277
|
-
parseCachedHeader: () =>
|
|
278
|
-
parseTemplateFormat: () =>
|
|
279
|
-
permalink: () =>
|
|
280
|
-
pickLogs3OverflowObjectIds: () =>
|
|
268
|
+
isTemplateFormat: () => _chunkB6ZQIAK3js.isTemplateFormat,
|
|
269
|
+
loadParameters: () => _chunkB6ZQIAK3js.loadParameters,
|
|
270
|
+
loadPrompt: () => _chunkB6ZQIAK3js.loadPrompt,
|
|
271
|
+
log: () => _chunkB6ZQIAK3js.log,
|
|
272
|
+
logError: () => _chunkB6ZQIAK3js.logError,
|
|
273
|
+
login: () => _chunkB6ZQIAK3js.login,
|
|
274
|
+
loginToState: () => _chunkB6ZQIAK3js.loginToState,
|
|
275
|
+
logs3OverflowUploadSchema: () => _chunkB6ZQIAK3js.logs3OverflowUploadSchema,
|
|
276
|
+
newId: () => _chunkB6ZQIAK3js.newId,
|
|
277
|
+
parseCachedHeader: () => _chunkB6ZQIAK3js.parseCachedHeader,
|
|
278
|
+
parseTemplateFormat: () => _chunkB6ZQIAK3js.parseTemplateFormat,
|
|
279
|
+
permalink: () => _chunkB6ZQIAK3js.permalink,
|
|
280
|
+
pickLogs3OverflowObjectIds: () => _chunkB6ZQIAK3js.pickLogs3OverflowObjectIds,
|
|
281
281
|
projects: () => projects,
|
|
282
282
|
promptContentsSchema: () => promptContentsSchema,
|
|
283
283
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
284
284
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
285
285
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
286
|
-
registerOtelFlush: () =>
|
|
286
|
+
registerOtelFlush: () => _chunkB6ZQIAK3js.registerOtelFlush,
|
|
287
287
|
registerSandbox: () => registerSandbox,
|
|
288
|
-
registerTemplatePlugin: () =>
|
|
289
|
-
renderMessage: () =>
|
|
290
|
-
renderPromptParams: () =>
|
|
291
|
-
renderTemplateContent: () =>
|
|
288
|
+
registerTemplatePlugin: () => _chunkB6ZQIAK3js.registerTemplatePlugin,
|
|
289
|
+
renderMessage: () => _chunkB6ZQIAK3js.renderMessage,
|
|
290
|
+
renderPromptParams: () => _chunkB6ZQIAK3js.renderPromptParams,
|
|
291
|
+
renderTemplateContent: () => _chunkB6ZQIAK3js.renderTemplateContent,
|
|
292
292
|
reportFailures: () => reportFailures,
|
|
293
293
|
runEvaluator: () => runEvaluator,
|
|
294
|
-
setFetch: () =>
|
|
295
|
-
setMaskingFunction: () =>
|
|
296
|
-
spanComponentsToObjectId: () =>
|
|
297
|
-
startSpan: () =>
|
|
298
|
-
summarize: () =>
|
|
299
|
-
templateRegistry: () =>
|
|
300
|
-
toolFunctionDefinitionSchema: () =>
|
|
301
|
-
traceable: () =>
|
|
302
|
-
traced: () =>
|
|
303
|
-
updateSpan: () =>
|
|
304
|
-
uploadLogs3OverflowPayload: () =>
|
|
305
|
-
utf8ByteLength: () =>
|
|
306
|
-
withCurrent: () =>
|
|
307
|
-
withDataset: () =>
|
|
308
|
-
withExperiment: () =>
|
|
309
|
-
withLogger: () =>
|
|
310
|
-
withParent: () =>
|
|
294
|
+
setFetch: () => _chunkB6ZQIAK3js.setFetch,
|
|
295
|
+
setMaskingFunction: () => _chunkB6ZQIAK3js.setMaskingFunction,
|
|
296
|
+
spanComponentsToObjectId: () => _chunkB6ZQIAK3js.spanComponentsToObjectId,
|
|
297
|
+
startSpan: () => _chunkB6ZQIAK3js.startSpan,
|
|
298
|
+
summarize: () => _chunkB6ZQIAK3js.summarize,
|
|
299
|
+
templateRegistry: () => _chunkB6ZQIAK3js.templateRegistry,
|
|
300
|
+
toolFunctionDefinitionSchema: () => _chunkB6ZQIAK3js.ToolFunctionDefinition,
|
|
301
|
+
traceable: () => _chunkB6ZQIAK3js.traceable,
|
|
302
|
+
traced: () => _chunkB6ZQIAK3js.traced,
|
|
303
|
+
updateSpan: () => _chunkB6ZQIAK3js.updateSpan,
|
|
304
|
+
uploadLogs3OverflowPayload: () => _chunkB6ZQIAK3js.uploadLogs3OverflowPayload,
|
|
305
|
+
utf8ByteLength: () => _chunkB6ZQIAK3js.utf8ByteLength,
|
|
306
|
+
withCurrent: () => _chunkB6ZQIAK3js.withCurrent,
|
|
307
|
+
withDataset: () => _chunkB6ZQIAK3js.withDataset,
|
|
308
|
+
withExperiment: () => _chunkB6ZQIAK3js.withExperiment,
|
|
309
|
+
withLogger: () => _chunkB6ZQIAK3js.withLogger,
|
|
310
|
+
withParent: () => _chunkB6ZQIAK3js.withParent,
|
|
311
311
|
wrapAISDK: () => wrapAISDK,
|
|
312
312
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
313
313
|
wrapAgentClass: () => wrapAgentClass,
|
|
@@ -325,7 +325,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
325
325
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
326
326
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
327
327
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
328
|
-
wrapMastraAgent: () =>
|
|
328
|
+
wrapMastraAgent: () => _chunkB6ZQIAK3js.wrapMastraAgent,
|
|
329
329
|
wrapMistral: () => wrapMistral,
|
|
330
330
|
wrapOpenAI: () => wrapOpenAI,
|
|
331
331
|
wrapOpenAICodexSDK: () => wrapOpenAICodexSDK,
|
|
@@ -334,7 +334,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
334
334
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
335
335
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
336
336
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
337
|
-
wrapTraced: () =>
|
|
337
|
+
wrapTraced: () => _chunkB6ZQIAK3js.wrapTraced,
|
|
338
338
|
wrapVitest: () => wrapVitest
|
|
339
339
|
});
|
|
340
340
|
|
|
@@ -342,7 +342,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
342
342
|
var _v3 = require('zod/v3');
|
|
343
343
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
344
344
|
async function registerSandbox(options) {
|
|
345
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
345
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )));
|
|
346
346
|
await state.login({
|
|
347
347
|
apiKey: options.apiKey,
|
|
348
348
|
appUrl: options.appUrl,
|
|
@@ -383,7 +383,7 @@ async function registerSandbox(options) {
|
|
|
383
383
|
evaluatorDefinitions
|
|
384
384
|
)) {
|
|
385
385
|
const functionName = evalName;
|
|
386
|
-
const functionSlug =
|
|
386
|
+
const functionSlug = _chunkB6ZQIAK3js.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
387
387
|
const functionDef = {
|
|
388
388
|
project_id: projectId,
|
|
389
389
|
org_name: state.orgName,
|
|
@@ -454,7 +454,7 @@ async function invoke(args) {
|
|
|
454
454
|
projectId,
|
|
455
455
|
...functionIdArgs
|
|
456
456
|
} = args;
|
|
457
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
457
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )));
|
|
458
458
|
await state.login({
|
|
459
459
|
orgName,
|
|
460
460
|
apiKey,
|
|
@@ -462,8 +462,8 @@ async function invoke(args) {
|
|
|
462
462
|
forceLogin,
|
|
463
463
|
fetch
|
|
464
464
|
});
|
|
465
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
466
|
-
const functionId =
|
|
465
|
+
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkB6ZQIAK3js.getSpanParentObject.call(void 0, ).export();
|
|
466
|
+
const functionId = _chunkB6ZQIAK3js.FunctionId.safeParse({
|
|
467
467
|
function_id: functionIdArgs.function_id,
|
|
468
468
|
project_name: functionIdArgs.projectName,
|
|
469
469
|
slug: functionIdArgs.slug,
|
|
@@ -506,7 +506,7 @@ async function invoke(args) {
|
|
|
506
506
|
if (!resp.body) {
|
|
507
507
|
throw new Error("Received empty stream body");
|
|
508
508
|
}
|
|
509
|
-
return new (0,
|
|
509
|
+
return new (0, _chunkB6ZQIAK3js.BraintrustStream)(resp.body);
|
|
510
510
|
} else {
|
|
511
511
|
const data = await resp.json();
|
|
512
512
|
return schema ? schema.parse(data) : data;
|
|
@@ -518,7 +518,7 @@ function initFunction({
|
|
|
518
518
|
version,
|
|
519
519
|
state
|
|
520
520
|
}) {
|
|
521
|
-
const s = _nullishCoalesce(state, () => (
|
|
521
|
+
const s = _nullishCoalesce(state, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )));
|
|
522
522
|
_optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
|
|
523
523
|
const f = async (input) => {
|
|
524
524
|
return await invoke({
|
|
@@ -955,7 +955,7 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
955
955
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
956
956
|
return (params) => {
|
|
957
957
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
958
|
-
if (workflowAgent &&
|
|
958
|
+
if (workflowAgent && _chunkB6ZQIAK3js.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
959
959
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
960
960
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
961
961
|
}
|
|
@@ -1180,14 +1180,14 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1180
1180
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1181
1181
|
// propagate those via async local storage
|
|
1182
1182
|
async doGenerate(options) {
|
|
1183
|
-
const span =
|
|
1183
|
+
const span = _chunkB6ZQIAK3js.startSpan.call(void 0, {
|
|
1184
1184
|
name: "Chat Completion",
|
|
1185
1185
|
spanAttributes: {
|
|
1186
1186
|
type: "llm"
|
|
1187
1187
|
}
|
|
1188
1188
|
});
|
|
1189
1189
|
const { prompt, mode, ...rest } = options;
|
|
1190
|
-
const startTime =
|
|
1190
|
+
const startTime = _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, );
|
|
1191
1191
|
try {
|
|
1192
1192
|
const ret = await this.model.doGenerate(options);
|
|
1193
1193
|
span.log({
|
|
@@ -1199,12 +1199,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1199
1199
|
},
|
|
1200
1200
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1201
1201
|
metrics: {
|
|
1202
|
-
time_to_first_token:
|
|
1203
|
-
tokens: !
|
|
1202
|
+
time_to_first_token: _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, ) - startTime,
|
|
1203
|
+
tokens: !_chunkB6ZQIAK3js.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
1204
1204
|
prompt_tokens: _optionalChain([ret, 'access', _20 => _20.usage, 'optionalAccess', _21 => _21.promptTokens]),
|
|
1205
1205
|
completion_tokens: _optionalChain([ret, 'access', _22 => _22.usage, 'optionalAccess', _23 => _23.completionTokens]),
|
|
1206
|
-
cached:
|
|
1207
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _24 => _24.rawResponse, 'optionalAccess', _25 => _25.headers, 'optionalAccess', _26 => _26[
|
|
1206
|
+
cached: _chunkB6ZQIAK3js.parseCachedHeader.call(void 0,
|
|
1207
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _24 => _24.rawResponse, 'optionalAccess', _25 => _25.headers, 'optionalAccess', _26 => _26[_chunkB6ZQIAK3js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _27 => _27.rawResponse, 'optionalAccess', _28 => _28.headers, 'optionalAccess', _29 => _29[_chunkB6ZQIAK3js.LEGACY_CACHED_HEADER]])))
|
|
1208
1208
|
)
|
|
1209
1209
|
}
|
|
1210
1210
|
});
|
|
@@ -1215,8 +1215,8 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
async doStream(options) {
|
|
1217
1217
|
const { prompt, mode, ...rest } = options;
|
|
1218
|
-
const startTime =
|
|
1219
|
-
const span =
|
|
1218
|
+
const startTime = _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, );
|
|
1219
|
+
const span = _chunkB6ZQIAK3js.startSpan.call(void 0, {
|
|
1220
1220
|
name: "Chat Completion",
|
|
1221
1221
|
spanAttributes: {
|
|
1222
1222
|
type: "llm"
|
|
@@ -1250,7 +1250,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1250
1250
|
new TransformStream({
|
|
1251
1251
|
transform(chunk, controller) {
|
|
1252
1252
|
if (time_to_first_token === void 0) {
|
|
1253
|
-
time_to_first_token =
|
|
1253
|
+
time_to_first_token = _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1254
1254
|
span.log({ metrics: { time_to_first_token } });
|
|
1255
1255
|
}
|
|
1256
1256
|
switch (chunk.type) {
|
|
@@ -1295,11 +1295,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1295
1295
|
),
|
|
1296
1296
|
metrics: {
|
|
1297
1297
|
time_to_first_token,
|
|
1298
|
-
tokens: !
|
|
1298
|
+
tokens: !_chunkB6ZQIAK3js.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1299
1299
|
prompt_tokens: _optionalChain([usage, 'optionalAccess', _30 => _30.promptTokens]),
|
|
1300
1300
|
completion_tokens: _optionalChain([usage, 'optionalAccess', _31 => _31.completionTokens]),
|
|
1301
|
-
cached:
|
|
1302
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _32 => _32.rawResponse, 'optionalAccess', _33 => _33.headers, 'optionalAccess', _34 => _34[
|
|
1301
|
+
cached: _chunkB6ZQIAK3js.parseCachedHeader.call(void 0,
|
|
1302
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _32 => _32.rawResponse, 'optionalAccess', _33 => _33.headers, 'optionalAccess', _34 => _34[_chunkB6ZQIAK3js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _35 => _35.rawResponse, 'optionalAccess', _36 => _36.headers, 'optionalAccess', _37 => _37[_chunkB6ZQIAK3js.LEGACY_CACHED_HEADER]])))
|
|
1303
1303
|
)
|
|
1304
1304
|
}
|
|
1305
1305
|
});
|
|
@@ -1484,12 +1484,12 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1484
1484
|
anthropicMetadata.usage,
|
|
1485
1485
|
"cache_creation_input_tokens"
|
|
1486
1486
|
) || 0;
|
|
1487
|
-
const cacheTokens =
|
|
1487
|
+
const cacheTokens = _chunkB6ZQIAK3js.extractAnthropicCacheTokens.call(void 0,
|
|
1488
1488
|
cacheReadTokens,
|
|
1489
1489
|
cacheCreationTokens
|
|
1490
1490
|
);
|
|
1491
1491
|
Object.assign(metrics, cacheTokens);
|
|
1492
|
-
Object.assign(metrics,
|
|
1492
|
+
Object.assign(metrics, _chunkB6ZQIAK3js.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
1495
|
return metrics;
|
|
@@ -1561,7 +1561,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1561
1561
|
model: modelFromWrapGenerate
|
|
1562
1562
|
}) => {
|
|
1563
1563
|
const rawInput = extractInput(params);
|
|
1564
|
-
const processedInput =
|
|
1564
|
+
const processedInput = _chunkB6ZQIAK3js.processInputAttachments.call(void 0, rawInput);
|
|
1565
1565
|
const spanArgs = {
|
|
1566
1566
|
name: _optionalChain([config, 'access', _54 => _54.spanInfo, 'optionalAccess', _55 => _55.name]) || "ai-sdk.doGenerate",
|
|
1567
1567
|
spanAttributes: {
|
|
@@ -1576,7 +1576,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
};
|
|
1579
|
-
const span =
|
|
1579
|
+
const span = _chunkB6ZQIAK3js.startSpan.call(void 0, spanArgs);
|
|
1580
1580
|
try {
|
|
1581
1581
|
const result = await doGenerate();
|
|
1582
1582
|
const metadata = {};
|
|
@@ -1623,7 +1623,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1623
1623
|
},
|
|
1624
1624
|
wrapStream: async ({ doStream, params }) => {
|
|
1625
1625
|
const rawInput = extractInput(params);
|
|
1626
|
-
const processedInput =
|
|
1626
|
+
const processedInput = _chunkB6ZQIAK3js.processInputAttachments.call(void 0, rawInput);
|
|
1627
1627
|
const spanArgs = {
|
|
1628
1628
|
name: _optionalChain([config, 'access', _63 => _63.spanInfo, 'optionalAccess', _64 => _64.name]) || "ai-sdk.doStream",
|
|
1629
1629
|
spanAttributes: {
|
|
@@ -1638,7 +1638,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
}
|
|
1640
1640
|
};
|
|
1641
|
-
const span =
|
|
1641
|
+
const span = _chunkB6ZQIAK3js.startSpan.call(void 0, spanArgs);
|
|
1642
1642
|
try {
|
|
1643
1643
|
const { stream, ...rest } = await doStream();
|
|
1644
1644
|
const textChunks = [];
|
|
@@ -1761,7 +1761,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1761
1761
|
try {
|
|
1762
1762
|
captureEveModelInput(state, input);
|
|
1763
1763
|
} catch (error) {
|
|
1764
|
-
|
|
1764
|
+
_chunkB6ZQIAK3js.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
1767
|
},
|
|
@@ -1771,7 +1771,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1771
1771
|
};
|
|
1772
1772
|
}
|
|
1773
1773
|
function isEveHandleMessageStreamEvent(event) {
|
|
1774
|
-
return
|
|
1774
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
1775
1775
|
}
|
|
1776
1776
|
var ResumedEveSpan = class {
|
|
1777
1777
|
constructor(reference) {
|
|
@@ -1791,7 +1791,7 @@ var ResumedEveSpan = class {
|
|
|
1791
1791
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
1792
1792
|
...event.metrics
|
|
1793
1793
|
};
|
|
1794
|
-
|
|
1794
|
+
_chunkB6ZQIAK3js.updateSpan.call(void 0, {
|
|
1795
1795
|
exported: this.reference.exported,
|
|
1796
1796
|
...this.reference.startEvent,
|
|
1797
1797
|
...event,
|
|
@@ -1800,7 +1800,7 @@ var ResumedEveSpan = class {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
end(args) {
|
|
1802
1802
|
if (this.endTime === void 0) {
|
|
1803
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _72 => _72.endTime]), () => (
|
|
1803
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _72 => _72.endTime]), () => ( _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, )));
|
|
1804
1804
|
this.log({ metrics: { end: this.endTime } });
|
|
1805
1805
|
}
|
|
1806
1806
|
return this.endTime;
|
|
@@ -1811,13 +1811,13 @@ var EveBridge = (_class = class {
|
|
|
1811
1811
|
this.state = state;
|
|
1812
1812
|
}
|
|
1813
1813
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
1814
|
-
__init2() {this.completedToolKeys = new (0,
|
|
1814
|
+
__init2() {this.completedToolKeys = new (0, _chunkB6ZQIAK3js.LRUCache)({
|
|
1815
1815
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1816
1816
|
})}
|
|
1817
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
1817
|
+
__init3() {this.toolsByCallKey = new (0, _chunkB6ZQIAK3js.LRUCache)({
|
|
1818
1818
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1819
1819
|
})}
|
|
1820
|
-
__init4() {this.turnsByKey = new (0,
|
|
1820
|
+
__init4() {this.turnsByKey = new (0, _chunkB6ZQIAK3js.LRUCache)({
|
|
1821
1821
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1822
1822
|
})}
|
|
1823
1823
|
async startEveSpan(args) {
|
|
@@ -1828,7 +1828,7 @@ var EveBridge = (_class = class {
|
|
|
1828
1828
|
if (reference) {
|
|
1829
1829
|
return new ResumedEveSpan(reference);
|
|
1830
1830
|
}
|
|
1831
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _75 => _75.startTime]), () => (
|
|
1831
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _75 => _75.startTime]), () => ( _chunkB6ZQIAK3js.getCurrentUnixTimestamp.call(void 0, )));
|
|
1832
1832
|
const parentSpanIds = _optionalChain([args, 'optionalAccess', _76 => _76.parentSpanIds]);
|
|
1833
1833
|
const startEvent = {
|
|
1834
1834
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1840,9 +1840,9 @@ var EveBridge = (_class = class {
|
|
|
1840
1840
|
},
|
|
1841
1841
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
1842
1842
|
};
|
|
1843
|
-
const span =
|
|
1844
|
-
|
|
1845
|
-
() =>
|
|
1843
|
+
const span = _chunkB6ZQIAK3js.withCurrent.call(void 0,
|
|
1844
|
+
_chunkB6ZQIAK3js.NOOP_SPAN,
|
|
1845
|
+
() => _chunkB6ZQIAK3js._internalStartSpanWithInitialMerge.call(void 0, { ...args, startTime })
|
|
1846
1846
|
);
|
|
1847
1847
|
if (typeof rowId !== "string") {
|
|
1848
1848
|
return span;
|
|
@@ -1868,7 +1868,7 @@ var EveBridge = (_class = class {
|
|
|
1868
1868
|
};
|
|
1869
1869
|
});
|
|
1870
1870
|
} catch (error) {
|
|
1871
|
-
|
|
1871
|
+
_chunkB6ZQIAK3js.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
1872
1872
|
}
|
|
1873
1873
|
return span;
|
|
1874
1874
|
}
|
|
@@ -1955,7 +1955,7 @@ var EveBridge = (_class = class {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
}
|
|
1957
1957
|
} catch (error) {
|
|
1958
|
-
|
|
1958
|
+
_chunkB6ZQIAK3js.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
1959
1959
|
}
|
|
1960
1960
|
};
|
|
1961
1961
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -2148,8 +2148,8 @@ var EveBridge = (_class = class {
|
|
|
2148
2148
|
if (!step) {
|
|
2149
2149
|
return;
|
|
2150
2150
|
}
|
|
2151
|
-
const existingMessage = Array.isArray(step.output) &&
|
|
2152
|
-
const existingToolCalls =
|
|
2151
|
+
const existingMessage = Array.isArray(step.output) && _chunkB6ZQIAK3js.isObject.call(void 0, step.output[0]) ? step.output[0].message : void 0;
|
|
2152
|
+
const existingToolCalls = _chunkB6ZQIAK3js.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2153
2153
|
step.output = [
|
|
2154
2154
|
{
|
|
2155
2155
|
finish_reason: normalizedFinishReason(event.data.finishReason),
|
|
@@ -2207,11 +2207,11 @@ var EveBridge = (_class = class {
|
|
|
2207
2207
|
return;
|
|
2208
2208
|
}
|
|
2209
2209
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2210
|
-
if (Array.isArray(step.output) &&
|
|
2210
|
+
if (Array.isArray(step.output) && _chunkB6ZQIAK3js.isObject.call(void 0, step.output[0])) {
|
|
2211
2211
|
const message = step.output[0]["message"];
|
|
2212
|
-
if (
|
|
2212
|
+
if (_chunkB6ZQIAK3js.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2213
2213
|
for (const toolCall of message["tool_calls"]) {
|
|
2214
|
-
if (
|
|
2214
|
+
if (_chunkB6ZQIAK3js.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2215
2215
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
@@ -2417,7 +2417,7 @@ var EveBridge = (_class = class {
|
|
|
2417
2417
|
...costUsd !== void 0 ? { estimated_cost: costUsd } : {}
|
|
2418
2418
|
};
|
|
2419
2419
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2420
|
-
if (Array.isArray(step.output) &&
|
|
2420
|
+
if (Array.isArray(step.output) && _chunkB6ZQIAK3js.isObject.call(void 0, step.output[0])) {
|
|
2421
2421
|
const finishReason = step.output[0].finish_reason;
|
|
2422
2422
|
if (typeof finishReason !== "string") {
|
|
2423
2423
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -2737,10 +2737,10 @@ var EveBridge = (_class = class {
|
|
|
2737
2737
|
return state;
|
|
2738
2738
|
}
|
|
2739
2739
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
2740
|
-
const session =
|
|
2741
|
-
const parent =
|
|
2742
|
-
const parentTurn =
|
|
2743
|
-
const parentLineage =
|
|
2740
|
+
const session = _chunkB6ZQIAK3js.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
|
|
2741
|
+
const parent = _chunkB6ZQIAK3js.isObject.call(void 0, session) ? session["parent"] : void 0;
|
|
2742
|
+
const parentTurn = _chunkB6ZQIAK3js.isObject.call(void 0, parent) ? parent["turn"] : void 0;
|
|
2743
|
+
const parentLineage = _chunkB6ZQIAK3js.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkB6ZQIAK3js.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
|
|
2744
2744
|
callId: parent["callId"],
|
|
2745
2745
|
sessionId: parent["sessionId"],
|
|
2746
2746
|
turnId: parentTurn["id"]
|
|
@@ -2844,10 +2844,10 @@ var EveBridge = (_class = class {
|
|
|
2844
2844
|
}
|
|
2845
2845
|
async flushInstrumentation() {
|
|
2846
2846
|
try {
|
|
2847
|
-
await
|
|
2847
|
+
await _chunkB6ZQIAK3js.flush.call(void 0, );
|
|
2848
2848
|
return true;
|
|
2849
2849
|
} catch (error) {
|
|
2850
|
-
|
|
2850
|
+
_chunkB6ZQIAK3js.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
2851
2851
|
return false;
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
@@ -2861,12 +2861,12 @@ function emptyEveTraceState() {
|
|
|
2861
2861
|
};
|
|
2862
2862
|
}
|
|
2863
2863
|
function normalizeEveTraceState(state) {
|
|
2864
|
-
if (!
|
|
2864
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, state)) {
|
|
2865
2865
|
return emptyEveTraceState();
|
|
2866
2866
|
}
|
|
2867
|
-
const metadata =
|
|
2867
|
+
const metadata = _chunkB6ZQIAK3js.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
2868
2868
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
2869
|
-
if (!
|
|
2869
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, entry)) {
|
|
2870
2870
|
return [];
|
|
2871
2871
|
}
|
|
2872
2872
|
const exported = entry["exported"];
|
|
@@ -2875,11 +2875,11 @@ function normalizeEveTraceState(state) {
|
|
|
2875
2875
|
const rowId = entry["rowId"];
|
|
2876
2876
|
const spanId = entry["spanId"];
|
|
2877
2877
|
const startEvent = entry["startEvent"];
|
|
2878
|
-
const startEventCreated =
|
|
2879
|
-
const startEventMetrics =
|
|
2880
|
-
const startEventSpanAttributes =
|
|
2881
|
-
const startEventSpanParents =
|
|
2882
|
-
const normalizedStartEvent = typeof startEventCreated === "string" &&
|
|
2878
|
+
const startEventCreated = _chunkB6ZQIAK3js.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
|
|
2879
|
+
const startEventMetrics = _chunkB6ZQIAK3js.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
|
|
2880
|
+
const startEventSpanAttributes = _chunkB6ZQIAK3js.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
|
|
2881
|
+
const startEventSpanParents = _chunkB6ZQIAK3js.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
|
|
2882
|
+
const normalizedStartEvent = typeof startEventCreated === "string" && _chunkB6ZQIAK3js.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkB6ZQIAK3js.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
|
|
2883
2883
|
(parent) => typeof parent === "string"
|
|
2884
2884
|
) ? {
|
|
2885
2885
|
created: startEventCreated,
|
|
@@ -2899,7 +2899,7 @@ function normalizeEveTraceState(state) {
|
|
|
2899
2899
|
] : [];
|
|
2900
2900
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
2901
2901
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
2902
|
-
if (!
|
|
2902
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, entry)) {
|
|
2903
2903
|
return [];
|
|
2904
2904
|
}
|
|
2905
2905
|
const key = entry["key"];
|
|
@@ -2907,7 +2907,7 @@ function normalizeEveTraceState(state) {
|
|
|
2907
2907
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
2908
2908
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
2909
2909
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
2910
|
-
if (!
|
|
2910
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, entry)) {
|
|
2911
2911
|
return [];
|
|
2912
2912
|
}
|
|
2913
2913
|
const ordinal = entry["ordinal"];
|
|
@@ -2926,13 +2926,13 @@ function readEveTraceState(state) {
|
|
|
2926
2926
|
}
|
|
2927
2927
|
}
|
|
2928
2928
|
function captureEveModelInput(state, input) {
|
|
2929
|
-
if (!
|
|
2929
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, input)) {
|
|
2930
2930
|
return;
|
|
2931
2931
|
}
|
|
2932
2932
|
const session = input["session"];
|
|
2933
2933
|
const turn = input["turn"];
|
|
2934
2934
|
const step = input["step"];
|
|
2935
|
-
if (!
|
|
2935
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, session) || !_chunkB6ZQIAK3js.isObject.call(void 0, turn) || !_chunkB6ZQIAK3js.isObject.call(void 0, step)) {
|
|
2936
2936
|
return;
|
|
2937
2937
|
}
|
|
2938
2938
|
const sessionId = session["id"];
|
|
@@ -2977,12 +2977,12 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
2977
2977
|
});
|
|
2978
2978
|
return input;
|
|
2979
2979
|
} catch (error) {
|
|
2980
|
-
|
|
2980
|
+
_chunkB6ZQIAK3js.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
2981
2981
|
return void 0;
|
|
2982
2982
|
}
|
|
2983
2983
|
}
|
|
2984
2984
|
function capturedModelInput(modelInput) {
|
|
2985
|
-
if (!
|
|
2985
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, modelInput)) {
|
|
2986
2986
|
return void 0;
|
|
2987
2987
|
}
|
|
2988
2988
|
const messages = modelInput["messages"];
|
|
@@ -3011,7 +3011,7 @@ function llmInputKey(sessionId, turnId, stepIndex) {
|
|
|
3011
3011
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3012
3012
|
}
|
|
3013
3013
|
function modelMetadataFromRuntime(runtime) {
|
|
3014
|
-
if (!
|
|
3014
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, runtime)) {
|
|
3015
3015
|
return {};
|
|
3016
3016
|
}
|
|
3017
3017
|
const modelId = runtime["modelId"];
|
|
@@ -3034,11 +3034,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3034
3034
|
};
|
|
3035
3035
|
}
|
|
3036
3036
|
function sessionIdFromContext(ctx) {
|
|
3037
|
-
if (!
|
|
3037
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, ctx)) {
|
|
3038
3038
|
return void 0;
|
|
3039
3039
|
}
|
|
3040
3040
|
const session = ctx["session"];
|
|
3041
|
-
if (!
|
|
3041
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, session)) {
|
|
3042
3042
|
return void 0;
|
|
3043
3043
|
}
|
|
3044
3044
|
const id = session["id"];
|
|
@@ -3049,19 +3049,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3049
3049
|
return metadata;
|
|
3050
3050
|
}
|
|
3051
3051
|
function isToolCallAction(action) {
|
|
3052
|
-
return
|
|
3052
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkB6ZQIAK3js.isObject.call(void 0, action["input"]);
|
|
3053
3053
|
}
|
|
3054
3054
|
function isLocalSubagentCallAction(action) {
|
|
3055
|
-
return
|
|
3055
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkB6ZQIAK3js.isObject.call(void 0, action["input"]);
|
|
3056
3056
|
}
|
|
3057
3057
|
function isTraceableActionRequest(action) {
|
|
3058
3058
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3059
3059
|
}
|
|
3060
3060
|
function isToolResult(result) {
|
|
3061
|
-
return
|
|
3061
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3062
3062
|
}
|
|
3063
3063
|
function isSubagentResult(result) {
|
|
3064
|
-
return
|
|
3064
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3065
3065
|
}
|
|
3066
3066
|
function normalizedFinishReason(finishReason) {
|
|
3067
3067
|
switch (finishReason) {
|
|
@@ -3237,7 +3237,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
3237
3237
|
...params,
|
|
3238
3238
|
options: {
|
|
3239
3239
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
3240
|
-
[
|
|
3240
|
+
[_chunkB6ZQIAK3js.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
3241
3241
|
}
|
|
3242
3242
|
};
|
|
3243
3243
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
@@ -3269,7 +3269,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
const localToolMetadata = { toolName };
|
|
3271
3271
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
3272
|
-
wrappedArgs[handlerIndex] =
|
|
3272
|
+
wrappedArgs[handlerIndex] = _chunkB6ZQIAK3js.wrapLocalClaudeToolHandler.call(void 0,
|
|
3273
3273
|
originalHandler,
|
|
3274
3274
|
() => localToolMetadata
|
|
3275
3275
|
);
|
|
@@ -3869,7 +3869,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3869
3869
|
}
|
|
3870
3870
|
if (prop === "interactions") {
|
|
3871
3871
|
const interactions = Reflect.get(target, prop, receiver);
|
|
3872
|
-
if (!
|
|
3872
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
3873
3873
|
return interactions;
|
|
3874
3874
|
}
|
|
3875
3875
|
if (interactions !== originalInteractions) {
|
|
@@ -3883,7 +3883,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3883
3883
|
});
|
|
3884
3884
|
}
|
|
3885
3885
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
3886
|
-
if (!
|
|
3886
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
3887
3887
|
return;
|
|
3888
3888
|
}
|
|
3889
3889
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -4317,10 +4317,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
4317
4317
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
4318
4318
|
}
|
|
4319
4319
|
function hasFunction2(value, methodName) {
|
|
4320
|
-
return
|
|
4320
|
+
return _chunkB6ZQIAK3js.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
4321
4321
|
}
|
|
4322
4322
|
function isSupportedHuggingFaceModule(value) {
|
|
4323
|
-
if (!
|
|
4323
|
+
if (!_chunkB6ZQIAK3js.isObject.call(void 0, value)) {
|
|
4324
4324
|
return false;
|
|
4325
4325
|
}
|
|
4326
4326
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -5060,16 +5060,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
5060
5060
|
}
|
|
5061
5061
|
function wrapSend(send) {
|
|
5062
5062
|
return (command, optionsOrCb, cb) => {
|
|
5063
|
-
if (
|
|
5063
|
+
if (_chunkB6ZQIAK3js.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
5064
5064
|
return send(command, optionsOrCb, cb);
|
|
5065
5065
|
}
|
|
5066
5066
|
return _chunkCDIKAHDZjs.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
5067
|
-
() =>
|
|
5067
|
+
() => _chunkB6ZQIAK3js.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
5068
5068
|
() => send(command, optionsOrCb)
|
|
5069
5069
|
),
|
|
5070
5070
|
{
|
|
5071
5071
|
arguments: [command, optionsOrCb],
|
|
5072
|
-
span_info:
|
|
5072
|
+
span_info: _chunkB6ZQIAK3js.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
5073
5073
|
}
|
|
5074
5074
|
);
|
|
5075
5075
|
};
|
|
@@ -5388,10 +5388,10 @@ function publishRunUpdate(runTree) {
|
|
|
5388
5388
|
void _chunkCDIKAHDZjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
5389
5389
|
arguments: [runTree.id, runTree]
|
|
5390
5390
|
}).catch((error) => {
|
|
5391
|
-
|
|
5391
|
+
_chunkB6ZQIAK3js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5392
5392
|
});
|
|
5393
5393
|
} catch (error) {
|
|
5394
|
-
|
|
5394
|
+
_chunkB6ZQIAK3js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5395
5395
|
}
|
|
5396
5396
|
}
|
|
5397
5397
|
|
|
@@ -5444,7 +5444,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
|
|
|
5444
5444
|
if (this.activeFlushes.has(experimentId)) {
|
|
5445
5445
|
return this.activeFlushes.get(experimentId);
|
|
5446
5446
|
}
|
|
5447
|
-
const flushPromise =
|
|
5447
|
+
const flushPromise = _chunkB6ZQIAK3js.summarizeAndFlush.call(void 0, context.experiment, {
|
|
5448
5448
|
displaySummary: config.displaySummary
|
|
5449
5449
|
});
|
|
5450
5450
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -5542,7 +5542,7 @@ async function runTracedEval(args) {
|
|
|
5542
5542
|
}
|
|
5543
5543
|
if (testError) {
|
|
5544
5544
|
span.log({ scores: { pass: 0 } });
|
|
5545
|
-
|
|
5545
|
+
_chunkB6ZQIAK3js.logError.call(void 0, span, testError);
|
|
5546
5546
|
throw testError;
|
|
5547
5547
|
}
|
|
5548
5548
|
span.log({
|
|
@@ -5716,10 +5716,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
5716
5716
|
const getOrCreateContext = () => {
|
|
5717
5717
|
if (!context) {
|
|
5718
5718
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5719
|
-
const experiment = config.projectId ?
|
|
5719
|
+
const experiment = config.projectId ? _chunkB6ZQIAK3js.initExperiment.call(void 0, {
|
|
5720
5720
|
projectId: config.projectId,
|
|
5721
5721
|
experiment: experimentName
|
|
5722
|
-
}) :
|
|
5722
|
+
}) : _chunkB6ZQIAK3js.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
5723
5723
|
experiment: experimentName
|
|
5724
5724
|
});
|
|
5725
5725
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -5827,7 +5827,7 @@ function wrapExpect(originalExpect) {
|
|
|
5827
5827
|
return originalExpect(value);
|
|
5828
5828
|
}
|
|
5829
5829
|
const assertion = originalExpect(value, message);
|
|
5830
|
-
const span =
|
|
5830
|
+
const span = _chunkB6ZQIAK3js.currentSpan.call(void 0, );
|
|
5831
5831
|
if (!span) {
|
|
5832
5832
|
return assertion;
|
|
5833
5833
|
}
|
|
@@ -5839,16 +5839,16 @@ function wrapExpect(originalExpect) {
|
|
|
5839
5839
|
|
|
5840
5840
|
// src/wrappers/shared/logging.ts
|
|
5841
5841
|
function logOutputs(outputs) {
|
|
5842
|
-
|
|
5842
|
+
_chunkB6ZQIAK3js.currentSpan.call(void 0, ).log({ output: outputs });
|
|
5843
5843
|
}
|
|
5844
5844
|
function logFeedback(feedback) {
|
|
5845
|
-
|
|
5845
|
+
_chunkB6ZQIAK3js.currentSpan.call(void 0, ).log({
|
|
5846
5846
|
scores: { [feedback.name]: feedback.score },
|
|
5847
5847
|
metadata: feedback.metadata
|
|
5848
5848
|
});
|
|
5849
5849
|
}
|
|
5850
5850
|
function getCurrentSpan() {
|
|
5851
|
-
return
|
|
5851
|
+
return _chunkB6ZQIAK3js.currentSpan.call(void 0, );
|
|
5852
5852
|
}
|
|
5853
5853
|
|
|
5854
5854
|
// src/wrappers/vitest/index.ts
|
|
@@ -5896,7 +5896,7 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
5896
5896
|
);
|
|
5897
5897
|
return;
|
|
5898
5898
|
}
|
|
5899
|
-
await
|
|
5899
|
+
await _chunkB6ZQIAK3js.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
5900
5900
|
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _130 => _130.displaySummary]), () => ( config.displaySummary))
|
|
5901
5901
|
});
|
|
5902
5902
|
}
|
|
@@ -5911,7 +5911,7 @@ function initNodeTestSuite(config) {
|
|
|
5911
5911
|
return experiment;
|
|
5912
5912
|
}
|
|
5913
5913
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5914
|
-
experiment =
|
|
5914
|
+
experiment = _chunkB6ZQIAK3js.initExperiment.call(void 0, config.projectName, {
|
|
5915
5915
|
experiment: experimentName
|
|
5916
5916
|
});
|
|
5917
5917
|
return experiment;
|
|
@@ -5960,7 +5960,7 @@ function initNodeTestSuite(config) {
|
|
|
5960
5960
|
if (!experiment) {
|
|
5961
5961
|
return;
|
|
5962
5962
|
}
|
|
5963
|
-
await
|
|
5963
|
+
await _chunkB6ZQIAK3js.summarizeAndFlush.call(void 0, experiment, {
|
|
5964
5964
|
displaySummary: config.displaySummary
|
|
5965
5965
|
});
|
|
5966
5966
|
experiment = void 0;
|
|
@@ -6051,7 +6051,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6051
6051
|
};
|
|
6052
6052
|
}
|
|
6053
6053
|
resolveNode(node) {
|
|
6054
|
-
if (node instanceof
|
|
6054
|
+
if (node instanceof _chunkB6ZQIAK3js.Prompt) {
|
|
6055
6055
|
const cached = this.nodeLikeNodes.get(node);
|
|
6056
6056
|
if (cached) {
|
|
6057
6057
|
return [cached, []];
|
|
@@ -6101,7 +6101,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6101
6101
|
// }
|
|
6102
6102
|
// Helper to generate node IDs
|
|
6103
6103
|
generateId(name) {
|
|
6104
|
-
const uuid =
|
|
6104
|
+
const uuid = _chunkB6ZQIAK3js.newId.call(void 0, );
|
|
6105
6105
|
if (name) {
|
|
6106
6106
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
6107
6107
|
} else {
|
|
@@ -7295,7 +7295,7 @@ function waterfall(tasks, callback) {
|
|
|
7295
7295
|
var waterfall$1 = awaitify(waterfall);
|
|
7296
7296
|
|
|
7297
7297
|
// src/trace.ts
|
|
7298
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
7298
|
+
var SpanFetcher = class _SpanFetcher extends _chunkB6ZQIAK3js.ObjectFetcher {
|
|
7299
7299
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
7300
7300
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
7301
7301
|
rootSpanId,
|
|
@@ -7608,20 +7608,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
7608
7608
|
prompt: _v3.z.string()
|
|
7609
7609
|
}),
|
|
7610
7610
|
_v3.z.object({
|
|
7611
|
-
messages: _v3.z.array(
|
|
7611
|
+
messages: _v3.z.array(_chunkB6ZQIAK3js.ChatCompletionMessageParam)
|
|
7612
7612
|
})
|
|
7613
7613
|
]);
|
|
7614
7614
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
7615
7615
|
_v3.z.object({
|
|
7616
7616
|
model: _v3.z.string(),
|
|
7617
|
-
params:
|
|
7617
|
+
params: _chunkB6ZQIAK3js.ModelParams.optional(),
|
|
7618
7618
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
7619
7619
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
7620
7620
|
})
|
|
7621
7621
|
);
|
|
7622
7622
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
7623
7623
|
_v3.z.object({
|
|
7624
|
-
tools: _v3.z.array(
|
|
7624
|
+
tools: _v3.z.array(_chunkB6ZQIAK3js.ToolFunctionDefinition).optional()
|
|
7625
7625
|
})
|
|
7626
7626
|
);
|
|
7627
7627
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -7669,7 +7669,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
7669
7669
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
7670
7670
|
return parameters;
|
|
7671
7671
|
}
|
|
7672
|
-
if (
|
|
7672
|
+
if (_chunkB6ZQIAK3js.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
7673
7673
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
7674
7674
|
...resolvedSchema.data,
|
|
7675
7675
|
...parameters
|
|
@@ -7691,14 +7691,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
7691
7691
|
const value = parameters[name];
|
|
7692
7692
|
try {
|
|
7693
7693
|
if ("type" in schema && schema.type === "prompt") {
|
|
7694
|
-
const promptData = value ?
|
|
7694
|
+
const promptData = value ? _chunkB6ZQIAK3js.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
7695
7695
|
schema.default,
|
|
7696
7696
|
schema.default.tools
|
|
7697
7697
|
) : void 0;
|
|
7698
7698
|
if (!promptData) {
|
|
7699
7699
|
throw new Error(`Parameter '${name}' is required`);
|
|
7700
7700
|
}
|
|
7701
|
-
return [name,
|
|
7701
|
+
return [name, _chunkB6ZQIAK3js.Prompt.fromPromptData(name, promptData)];
|
|
7702
7702
|
} else if ("type" in schema && schema.type === "model") {
|
|
7703
7703
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
7704
7704
|
if (model === void 0) {
|
|
@@ -7749,7 +7749,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
7749
7749
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
7750
7750
|
return [
|
|
7751
7751
|
name,
|
|
7752
|
-
|
|
7752
|
+
_chunkB6ZQIAK3js.Prompt.fromPromptData(name, _chunkB6ZQIAK3js.PromptData.parse(value))
|
|
7753
7753
|
];
|
|
7754
7754
|
}
|
|
7755
7755
|
return [name, value];
|
|
@@ -7797,7 +7797,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
7797
7797
|
return out;
|
|
7798
7798
|
}
|
|
7799
7799
|
function initExperiment2(state, options = {}) {
|
|
7800
|
-
return
|
|
7800
|
+
return _chunkB6ZQIAK3js.init.call(void 0, {
|
|
7801
7801
|
state,
|
|
7802
7802
|
...options,
|
|
7803
7803
|
setCurrent: false
|
|
@@ -7808,7 +7808,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
7808
7808
|
return void 0;
|
|
7809
7809
|
}
|
|
7810
7810
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
7811
|
-
if (!
|
|
7811
|
+
if (!_chunkB6ZQIAK3js.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
7812
7812
|
return void 0;
|
|
7813
7813
|
}
|
|
7814
7814
|
if (resolvedParameters.id === void 0) {
|
|
@@ -7844,10 +7844,10 @@ globalThis._evals = {
|
|
|
7844
7844
|
reporters: {}
|
|
7845
7845
|
};
|
|
7846
7846
|
function _initializeSpanContext() {
|
|
7847
|
-
globalThis._spanContext = { currentSpan:
|
|
7847
|
+
globalThis._spanContext = { currentSpan: _chunkB6ZQIAK3js.currentSpan, withCurrent: _chunkB6ZQIAK3js.withCurrent, startSpan: _chunkB6ZQIAK3js.startSpan, NOOP_SPAN: _chunkB6ZQIAK3js.NOOP_SPAN };
|
|
7848
7848
|
}
|
|
7849
7849
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
7850
|
-
const options =
|
|
7850
|
+
const options = _chunkB6ZQIAK3js.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
7851
7851
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
7852
7852
|
if (globalThis._evals.evaluators[evalName]) {
|
|
7853
7853
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -7898,7 +7898,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7898
7898
|
baseExperimentId: evaluator.baseExperimentId,
|
|
7899
7899
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
7900
7900
|
repoInfo: evaluator.repoInfo,
|
|
7901
|
-
dataset:
|
|
7901
|
+
dataset: _chunkB6ZQIAK3js.Dataset.isDataset(data) ? data : void 0,
|
|
7902
7902
|
parameters
|
|
7903
7903
|
});
|
|
7904
7904
|
if (experiment && typeof process !== "undefined" && globalThis.BRAINTRUST_CONTEXT_MANAGER !== void 0) {
|
|
@@ -7918,7 +7918,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7918
7918
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
7919
7919
|
let ret;
|
|
7920
7920
|
if (options.parent) {
|
|
7921
|
-
ret = await
|
|
7921
|
+
ret = await _chunkB6ZQIAK3js.withParent.call(void 0,
|
|
7922
7922
|
options.parent,
|
|
7923
7923
|
() => runEvaluator(
|
|
7924
7924
|
null,
|
|
@@ -7954,7 +7954,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7954
7954
|
if (experiment) {
|
|
7955
7955
|
await experiment.flush().catch(console.error);
|
|
7956
7956
|
} else if (options.parent) {
|
|
7957
|
-
await
|
|
7957
|
+
await _chunkB6ZQIAK3js.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
7958
7958
|
}
|
|
7959
7959
|
}
|
|
7960
7960
|
} finally {
|
|
@@ -8000,13 +8000,13 @@ function classifierName(classifier, classifier_idx) {
|
|
|
8000
8000
|
}
|
|
8001
8001
|
function buildSpanMetadata(results) {
|
|
8002
8002
|
return results.length === 1 ? results[0].metadata : results.reduce(
|
|
8003
|
-
(prev, s) =>
|
|
8003
|
+
(prev, s) => _chunkB6ZQIAK3js.mergeDicts.call(void 0, prev, { [s.name]: s.metadata }),
|
|
8004
8004
|
{}
|
|
8005
8005
|
);
|
|
8006
8006
|
}
|
|
8007
8007
|
function buildSpanScores(results) {
|
|
8008
8008
|
const scoresRecord = results.reduce(
|
|
8009
|
-
(prev, s) =>
|
|
8009
|
+
(prev, s) => _chunkB6ZQIAK3js.mergeDicts.call(void 0, prev, { [s.name]: s.score }),
|
|
8010
8010
|
{}
|
|
8011
8011
|
);
|
|
8012
8012
|
return { resultMetadata: buildSpanMetadata(results), scoresRecord };
|
|
@@ -8036,7 +8036,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
8036
8036
|
return failing;
|
|
8037
8037
|
}
|
|
8038
8038
|
function validateClassificationResult(value, scorerName2) {
|
|
8039
|
-
if (!(typeof value === "object" && value !== null && !
|
|
8039
|
+
if (!(typeof value === "object" && value !== null && !_chunkB6ZQIAK3js.isEmpty.call(void 0, value))) {
|
|
8040
8040
|
throw new Error(
|
|
8041
8041
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
8042
8042
|
);
|
|
@@ -8065,7 +8065,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
8065
8065
|
);
|
|
8066
8066
|
metadata[`${kind}_errors`] = errorMap;
|
|
8067
8067
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
8068
|
-
|
|
8068
|
+
_chunkB6ZQIAK3js.debugLogger.forState(state).warn(
|
|
8069
8069
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
8070
8070
|
failures.map((f) => f.error)
|
|
8071
8071
|
);
|
|
@@ -8099,7 +8099,7 @@ var defaultErrorScoreHandler = ({
|
|
|
8099
8099
|
};
|
|
8100
8100
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
8101
8101
|
if (enableCache) {
|
|
8102
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8102
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _144 => _144.spanCache, 'optionalAccess', _145 => _145.start, 'call', _146 => _146()]);
|
|
8103
8103
|
}
|
|
8104
8104
|
try {
|
|
8105
8105
|
if (typeof evaluator.data === "string") {
|
|
@@ -8120,7 +8120,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8120
8120
|
);
|
|
8121
8121
|
}
|
|
8122
8122
|
let name = dataResult.name;
|
|
8123
|
-
if (
|
|
8123
|
+
if (_chunkB6ZQIAK3js.isEmpty.call(void 0, name)) {
|
|
8124
8124
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
8125
8125
|
if (!baseExperiment) {
|
|
8126
8126
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -8170,7 +8170,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8170
8170
|
if (cancelled) {
|
|
8171
8171
|
return;
|
|
8172
8172
|
}
|
|
8173
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
8173
|
+
const eventDataset = experiment ? experiment.dataset : _chunkB6ZQIAK3js.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
8174
8174
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
8175
8175
|
object_type: "dataset",
|
|
8176
8176
|
object_id: await eventDataset.id,
|
|
@@ -8178,7 +8178,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8178
8178
|
created: datum.created,
|
|
8179
8179
|
_xact_id: datum._xact_id
|
|
8180
8180
|
} : void 0;
|
|
8181
|
-
const parsedDatumOrigin =
|
|
8181
|
+
const parsedDatumOrigin = _chunkB6ZQIAK3js.ObjectReference.safeParse(datum.origin);
|
|
8182
8182
|
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _147 => _147.success]) ? parsedDatumOrigin.data : void 0)));
|
|
8183
8183
|
const baseEvent = {
|
|
8184
8184
|
name: "eval",
|
|
@@ -8194,23 +8194,23 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8194
8194
|
}
|
|
8195
8195
|
};
|
|
8196
8196
|
const callback = async (rootSpan) => {
|
|
8197
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
8197
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )));
|
|
8198
8198
|
const ensureSpansFlushed = async () => {
|
|
8199
8199
|
if (experiment) {
|
|
8200
|
-
await
|
|
8200
|
+
await _chunkB6ZQIAK3js.flush.call(void 0, { state: experiment.loggingState });
|
|
8201
8201
|
} else if (state) {
|
|
8202
|
-
await
|
|
8202
|
+
await _chunkB6ZQIAK3js.flush.call(void 0, { state });
|
|
8203
8203
|
} else {
|
|
8204
|
-
await
|
|
8204
|
+
await _chunkB6ZQIAK3js.flush.call(void 0, );
|
|
8205
8205
|
}
|
|
8206
8206
|
if (state) {
|
|
8207
8207
|
await state.flushOtel();
|
|
8208
8208
|
}
|
|
8209
8209
|
};
|
|
8210
8210
|
const parentStr = state.currentParent.getStore();
|
|
8211
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
8211
|
+
const parentComponents = typeof parentStr === "string" ? _chunkB6ZQIAK3js.SpanComponentsV4.fromStr(parentStr) : null;
|
|
8212
8212
|
const trace = state ? new LocalTrace({
|
|
8213
|
-
objectType: parentComponents ?
|
|
8213
|
+
objectType: parentComponents ? _chunkB6ZQIAK3js.spanObjectTypeV3ToTypedString.call(void 0,
|
|
8214
8214
|
parentComponents.data.object_type
|
|
8215
8215
|
) : "experiment",
|
|
8216
8216
|
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _148 => _148.data, 'access', async _149 => _149.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
@@ -8285,7 +8285,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8285
8285
|
trace
|
|
8286
8286
|
};
|
|
8287
8287
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
8288
|
-
const propagatedEvent =
|
|
8288
|
+
const propagatedEvent = _chunkB6ZQIAK3js.makeScorerPropagatedEvent.call(void 0,
|
|
8289
8289
|
await rootSpan.export()
|
|
8290
8290
|
);
|
|
8291
8291
|
const getOtherFields = (s) => {
|
|
@@ -8308,14 +8308,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8308
8308
|
if (scoreValue === null) return null;
|
|
8309
8309
|
if (Array.isArray(scoreValue)) {
|
|
8310
8310
|
for (const s of scoreValue) {
|
|
8311
|
-
if (!(typeof s === "object" && !
|
|
8311
|
+
if (!(typeof s === "object" && !_chunkB6ZQIAK3js.isEmpty.call(void 0, s))) {
|
|
8312
8312
|
throw new Error(
|
|
8313
8313
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(s)}`
|
|
8314
8314
|
);
|
|
8315
8315
|
}
|
|
8316
8316
|
}
|
|
8317
8317
|
}
|
|
8318
|
-
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !
|
|
8318
|
+
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !_chunkB6ZQIAK3js.isEmpty.call(void 0, scoreValue) ? [scoreValue] : [
|
|
8319
8319
|
{
|
|
8320
8320
|
name: scorerNames[score_idx],
|
|
8321
8321
|
score: scoreValue
|
|
@@ -8323,7 +8323,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8323
8323
|
];
|
|
8324
8324
|
const { resultMetadata, scoresRecord } = buildSpanScores(results);
|
|
8325
8325
|
const resultOutput = results.length === 1 ? getOtherFields(results[0]) : results.reduce(
|
|
8326
|
-
(prev, s) =>
|
|
8326
|
+
(prev, s) => _chunkB6ZQIAK3js.mergeDicts.call(void 0, prev, {
|
|
8327
8327
|
[s.name]: getOtherFields(s)
|
|
8328
8328
|
}),
|
|
8329
8329
|
{}
|
|
@@ -8358,7 +8358,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8358
8358
|
)
|
|
8359
8359
|
);
|
|
8360
8360
|
const resultOutput = rawResults.length === 1 ? toClassificationItem(rawResults[0]) : rawResults.reduce(
|
|
8361
|
-
(prev, r) =>
|
|
8361
|
+
(prev, r) => _chunkB6ZQIAK3js.mergeDicts.call(void 0, prev, {
|
|
8362
8362
|
[r.name]: toClassificationItem(r)
|
|
8363
8363
|
}),
|
|
8364
8364
|
{}
|
|
@@ -8410,7 +8410,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8410
8410
|
evaluator.state
|
|
8411
8411
|
);
|
|
8412
8412
|
} catch (e) {
|
|
8413
|
-
|
|
8413
|
+
_chunkB6ZQIAK3js.logError.call(void 0, rootSpan, e);
|
|
8414
8414
|
error = e;
|
|
8415
8415
|
} finally {
|
|
8416
8416
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -8444,7 +8444,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8444
8444
|
}
|
|
8445
8445
|
};
|
|
8446
8446
|
if (!experiment) {
|
|
8447
|
-
return await
|
|
8447
|
+
return await _chunkB6ZQIAK3js.traced.call(void 0, callback, {
|
|
8448
8448
|
...baseEvent,
|
|
8449
8449
|
state: evaluator.state
|
|
8450
8450
|
});
|
|
@@ -8486,7 +8486,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8486
8486
|
const cancel = async () => {
|
|
8487
8487
|
await new Promise((_, reject2) => {
|
|
8488
8488
|
if (cancelled) {
|
|
8489
|
-
reject2(new (0,
|
|
8489
|
+
reject2(new (0, _chunkB6ZQIAK3js.InternalAbortError)("Evaluator already cancelled"));
|
|
8490
8490
|
return;
|
|
8491
8491
|
}
|
|
8492
8492
|
let timeoutId;
|
|
@@ -8507,12 +8507,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8507
8507
|
};
|
|
8508
8508
|
if (evaluator.timeout) {
|
|
8509
8509
|
timeoutId = setTimeout(() => {
|
|
8510
|
-
rejectOnce(new (0,
|
|
8510
|
+
rejectOnce(new (0, _chunkB6ZQIAK3js.InternalAbortError)("Evaluator timed out"));
|
|
8511
8511
|
}, evaluator.timeout);
|
|
8512
8512
|
}
|
|
8513
8513
|
if (evaluator.signal) {
|
|
8514
8514
|
abortHandler = () => {
|
|
8515
|
-
rejectOnce(new (0,
|
|
8515
|
+
rejectOnce(new (0, _chunkB6ZQIAK3js.InternalAbortError)("Evaluator aborted"));
|
|
8516
8516
|
};
|
|
8517
8517
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
8518
8518
|
}
|
|
@@ -8535,9 +8535,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8535
8535
|
}
|
|
8536
8536
|
} catch (e) {
|
|
8537
8537
|
q.kill();
|
|
8538
|
-
if (e instanceof
|
|
8538
|
+
if (e instanceof _chunkB6ZQIAK3js.InternalAbortError) {
|
|
8539
8539
|
if (_chunkCDIKAHDZjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
8540
|
-
|
|
8540
|
+
_chunkB6ZQIAK3js.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
8541
8541
|
}
|
|
8542
8542
|
}
|
|
8543
8543
|
throw e;
|
|
@@ -8561,7 +8561,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8561
8561
|
);
|
|
8562
8562
|
} finally {
|
|
8563
8563
|
if (enableCache) {
|
|
8564
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8564
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _157 => _157.spanCache]);
|
|
8565
8565
|
_optionalChain([spanCache, 'optionalAccess', _158 => _158.dispose, 'call', _159 => _159()]);
|
|
8566
8566
|
_optionalChain([spanCache, 'optionalAccess', _160 => _160.stop, 'call', _161 => _161()]);
|
|
8567
8567
|
}
|
|
@@ -8683,7 +8683,7 @@ var defaultReporter = {
|
|
|
8683
8683
|
const scoreValue = `${scorePercent}%`;
|
|
8684
8684
|
if (hasComparison) {
|
|
8685
8685
|
let diffString = "-";
|
|
8686
|
-
if (!
|
|
8686
|
+
if (!_chunkB6ZQIAK3js.isEmpty.call(void 0, score.diff)) {
|
|
8687
8687
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
8688
8688
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
8689
8689
|
diffString = `${diffSign}${diffPercent}%`;
|
|
@@ -8703,7 +8703,7 @@ var defaultReporter = {
|
|
|
8703
8703
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
8704
8704
|
if (hasComparison) {
|
|
8705
8705
|
let diffString = "-";
|
|
8706
|
-
if (!
|
|
8706
|
+
if (!_chunkB6ZQIAK3js.isEmpty.call(void 0, metric.diff)) {
|
|
8707
8707
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
8708
8708
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
8709
8709
|
diffString = `${diffSign}${diffPercent}%`;
|
|
@@ -9161,7 +9161,7 @@ var Project2 = (_class7 = class {
|
|
|
9161
9161
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
9162
9162
|
return;
|
|
9163
9163
|
}
|
|
9164
|
-
await
|
|
9164
|
+
await _chunkB6ZQIAK3js.login.call(void 0, );
|
|
9165
9165
|
const projectMap = new ProjectNameIdMap();
|
|
9166
9166
|
const functionDefinitions = [];
|
|
9167
9167
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -9175,7 +9175,7 @@ var Project2 = (_class7 = class {
|
|
|
9175
9175
|
functionDefinitions.push(functionDefinition);
|
|
9176
9176
|
}
|
|
9177
9177
|
}
|
|
9178
|
-
await
|
|
9178
|
+
await _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
9179
9179
|
functions: functionDefinitions
|
|
9180
9180
|
});
|
|
9181
9181
|
}
|
|
@@ -9198,7 +9198,7 @@ var ToolBuilder = (_class8 = class {
|
|
|
9198
9198
|
const tool = new CodeFunction(this.project, {
|
|
9199
9199
|
handler,
|
|
9200
9200
|
name: resolvedName,
|
|
9201
|
-
slug: _nullishCoalesce(slug, () => (
|
|
9201
|
+
slug: _nullishCoalesce(slug, () => ( _chunkB6ZQIAK3js.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
9202
9202
|
type: "tool",
|
|
9203
9203
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
9204
9204
|
parameters,
|
|
@@ -9224,7 +9224,7 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9224
9224
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9225
9225
|
resolvedName = `Scorer ${_chunkCDIKAHDZjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9226
9226
|
}
|
|
9227
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9227
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkB6ZQIAK3js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9228
9228
|
if ("handler" in opts) {
|
|
9229
9229
|
const scorer = new CodeFunction(this.project, {
|
|
9230
9230
|
...opts,
|
|
@@ -9280,7 +9280,7 @@ var ClassifierBuilder = (_class10 = class {
|
|
|
9280
9280
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9281
9281
|
resolvedName = `Classifier ${_chunkCDIKAHDZjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9282
9282
|
}
|
|
9283
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9283
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkB6ZQIAK3js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9284
9284
|
const classifier = new CodeFunction(this.project, {
|
|
9285
9285
|
...opts,
|
|
9286
9286
|
name: resolvedName,
|
|
@@ -9407,18 +9407,18 @@ var PromptBuilder = class {
|
|
|
9407
9407
|
rawTools.push(tool);
|
|
9408
9408
|
}
|
|
9409
9409
|
}
|
|
9410
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9410
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkB6ZQIAK3js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9411
9411
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
9412
9412
|
const promptRow = {
|
|
9413
9413
|
id: opts.id,
|
|
9414
|
-
_xact_id: opts.version ?
|
|
9414
|
+
_xact_id: opts.version ? _chunkB6ZQIAK3js.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
9415
9415
|
name: opts.name,
|
|
9416
9416
|
slug,
|
|
9417
9417
|
prompt_data: promptData,
|
|
9418
9418
|
tags: opts.tags,
|
|
9419
9419
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
9420
9420
|
};
|
|
9421
|
-
const prompt = new (0,
|
|
9421
|
+
const prompt = new (0, _chunkB6ZQIAK3js.Prompt)(
|
|
9422
9422
|
promptRow,
|
|
9423
9423
|
{},
|
|
9424
9424
|
// It doesn't make sense to specify defaults here.
|
|
@@ -9472,7 +9472,7 @@ var ParametersBuilder = class {
|
|
|
9472
9472
|
this.project = project;
|
|
9473
9473
|
}
|
|
9474
9474
|
create(opts) {
|
|
9475
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9475
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkB6ZQIAK3js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9476
9476
|
const codeParameters = new CodeParameters(this.project, {
|
|
9477
9477
|
name: opts.name,
|
|
9478
9478
|
slug,
|
|
@@ -9511,7 +9511,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
9511
9511
|
required.push(name);
|
|
9512
9512
|
}
|
|
9513
9513
|
} else {
|
|
9514
|
-
const schemaObj =
|
|
9514
|
+
const schemaObj = _chunkB6ZQIAK3js.zodToJsonSchema.call(void 0, value);
|
|
9515
9515
|
properties[name] = schemaObj;
|
|
9516
9516
|
if (!("default" in schemaObj)) {
|
|
9517
9517
|
required.push(name);
|
|
@@ -9540,11 +9540,11 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9540
9540
|
__init23() {this.idToName = {}}
|
|
9541
9541
|
async getId(projectName) {
|
|
9542
9542
|
if (!(projectName in this.nameToId)) {
|
|
9543
|
-
const response = await
|
|
9543
|
+
const response = await _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
9544
9544
|
project_name: projectName
|
|
9545
9545
|
});
|
|
9546
9546
|
const result = _v3.z.object({
|
|
9547
|
-
project:
|
|
9547
|
+
project: _chunkB6ZQIAK3js.Project
|
|
9548
9548
|
}).parse(response);
|
|
9549
9549
|
const projectId = result.project.id;
|
|
9550
9550
|
this.nameToId[projectName] = projectId;
|
|
@@ -9554,10 +9554,10 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9554
9554
|
}
|
|
9555
9555
|
async getName(projectId) {
|
|
9556
9556
|
if (!(projectId in this.idToName)) {
|
|
9557
|
-
const response = await
|
|
9557
|
+
const response = await _chunkB6ZQIAK3js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
9558
9558
|
id: projectId
|
|
9559
9559
|
});
|
|
9560
|
-
const result = _v3.z.array(
|
|
9560
|
+
const result = _v3.z.array(_chunkB6ZQIAK3js.Project).nonempty().parse(response);
|
|
9561
9561
|
const projectName = result[0].name;
|
|
9562
9562
|
this.idToName[projectId] = projectName;
|
|
9563
9563
|
this.nameToId[projectName] = projectId;
|
|
@@ -9577,16 +9577,16 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9577
9577
|
var evalBodySchema = _v3.z.object({
|
|
9578
9578
|
name: _v3.z.string(),
|
|
9579
9579
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
9580
|
-
data:
|
|
9580
|
+
data: _chunkB6ZQIAK3js.RunEval.shape.data,
|
|
9581
9581
|
scores: _v3.z.array(
|
|
9582
9582
|
_v3.z.object({
|
|
9583
|
-
function_id:
|
|
9583
|
+
function_id: _chunkB6ZQIAK3js.FunctionId,
|
|
9584
9584
|
name: _v3.z.string()
|
|
9585
9585
|
})
|
|
9586
9586
|
).nullish(),
|
|
9587
9587
|
experiment_name: _v3.z.string().nullish(),
|
|
9588
9588
|
project_id: _v3.z.string().nullish(),
|
|
9589
|
-
parent:
|
|
9589
|
+
parent: _chunkB6ZQIAK3js.InvokeParent.optional(),
|
|
9590
9590
|
stream: _v3.z.boolean().optional()
|
|
9591
9591
|
});
|
|
9592
9592
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -9594,7 +9594,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
9594
9594
|
_v3.z.union([
|
|
9595
9595
|
_v3.z.object({
|
|
9596
9596
|
type: _v3.z.literal("prompt"),
|
|
9597
|
-
default:
|
|
9597
|
+
default: _chunkB6ZQIAK3js.PromptData.optional(),
|
|
9598
9598
|
description: _v3.z.string().optional()
|
|
9599
9599
|
}),
|
|
9600
9600
|
_v3.z.object({
|
|
@@ -9650,7 +9650,7 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
9650
9650
|
);
|
|
9651
9651
|
|
|
9652
9652
|
// src/node/index.ts
|
|
9653
|
-
|
|
9653
|
+
_chunkB6ZQIAK3js.configureNode.call(void 0, );
|
|
9654
9654
|
|
|
9655
9655
|
|
|
9656
9656
|
|
|
@@ -9821,4 +9821,4 @@ _chunkFZWPFCVEjs.configureNode.call(void 0, );
|
|
|
9821
9821
|
|
|
9822
9822
|
|
|
9823
9823
|
|
|
9824
|
-
exports.Attachment =
|
|
9824
|
+
exports.Attachment = _chunkB6ZQIAK3js.Attachment; exports.AttachmentReference = _chunkB6ZQIAK3js.AttachmentReference; exports.BAGGAGE_HEADER = _chunkB6ZQIAK3js.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkB6ZQIAK3js.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkB6ZQIAK3js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkB6ZQIAK3js.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkB6ZQIAK3js.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = _chunkB6ZQIAK3js.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkB6ZQIAK3js.BraintrustObservabilityExporter; exports.BraintrustState = _chunkB6ZQIAK3js.BraintrustState; exports.BraintrustStream = _chunkB6ZQIAK3js.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkB6ZQIAK3js.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkB6ZQIAK3js.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkB6ZQIAK3js.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkB6ZQIAK3js.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = _chunkB6ZQIAK3js.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkB6ZQIAK3js.Experiment; exports.ExternalAttachment = _chunkB6ZQIAK3js.ExternalAttachment; exports.FailedHTTPResponse = _chunkB6ZQIAK3js.FailedHTTPResponse; exports.IDGenerator = _chunkB6ZQIAK3js.IDGenerator; exports.JSONAttachment = _chunkB6ZQIAK3js.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkB6ZQIAK3js.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkB6ZQIAK3js.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkB6ZQIAK3js.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkB6ZQIAK3js.Logger; exports.LoginInvalidOrgError = _chunkB6ZQIAK3js.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkB6ZQIAK3js.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkB6ZQIAK3js.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkB6ZQIAK3js.NoopSpan; exports.OTELIDGenerator = _chunkB6ZQIAK3js.OTELIDGenerator; exports.ObjectFetcher = _chunkB6ZQIAK3js.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkB6ZQIAK3js.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkB6ZQIAK3js.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkB6ZQIAK3js.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkB6ZQIAK3js.SpanImpl; exports.TRACEPARENT_HEADER = _chunkB6ZQIAK3js.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkB6ZQIAK3js.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkB6ZQIAK3js.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkB6ZQIAK3js.UUIDGenerator; exports.X_CACHED_HEADER = _chunkB6ZQIAK3js.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkB6ZQIAK3js._exportsForTestingOnly; exports._internalGetGlobalState = _chunkB6ZQIAK3js._internalGetGlobalState; exports._internalIso = _chunkCDIKAHDZjs.isomorph_default; exports._internalSetInitialState = _chunkB6ZQIAK3js._internalSetInitialState; exports.addAzureBlobHeaders = _chunkB6ZQIAK3js.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkB6ZQIAK3js.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkB6ZQIAK3js.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkB6ZQIAK3js.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkB6ZQIAK3js.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = _chunkB6ZQIAK3js.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkB6ZQIAK3js.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkB6ZQIAK3js.createFinalValuePassThroughStream; exports.currentExperiment = _chunkB6ZQIAK3js.currentExperiment; exports.currentLogger = _chunkB6ZQIAK3js.currentLogger; exports.currentSpan = _chunkB6ZQIAK3js.currentSpan; exports.deepCopyEvent = _chunkB6ZQIAK3js.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = _chunkB6ZQIAK3js.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkB6ZQIAK3js.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkB6ZQIAK3js.extractTraceContextFromHeaders; exports.flush = _chunkB6ZQIAK3js.flush; exports.getContextManager = _chunkB6ZQIAK3js.getContextManager; exports.getIdGenerator = _chunkB6ZQIAK3js.getIdGenerator; exports.getPromptVersions = _chunkB6ZQIAK3js.getPromptVersions; exports.getSpanParentObject = _chunkB6ZQIAK3js.getSpanParentObject; exports.getTemplateRenderer = _chunkB6ZQIAK3js.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkB6ZQIAK3js.init; exports.initDataset = _chunkB6ZQIAK3js.initDataset; exports.initExperiment = _chunkB6ZQIAK3js.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkB6ZQIAK3js.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkB6ZQIAK3js.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkB6ZQIAK3js.isTemplateFormat; exports.loadParameters = _chunkB6ZQIAK3js.loadParameters; exports.loadPrompt = _chunkB6ZQIAK3js.loadPrompt; exports.log = _chunkB6ZQIAK3js.log; exports.logError = _chunkB6ZQIAK3js.logError; exports.login = _chunkB6ZQIAK3js.login; exports.loginToState = _chunkB6ZQIAK3js.loginToState; exports.logs3OverflowUploadSchema = _chunkB6ZQIAK3js.logs3OverflowUploadSchema; exports.newId = _chunkB6ZQIAK3js.newId; exports.parseCachedHeader = _chunkB6ZQIAK3js.parseCachedHeader; exports.parseTemplateFormat = _chunkB6ZQIAK3js.parseTemplateFormat; exports.permalink = _chunkB6ZQIAK3js.permalink; exports.pickLogs3OverflowObjectIds = _chunkB6ZQIAK3js.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkB6ZQIAK3js.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkB6ZQIAK3js.registerTemplatePlugin; exports.renderMessage = _chunkB6ZQIAK3js.renderMessage; exports.renderPromptParams = _chunkB6ZQIAK3js.renderPromptParams; exports.renderTemplateContent = _chunkB6ZQIAK3js.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkB6ZQIAK3js.setFetch; exports.setMaskingFunction = _chunkB6ZQIAK3js.setMaskingFunction; exports.spanComponentsToObjectId = _chunkB6ZQIAK3js.spanComponentsToObjectId; exports.startSpan = _chunkB6ZQIAK3js.startSpan; exports.summarize = _chunkB6ZQIAK3js.summarize; exports.templateRegistry = _chunkB6ZQIAK3js.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkB6ZQIAK3js.ToolFunctionDefinition; exports.traceable = _chunkB6ZQIAK3js.traceable; exports.traced = _chunkB6ZQIAK3js.traced; exports.updateSpan = _chunkB6ZQIAK3js.updateSpan; exports.uploadLogs3OverflowPayload = _chunkB6ZQIAK3js.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkB6ZQIAK3js.utf8ByteLength; exports.withCurrent = _chunkB6ZQIAK3js.withCurrent; exports.withDataset = _chunkB6ZQIAK3js.withDataset; exports.withExperiment = _chunkB6ZQIAK3js.withExperiment; exports.withLogger = _chunkB6ZQIAK3js.withLogger; exports.withParent = _chunkB6ZQIAK3js.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkB6ZQIAK3js.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkB6ZQIAK3js.wrapTraced; exports.wrapVitest = wrapVitest;
|