braintrust 3.31.0 → 3.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/dist/index.d.mts +736 -0
- package/dev/dist/index.d.ts +736 -0
- package/dev/dist/index.js +1280 -428
- package/dev/dist/index.mjs +859 -7
- package/dist/apply-auto-instrumentation.js +281 -216
- package/dist/apply-auto-instrumentation.mjs +66 -1
- package/dist/auto-instrumentations/bundler/esbuild.cjs +104 -2
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +104 -2
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +104 -2
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +104 -2
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +104 -2
- package/dist/auto-instrumentations/bundler/webpack.cjs +104 -2
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-U64OYU4Q.mjs → chunk-AFND2U7E.mjs} +38 -1
- package/dist/auto-instrumentations/{chunk-OXINGIEZ.mjs → chunk-QEEPRBIS.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-LW4HDHXT.mjs → chunk-RI4Y55ZF.mjs} +69 -2
- package/dist/auto-instrumentations/hook.mjs +124 -3
- package/dist/auto-instrumentations/index.cjs +39 -1
- package/dist/auto-instrumentations/index.d.mts +3 -1
- package/dist/auto-instrumentations/index.d.ts +3 -1
- package/dist/auto-instrumentations/index.mjs +3 -1
- package/dist/browser.d.mts +2124 -2
- package/dist/browser.d.ts +2124 -2
- package/dist/browser.js +994 -10
- package/dist/browser.mjs +994 -10
- package/dist/{chunk-AJT4FR25.mjs → chunk-4QSAHP7D.mjs} +818 -5
- package/dist/{chunk-4AQGZS6X.js → chunk-AW4QECG5.js} +47 -4
- package/dist/{chunk-V32LW47Z.js → chunk-BTRLPQG5.js} +1663 -850
- package/dist/{chunk-CE3BLB2L.mjs → chunk-WV6QZI2W.mjs} +46 -3
- package/dist/cli.js +923 -8
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +994 -10
- package/dist/edge-light.mjs +994 -10
- package/dist/index.d.mts +2124 -2
- package/dist/index.d.ts +2124 -2
- package/dist/index.js +581 -447
- package/dist/index.mjs +136 -2
- package/dist/instrumentation/index.d.mts +434 -0
- package/dist/instrumentation/index.d.ts +434 -0
- package/dist/instrumentation/index.js +859 -7
- package/dist/instrumentation/index.mjs +859 -7
- 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 +994 -10
- package/dist/workerd.mjs +994 -10
- package/package.json +1 -1
- package/util/dist/index.d.mts +326 -0
- package/util/dist/index.d.ts +326 -0
package/dist/index.js
CHANGED
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
var
|
|
146
|
+
var _chunkBTRLPQG5js = require('./chunk-BTRLPQG5.js');
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
|
|
@@ -177,160 +177,162 @@ var _chunkV32LW47Zjs = require('./chunk-V32LW47Z.js');
|
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
var _chunkAW4QECG5js = require('./chunk-AW4QECG5.js');
|
|
181
183
|
|
|
182
184
|
// src/exports.ts
|
|
183
185
|
var exports_exports = {};
|
|
184
|
-
|
|
185
|
-
Attachment: () =>
|
|
186
|
-
AttachmentReference: () =>
|
|
187
|
-
BAGGAGE_HEADER: () =>
|
|
188
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
189
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
190
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
191
|
-
BaseAttachment: () =>
|
|
186
|
+
_chunkAW4QECG5js.__export.call(void 0, exports_exports, {
|
|
187
|
+
Attachment: () => _chunkBTRLPQG5js.Attachment,
|
|
188
|
+
AttachmentReference: () => _chunkBTRLPQG5js.AttachmentReference,
|
|
189
|
+
BAGGAGE_HEADER: () => _chunkBTRLPQG5js.BAGGAGE_HEADER,
|
|
190
|
+
BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkBTRLPQG5js.BRAINTRUST_CURRENT_SPAN_STORE,
|
|
191
|
+
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkBTRLPQG5js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
|
|
192
|
+
BRAINTRUST_PARENT_KEY: () => _chunkBTRLPQG5js.BRAINTRUST_PARENT_KEY,
|
|
193
|
+
BaseAttachment: () => _chunkBTRLPQG5js.BaseAttachment,
|
|
192
194
|
BaseExperiment: () => BaseExperiment,
|
|
193
195
|
BatchScorer: () => BatchScorer,
|
|
194
196
|
BatchTask: () => BatchTask,
|
|
195
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
197
|
+
BraintrustLangChainCallbackHandler: () => _chunkBTRLPQG5js.BraintrustLangChainCallbackHandler,
|
|
196
198
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
197
|
-
BraintrustObservabilityExporter: () =>
|
|
198
|
-
BraintrustState: () =>
|
|
199
|
-
BraintrustStream: () =>
|
|
199
|
+
BraintrustObservabilityExporter: () => _chunkBTRLPQG5js.BraintrustObservabilityExporter,
|
|
200
|
+
BraintrustState: () => _chunkBTRLPQG5js.BraintrustState,
|
|
201
|
+
BraintrustStream: () => _chunkBTRLPQG5js.BraintrustStream,
|
|
200
202
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
201
203
|
CodeFunction: () => CodeFunction,
|
|
202
204
|
CodePrompt: () => CodePrompt,
|
|
203
|
-
ContextManager: () =>
|
|
204
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
205
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
206
|
-
Dataset: () =>
|
|
205
|
+
ContextManager: () => _chunkBTRLPQG5js.ContextManager,
|
|
206
|
+
DEFAULT_FETCH_BATCH_SIZE: () => _chunkBTRLPQG5js.DEFAULT_FETCH_BATCH_SIZE,
|
|
207
|
+
DEFAULT_MAX_REQUEST_SIZE: () => _chunkBTRLPQG5js.DEFAULT_MAX_REQUEST_SIZE,
|
|
208
|
+
Dataset: () => _chunkBTRLPQG5js.Dataset,
|
|
207
209
|
DatasetPipeline: () => DatasetPipeline,
|
|
208
210
|
DurableEvalMemoryStore: () => DurableEvalMemoryStore,
|
|
209
211
|
DurableEvalRedisStore: () => DurableEvalRedisStore,
|
|
210
|
-
ERR_PERMALINK: () =>
|
|
212
|
+
ERR_PERMALINK: () => _chunkBTRLPQG5js.ERR_PERMALINK,
|
|
211
213
|
Eval: () => Eval,
|
|
212
214
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
213
|
-
Experiment: () =>
|
|
214
|
-
ExternalAttachment: () =>
|
|
215
|
-
FailedHTTPResponse: () =>
|
|
216
|
-
IDGenerator: () =>
|
|
217
|
-
JSONAttachment: () =>
|
|
218
|
-
LEGACY_CACHED_HEADER: () =>
|
|
219
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
220
|
-
LazyValue: () =>
|
|
215
|
+
Experiment: () => _chunkBTRLPQG5js.Experiment,
|
|
216
|
+
ExternalAttachment: () => _chunkBTRLPQG5js.ExternalAttachment,
|
|
217
|
+
FailedHTTPResponse: () => _chunkBTRLPQG5js.FailedHTTPResponse,
|
|
218
|
+
IDGenerator: () => _chunkBTRLPQG5js.IDGenerator,
|
|
219
|
+
JSONAttachment: () => _chunkBTRLPQG5js.JSONAttachment,
|
|
220
|
+
LEGACY_CACHED_HEADER: () => _chunkBTRLPQG5js.LEGACY_CACHED_HEADER,
|
|
221
|
+
LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkBTRLPQG5js.LOGS3_OVERFLOW_REFERENCE_TYPE,
|
|
222
|
+
LazyValue: () => _chunkBTRLPQG5js.LazyValue,
|
|
221
223
|
LocalTrace: () => LocalTrace,
|
|
222
|
-
Logger: () =>
|
|
223
|
-
LoginInvalidOrgError: () =>
|
|
224
|
-
NOOP_SPAN: () =>
|
|
225
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
226
|
-
NoopSpan: () =>
|
|
227
|
-
OTELIDGenerator: () =>
|
|
228
|
-
ObjectFetcher: () =>
|
|
224
|
+
Logger: () => _chunkBTRLPQG5js.Logger,
|
|
225
|
+
LoginInvalidOrgError: () => _chunkBTRLPQG5js.LoginInvalidOrgError,
|
|
226
|
+
NOOP_SPAN: () => _chunkBTRLPQG5js.NOOP_SPAN,
|
|
227
|
+
NOOP_SPAN_PERMALINK: () => _chunkBTRLPQG5js.NOOP_SPAN_PERMALINK,
|
|
228
|
+
NoopSpan: () => _chunkBTRLPQG5js.NoopSpan,
|
|
229
|
+
OTELIDGenerator: () => _chunkBTRLPQG5js.OTELIDGenerator,
|
|
230
|
+
ObjectFetcher: () => _chunkBTRLPQG5js.ObjectFetcher,
|
|
229
231
|
Project: () => Project2,
|
|
230
232
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
231
|
-
Prompt: () =>
|
|
233
|
+
Prompt: () => _chunkBTRLPQG5js.Prompt,
|
|
232
234
|
PromptBuilder: () => PromptBuilder,
|
|
233
|
-
ReadonlyAttachment: () =>
|
|
234
|
-
ReadonlyExperiment: () =>
|
|
235
|
+
ReadonlyAttachment: () => _chunkBTRLPQG5js.ReadonlyAttachment,
|
|
236
|
+
ReadonlyExperiment: () => _chunkBTRLPQG5js.ReadonlyExperiment,
|
|
235
237
|
Reporter: () => Reporter,
|
|
236
238
|
ScorerBuilder: () => ScorerBuilder,
|
|
237
239
|
SpanFetcher: () => SpanFetcher,
|
|
238
|
-
SpanImpl: () =>
|
|
239
|
-
TRACEPARENT_HEADER: () =>
|
|
240
|
-
TRACESTATE_HEADER: () =>
|
|
241
|
-
TestBackgroundLogger: () =>
|
|
240
|
+
SpanImpl: () => _chunkBTRLPQG5js.SpanImpl,
|
|
241
|
+
TRACEPARENT_HEADER: () => _chunkBTRLPQG5js.TRACEPARENT_HEADER,
|
|
242
|
+
TRACESTATE_HEADER: () => _chunkBTRLPQG5js.TRACESTATE_HEADER,
|
|
243
|
+
TestBackgroundLogger: () => _chunkBTRLPQG5js.TestBackgroundLogger,
|
|
242
244
|
ToolBuilder: () => ToolBuilder,
|
|
243
|
-
UUIDGenerator: () =>
|
|
244
|
-
X_CACHED_HEADER: () =>
|
|
245
|
-
_exportsForTestingOnly: () =>
|
|
246
|
-
_internalGetGlobalState: () =>
|
|
247
|
-
_internalIso: () =>
|
|
248
|
-
_internalSetInitialState: () =>
|
|
249
|
-
addAzureBlobHeaders: () =>
|
|
245
|
+
UUIDGenerator: () => _chunkBTRLPQG5js.UUIDGenerator,
|
|
246
|
+
X_CACHED_HEADER: () => _chunkBTRLPQG5js.X_CACHED_HEADER,
|
|
247
|
+
_exportsForTestingOnly: () => _chunkBTRLPQG5js._exportsForTestingOnly,
|
|
248
|
+
_internalGetGlobalState: () => _chunkBTRLPQG5js._internalGetGlobalState,
|
|
249
|
+
_internalIso: () => _chunkAW4QECG5js.isomorph_default,
|
|
250
|
+
_internalSetInitialState: () => _chunkBTRLPQG5js._internalSetInitialState,
|
|
251
|
+
addAzureBlobHeaders: () => _chunkBTRLPQG5js.addAzureBlobHeaders,
|
|
250
252
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
251
|
-
braintrustAISDKTelemetry: () =>
|
|
253
|
+
braintrustAISDKTelemetry: () => _chunkBTRLPQG5js.braintrustAISDKTelemetry,
|
|
252
254
|
braintrustEveHook: () => braintrustEveHook,
|
|
253
255
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
254
|
-
braintrustFlueInstrumentation: () =>
|
|
255
|
-
braintrustFlueObserver: () =>
|
|
256
|
-
braintrustStreamChunkSchema: () =>
|
|
256
|
+
braintrustFlueInstrumentation: () => _chunkBTRLPQG5js.braintrustFlueInstrumentation,
|
|
257
|
+
braintrustFlueObserver: () => _chunkBTRLPQG5js.braintrustFlueObserver,
|
|
258
|
+
braintrustStreamChunkSchema: () => _chunkBTRLPQG5js.braintrustStreamChunkSchema,
|
|
257
259
|
buildLocalSummary: () => buildLocalSummary,
|
|
258
|
-
collectAnthropicSession: () =>
|
|
260
|
+
collectAnthropicSession: () => _chunkBTRLPQG5js.collectAnthropicSession,
|
|
259
261
|
completeOpenAIBatchTrace: () => completeOpenAIBatchTrace,
|
|
260
|
-
configureInstrumentation: () =>
|
|
261
|
-
constructLogs3OverflowRequest: () =>
|
|
262
|
-
createFinalValuePassThroughStream: () =>
|
|
263
|
-
currentExperiment: () =>
|
|
264
|
-
currentLogger: () =>
|
|
265
|
-
currentSpan: () =>
|
|
266
|
-
deepCopyEvent: () =>
|
|
262
|
+
configureInstrumentation: () => _chunkBTRLPQG5js.configureInstrumentation,
|
|
263
|
+
constructLogs3OverflowRequest: () => _chunkBTRLPQG5js.constructLogs3OverflowRequest,
|
|
264
|
+
createFinalValuePassThroughStream: () => _chunkBTRLPQG5js.createFinalValuePassThroughStream,
|
|
265
|
+
currentExperiment: () => _chunkBTRLPQG5js.currentExperiment,
|
|
266
|
+
currentLogger: () => _chunkBTRLPQG5js.currentLogger,
|
|
267
|
+
currentSpan: () => _chunkBTRLPQG5js.currentSpan,
|
|
268
|
+
deepCopyEvent: () => _chunkBTRLPQG5js.deepCopyEvent,
|
|
267
269
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
268
270
|
defineDurableEval: () => defineDurableEval,
|
|
269
|
-
deserializePlainStringAsJSON: () =>
|
|
270
|
-
devNullWritableStream: () =>
|
|
271
|
+
deserializePlainStringAsJSON: () => _chunkBTRLPQG5js.deserializePlainStringAsJSON,
|
|
272
|
+
devNullWritableStream: () => _chunkBTRLPQG5js.devNullWritableStream,
|
|
271
273
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
272
274
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
273
|
-
extractTraceContextFromHeaders: () =>
|
|
274
|
-
flush: () =>
|
|
275
|
-
getContextManager: () =>
|
|
276
|
-
getIdGenerator: () =>
|
|
277
|
-
getPromptVersions: () =>
|
|
278
|
-
getSpanParentObject: () =>
|
|
279
|
-
getTemplateRenderer: () =>
|
|
275
|
+
extractTraceContextFromHeaders: () => _chunkBTRLPQG5js.extractTraceContextFromHeaders,
|
|
276
|
+
flush: () => _chunkBTRLPQG5js.flush,
|
|
277
|
+
getContextManager: () => _chunkBTRLPQG5js.getContextManager,
|
|
278
|
+
getIdGenerator: () => _chunkBTRLPQG5js.getIdGenerator,
|
|
279
|
+
getPromptVersions: () => _chunkBTRLPQG5js.getPromptVersions,
|
|
280
|
+
getSpanParentObject: () => _chunkBTRLPQG5js.getSpanParentObject,
|
|
281
|
+
getTemplateRenderer: () => _chunkBTRLPQG5js.getTemplateRenderer,
|
|
280
282
|
graph: () => graph_framework_exports,
|
|
281
|
-
init: () =>
|
|
282
|
-
initDataset: () =>
|
|
283
|
-
initExperiment: () =>
|
|
283
|
+
init: () => _chunkBTRLPQG5js.init,
|
|
284
|
+
initDataset: () => _chunkBTRLPQG5js.initDataset,
|
|
285
|
+
initExperiment: () => _chunkBTRLPQG5js.initExperiment,
|
|
284
286
|
initFunction: () => initFunction,
|
|
285
|
-
initLogger: () =>
|
|
287
|
+
initLogger: () => _chunkBTRLPQG5js.initLogger,
|
|
286
288
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
287
|
-
injectTraceContext: () =>
|
|
289
|
+
injectTraceContext: () => _chunkBTRLPQG5js.injectTraceContext,
|
|
288
290
|
invoke: () => invoke,
|
|
289
|
-
isTemplateFormat: () =>
|
|
290
|
-
loadParameters: () =>
|
|
291
|
-
loadPrompt: () =>
|
|
292
|
-
log: () =>
|
|
293
|
-
logError: () =>
|
|
294
|
-
login: () =>
|
|
295
|
-
loginToState: () =>
|
|
296
|
-
logs3OverflowUploadSchema: () =>
|
|
297
|
-
newId: () =>
|
|
291
|
+
isTemplateFormat: () => _chunkBTRLPQG5js.isTemplateFormat,
|
|
292
|
+
loadParameters: () => _chunkBTRLPQG5js.loadParameters,
|
|
293
|
+
loadPrompt: () => _chunkBTRLPQG5js.loadPrompt,
|
|
294
|
+
log: () => _chunkBTRLPQG5js.log,
|
|
295
|
+
logError: () => _chunkBTRLPQG5js.logError,
|
|
296
|
+
login: () => _chunkBTRLPQG5js.login,
|
|
297
|
+
loginToState: () => _chunkBTRLPQG5js.loginToState,
|
|
298
|
+
logs3OverflowUploadSchema: () => _chunkBTRLPQG5js.logs3OverflowUploadSchema,
|
|
299
|
+
newId: () => _chunkBTRLPQG5js.newId,
|
|
298
300
|
openaiBatchesRetrieveTraced: () => openaiBatchesRetrieveTraced,
|
|
299
301
|
openaiFilesCreateTraced: () => openaiFilesCreateTraced,
|
|
300
|
-
parseCachedHeader: () =>
|
|
301
|
-
parseTemplateFormat: () =>
|
|
302
|
-
permalink: () =>
|
|
303
|
-
pickLogs3OverflowObjectIds: () =>
|
|
302
|
+
parseCachedHeader: () => _chunkBTRLPQG5js.parseCachedHeader,
|
|
303
|
+
parseTemplateFormat: () => _chunkBTRLPQG5js.parseTemplateFormat,
|
|
304
|
+
permalink: () => _chunkBTRLPQG5js.permalink,
|
|
305
|
+
pickLogs3OverflowObjectIds: () => _chunkBTRLPQG5js.pickLogs3OverflowObjectIds,
|
|
304
306
|
projects: () => projects,
|
|
305
307
|
promptContentsSchema: () => promptContentsSchema,
|
|
306
308
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
307
309
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
308
310
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
309
|
-
registerOtelFlush: () =>
|
|
311
|
+
registerOtelFlush: () => _chunkBTRLPQG5js.registerOtelFlush,
|
|
310
312
|
registerSandbox: () => registerSandbox,
|
|
311
|
-
registerTemplatePlugin: () =>
|
|
312
|
-
renderMessage: () =>
|
|
313
|
-
renderPromptParams: () =>
|
|
314
|
-
renderTemplateContent: () =>
|
|
313
|
+
registerTemplatePlugin: () => _chunkBTRLPQG5js.registerTemplatePlugin,
|
|
314
|
+
renderMessage: () => _chunkBTRLPQG5js.renderMessage,
|
|
315
|
+
renderPromptParams: () => _chunkBTRLPQG5js.renderPromptParams,
|
|
316
|
+
renderTemplateContent: () => _chunkBTRLPQG5js.renderTemplateContent,
|
|
315
317
|
reportFailures: () => reportFailures,
|
|
316
318
|
runEvaluator: () => runEvaluator,
|
|
317
|
-
setFetch: () =>
|
|
318
|
-
setMaskingFunction: () =>
|
|
319
|
-
spanComponentsToObjectId: () =>
|
|
320
|
-
startSpan: () =>
|
|
321
|
-
summarize: () =>
|
|
322
|
-
templateRegistry: () =>
|
|
323
|
-
toolFunctionDefinitionSchema: () =>
|
|
324
|
-
traceable: () =>
|
|
325
|
-
traced: () =>
|
|
326
|
-
updateSpan: () =>
|
|
327
|
-
uploadLogs3OverflowPayload: () =>
|
|
328
|
-
utf8ByteLength: () =>
|
|
329
|
-
withCurrent: () =>
|
|
330
|
-
withDataset: () =>
|
|
331
|
-
withExperiment: () =>
|
|
332
|
-
withLogger: () =>
|
|
333
|
-
withParent: () =>
|
|
319
|
+
setFetch: () => _chunkBTRLPQG5js.setFetch,
|
|
320
|
+
setMaskingFunction: () => _chunkBTRLPQG5js.setMaskingFunction,
|
|
321
|
+
spanComponentsToObjectId: () => _chunkBTRLPQG5js.spanComponentsToObjectId,
|
|
322
|
+
startSpan: () => _chunkBTRLPQG5js.startSpan,
|
|
323
|
+
summarize: () => _chunkBTRLPQG5js.summarize,
|
|
324
|
+
templateRegistry: () => _chunkBTRLPQG5js.templateRegistry,
|
|
325
|
+
toolFunctionDefinitionSchema: () => _chunkBTRLPQG5js.ToolFunctionDefinition,
|
|
326
|
+
traceable: () => _chunkBTRLPQG5js.traceable,
|
|
327
|
+
traced: () => _chunkBTRLPQG5js.traced,
|
|
328
|
+
updateSpan: () => _chunkBTRLPQG5js.updateSpan,
|
|
329
|
+
uploadLogs3OverflowPayload: () => _chunkBTRLPQG5js.uploadLogs3OverflowPayload,
|
|
330
|
+
utf8ByteLength: () => _chunkBTRLPQG5js.utf8ByteLength,
|
|
331
|
+
withCurrent: () => _chunkBTRLPQG5js.withCurrent,
|
|
332
|
+
withDataset: () => _chunkBTRLPQG5js.withDataset,
|
|
333
|
+
withExperiment: () => _chunkBTRLPQG5js.withExperiment,
|
|
334
|
+
withLogger: () => _chunkBTRLPQG5js.withLogger,
|
|
335
|
+
withParent: () => _chunkBTRLPQG5js.withParent,
|
|
334
336
|
wrapAISDK: () => wrapAISDK,
|
|
335
337
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
336
338
|
wrapAgentClass: () => wrapAgentClass,
|
|
@@ -343,16 +345,18 @@ _chunk4AQGZS6Xjs.__export.call(void 0, exports_exports, {
|
|
|
343
345
|
wrapCohere: () => wrapCohere,
|
|
344
346
|
wrapCopilotClient: () => wrapCopilotClient,
|
|
345
347
|
wrapCursorSDK: () => wrapCursorSDK,
|
|
348
|
+
wrapElevenLabs: () => wrapElevenLabs,
|
|
346
349
|
wrapGenkit: () => wrapGenkit,
|
|
347
350
|
wrapGoogleADK: () => wrapGoogleADK,
|
|
348
351
|
wrapGoogleGenAI: () => wrapGoogleGenAI,
|
|
352
|
+
wrapGoogleGenerativeAI: () => wrapGoogleGenerativeAI,
|
|
349
353
|
wrapGroq: () => wrapGroq,
|
|
350
354
|
wrapHuggingFace: () => wrapHuggingFace,
|
|
351
355
|
wrapHuggingFaceTransformers: () => wrapHuggingFaceTransformers,
|
|
352
356
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
353
357
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
354
358
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
355
|
-
wrapMastraAgent: () =>
|
|
359
|
+
wrapMastraAgent: () => _chunkBTRLPQG5js.wrapMastraAgent,
|
|
356
360
|
wrapMistral: () => wrapMistral,
|
|
357
361
|
wrapOllama: () => wrapOllama,
|
|
358
362
|
wrapOpenAI: () => wrapOpenAI,
|
|
@@ -362,7 +366,7 @@ _chunk4AQGZS6Xjs.__export.call(void 0, exports_exports, {
|
|
|
362
366
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
363
367
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
364
368
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
365
|
-
wrapTraced: () =>
|
|
369
|
+
wrapTraced: () => _chunkBTRLPQG5js.wrapTraced,
|
|
366
370
|
wrapVitest: () => wrapVitest,
|
|
367
371
|
wrapVoyageAI: () => wrapVoyageAI
|
|
368
372
|
});
|
|
@@ -371,7 +375,7 @@ _chunk4AQGZS6Xjs.__export.call(void 0, exports_exports, {
|
|
|
371
375
|
var _v3 = require('zod/v3');
|
|
372
376
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
373
377
|
async function registerSandbox(options) {
|
|
374
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
378
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )));
|
|
375
379
|
await state.login({
|
|
376
380
|
apiKey: options.apiKey,
|
|
377
381
|
appUrl: options.appUrl,
|
|
@@ -412,7 +416,7 @@ async function registerSandbox(options) {
|
|
|
412
416
|
evaluatorDefinitions
|
|
413
417
|
)) {
|
|
414
418
|
const functionName = evalName;
|
|
415
|
-
const functionSlug =
|
|
419
|
+
const functionSlug = _chunkBTRLPQG5js.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
416
420
|
const functionDef = {
|
|
417
421
|
project_id: projectId,
|
|
418
422
|
org_name: state.orgName,
|
|
@@ -622,7 +626,7 @@ function teeUpload(upload) {
|
|
|
622
626
|
}
|
|
623
627
|
function openaiFilesCreateTraced(files) {
|
|
624
628
|
return (params, options) => {
|
|
625
|
-
const parent =
|
|
629
|
+
const parent = _chunkBTRLPQG5js.getSpanParentObject.call(void 0, );
|
|
626
630
|
const purpose = read(params, "purpose");
|
|
627
631
|
const file = read(params, "file");
|
|
628
632
|
if (purpose !== "batch") {
|
|
@@ -643,7 +647,7 @@ function openaiFilesCreateTraced(files) {
|
|
|
643
647
|
};
|
|
644
648
|
const apiPromise = files.create(tracedParams, options);
|
|
645
649
|
let enhancedResponse;
|
|
646
|
-
const tracedResponse =
|
|
650
|
+
const tracedResponse = _chunkAW4QECG5js.openAIChannels.filesCreateTraced.invoke(
|
|
647
651
|
async () => {
|
|
648
652
|
enhancedResponse = await apiPromise.withResponse();
|
|
649
653
|
return enhancedResponse.data;
|
|
@@ -670,7 +674,7 @@ function openaiBatchesRetrieveTraced(batches) {
|
|
|
670
674
|
return (batchId, options) => {
|
|
671
675
|
const apiPromise = batches.retrieve(batchId, options);
|
|
672
676
|
let enhancedResponse;
|
|
673
|
-
const tracedResponse =
|
|
677
|
+
const tracedResponse = _chunkAW4QECG5js.openAIChannels.batchesRetrieveTraced.invoke(
|
|
674
678
|
async () => {
|
|
675
679
|
enhancedResponse = await apiPromise.withResponse();
|
|
676
680
|
return enhancedResponse.data;
|
|
@@ -700,7 +704,7 @@ async function completeOpenAIBatchTrace(args) {
|
|
|
700
704
|
void inputFileContent.catch(() => void 0);
|
|
701
705
|
void _optionalChain([outputFileContent, 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(() => void 0)]);
|
|
702
706
|
void _optionalChain([errorFileContent, 'optionalAccess', _6 => _6.catch, 'call', _7 => _7(() => void 0)]);
|
|
703
|
-
await
|
|
707
|
+
await _chunkAW4QECG5js.openAIChannels.batchesCompleteTrace.invoke(
|
|
704
708
|
async () => void 0,
|
|
705
709
|
void 0,
|
|
706
710
|
[
|
|
@@ -737,7 +741,7 @@ async function invoke(args) {
|
|
|
737
741
|
projectId,
|
|
738
742
|
...functionIdArgs
|
|
739
743
|
} = args;
|
|
740
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
744
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )));
|
|
741
745
|
await state.login({
|
|
742
746
|
orgName,
|
|
743
747
|
apiKey,
|
|
@@ -745,8 +749,8 @@ async function invoke(args) {
|
|
|
745
749
|
forceLogin,
|
|
746
750
|
fetch
|
|
747
751
|
});
|
|
748
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
749
|
-
const functionId =
|
|
752
|
+
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkBTRLPQG5js.getSpanParentObject.call(void 0, ).export();
|
|
753
|
+
const functionId = _chunkBTRLPQG5js.FunctionId.safeParse({
|
|
750
754
|
function_id: functionIdArgs.function_id,
|
|
751
755
|
project_name: functionIdArgs.projectName,
|
|
752
756
|
slug: functionIdArgs.slug,
|
|
@@ -789,7 +793,7 @@ async function invoke(args) {
|
|
|
789
793
|
if (!resp.body) {
|
|
790
794
|
throw new Error("Received empty stream body");
|
|
791
795
|
}
|
|
792
|
-
return new (0,
|
|
796
|
+
return new (0, _chunkBTRLPQG5js.BraintrustStream)(resp.body);
|
|
793
797
|
} else {
|
|
794
798
|
const data = await resp.json();
|
|
795
799
|
return schema ? schema.parse(data) : data;
|
|
@@ -801,7 +805,7 @@ function initFunction({
|
|
|
801
805
|
version,
|
|
802
806
|
state
|
|
803
807
|
}) {
|
|
804
|
-
const s = _nullishCoalesce(state, () => (
|
|
808
|
+
const s = _nullishCoalesce(state, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )));
|
|
805
809
|
_optionalChain([s, 'optionalAccess', _8 => _8.spanCache, 'optionalAccess', _9 => _9.disable, 'call', _10 => _10()]);
|
|
806
810
|
const f = async (input) => {
|
|
807
811
|
return await invoke({
|
|
@@ -827,22 +831,22 @@ function responsesProxy(openai) {
|
|
|
827
831
|
if (name === "create" && typeof target.create === "function") {
|
|
828
832
|
return wrapResponsesAsync(
|
|
829
833
|
target.create.bind(target),
|
|
830
|
-
|
|
834
|
+
_chunkAW4QECG5js.openAIChannels.responsesCreate
|
|
831
835
|
);
|
|
832
836
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
833
837
|
return wrapResponsesSyncStream(
|
|
834
838
|
target.stream.bind(target),
|
|
835
|
-
|
|
839
|
+
_chunkAW4QECG5js.openAIChannels.responsesStream
|
|
836
840
|
);
|
|
837
841
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
838
842
|
return wrapResponsesAsync(
|
|
839
843
|
target.parse.bind(target),
|
|
840
|
-
|
|
844
|
+
_chunkAW4QECG5js.openAIChannels.responsesParse
|
|
841
845
|
);
|
|
842
846
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
843
847
|
return wrapResponsesAsync(
|
|
844
848
|
target.compact.bind(target),
|
|
845
|
-
|
|
849
|
+
_chunkAW4QECG5js.openAIChannels.responsesCompact
|
|
846
850
|
);
|
|
847
851
|
}
|
|
848
852
|
return Reflect.get(target, name, receiver);
|
|
@@ -1002,7 +1006,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
1002
1006
|
const { span_info, params } = splitSpanInfo(
|
|
1003
1007
|
allParams
|
|
1004
1008
|
);
|
|
1005
|
-
return
|
|
1009
|
+
return _chunkAW4QECG5js.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
1006
1010
|
async () => await completion(params),
|
|
1007
1011
|
{ arguments: [params], span_info }
|
|
1008
1012
|
);
|
|
@@ -1013,7 +1017,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
1013
1017
|
const { span_info, params } = splitSpanInfo(
|
|
1014
1018
|
allParams
|
|
1015
1019
|
);
|
|
1016
|
-
return
|
|
1020
|
+
return _chunkAW4QECG5js.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
1017
1021
|
() => completion(params),
|
|
1018
1022
|
{ arguments: [params], span_info }
|
|
1019
1023
|
);
|
|
@@ -1034,7 +1038,7 @@ function wrapChatCompletion(completion) {
|
|
|
1034
1038
|
if (!executionPromise) {
|
|
1035
1039
|
executionPromise = (async () => {
|
|
1036
1040
|
const traceContext = createChannelContext(
|
|
1037
|
-
|
|
1041
|
+
_chunkAW4QECG5js.openAIChannels.chatCompletionsCreate,
|
|
1038
1042
|
params,
|
|
1039
1043
|
span_info
|
|
1040
1044
|
);
|
|
@@ -1044,7 +1048,7 @@ function wrapChatCompletion(completion) {
|
|
|
1044
1048
|
getAPIPromise()
|
|
1045
1049
|
);
|
|
1046
1050
|
const { data: data2, response: response2, request_id: request_id2 } = await tracePromiseWithResponse(
|
|
1047
|
-
|
|
1051
|
+
_chunkAW4QECG5js.openAIChannels.chatCompletionsCreate,
|
|
1048
1052
|
traceContext,
|
|
1049
1053
|
completionPromise
|
|
1050
1054
|
);
|
|
@@ -1055,7 +1059,7 @@ function wrapChatCompletion(completion) {
|
|
|
1055
1059
|
getAPIPromise()
|
|
1056
1060
|
);
|
|
1057
1061
|
const { data, response, request_id } = await tracePromiseWithResponse(
|
|
1058
|
-
|
|
1062
|
+
_chunkAW4QECG5js.openAIChannels.chatCompletionsCreate,
|
|
1059
1063
|
traceContext,
|
|
1060
1064
|
completionResponse
|
|
1061
1065
|
);
|
|
@@ -1067,9 +1071,9 @@ function wrapChatCompletion(completion) {
|
|
|
1067
1071
|
return createLazyAPIPromise(
|
|
1068
1072
|
ensureExecuted,
|
|
1069
1073
|
() => tracePromiseAsResponse(
|
|
1070
|
-
|
|
1074
|
+
_chunkAW4QECG5js.openAIChannels.chatCompletionsCreate,
|
|
1071
1075
|
createChannelContext(
|
|
1072
|
-
|
|
1076
|
+
_chunkAW4QECG5js.openAIChannels.chatCompletionsCreate,
|
|
1073
1077
|
params,
|
|
1074
1078
|
span_info
|
|
1075
1079
|
),
|
|
@@ -1123,8 +1127,8 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
1123
1127
|
);
|
|
1124
1128
|
};
|
|
1125
1129
|
}
|
|
1126
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
1127
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
1130
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkAW4QECG5js.openAIChannels.embeddingsCreate);
|
|
1131
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkAW4QECG5js.openAIChannels.moderationsCreate);
|
|
1128
1132
|
|
|
1129
1133
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
1130
1134
|
function isModuleNamespace(obj) {
|
|
@@ -1234,7 +1238,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1234
1238
|
return wrapHarnessAgentGenerate(
|
|
1235
1239
|
original,
|
|
1236
1240
|
harnessAgent,
|
|
1237
|
-
|
|
1241
|
+
_chunkAW4QECG5js.harnessAgentChannels.generate,
|
|
1238
1242
|
"HarnessAgent.generate",
|
|
1239
1243
|
options
|
|
1240
1244
|
);
|
|
@@ -1242,7 +1246,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1242
1246
|
return wrapHarnessAgentStream(
|
|
1243
1247
|
original,
|
|
1244
1248
|
harnessAgent,
|
|
1245
|
-
|
|
1249
|
+
_chunkAW4QECG5js.harnessAgentChannels.stream,
|
|
1246
1250
|
"HarnessAgent.stream",
|
|
1247
1251
|
options
|
|
1248
1252
|
);
|
|
@@ -1250,7 +1254,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1250
1254
|
return wrapHarnessAgentGenerate(
|
|
1251
1255
|
original,
|
|
1252
1256
|
harnessAgent,
|
|
1253
|
-
|
|
1257
|
+
_chunkAW4QECG5js.harnessAgentChannels.continueGenerate,
|
|
1254
1258
|
"HarnessAgent.continueGenerate",
|
|
1255
1259
|
options
|
|
1256
1260
|
);
|
|
@@ -1258,7 +1262,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1258
1262
|
return wrapHarnessAgentStream(
|
|
1259
1263
|
original,
|
|
1260
1264
|
harnessAgent,
|
|
1261
|
-
|
|
1265
|
+
_chunkAW4QECG5js.harnessAgentChannels.continueStream,
|
|
1262
1266
|
"HarnessAgent.continueStream",
|
|
1263
1267
|
options
|
|
1264
1268
|
);
|
|
@@ -1281,7 +1285,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1281
1285
|
};
|
|
1282
1286
|
var wrapHarnessAgentCreateSession = (createSession, instance) => {
|
|
1283
1287
|
const wrapper = function(params) {
|
|
1284
|
-
return
|
|
1288
|
+
return _chunkAW4QECG5js.harnessAgentChannels.createSession.tracePromise(
|
|
1285
1289
|
() => params === void 0 ? createSession.call(instance) : createSession.call(instance, params),
|
|
1286
1290
|
createAISDKChannelContext(_nullishCoalesce(params, () => ( {})), { self: instance })
|
|
1287
1291
|
);
|
|
@@ -1327,15 +1331,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
1327
1331
|
};
|
|
1328
1332
|
function generateChannelForAgent(agentName) {
|
|
1329
1333
|
if (agentName === "ToolLoopAgent") {
|
|
1330
|
-
return
|
|
1334
|
+
return _chunkAW4QECG5js.aiSDKChannels.toolLoopAgentGenerate;
|
|
1331
1335
|
}
|
|
1332
|
-
return
|
|
1336
|
+
return _chunkAW4QECG5js.aiSDKChannels.agentGenerate;
|
|
1333
1337
|
}
|
|
1334
1338
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
1335
1339
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
1336
1340
|
return (params) => {
|
|
1337
1341
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
1338
|
-
if (workflowAgent &&
|
|
1342
|
+
if (workflowAgent && _chunkBTRLPQG5js.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
1339
1343
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
1340
1344
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
1341
1345
|
}
|
|
@@ -1354,12 +1358,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
1354
1358
|
};
|
|
1355
1359
|
function streamChannelForAgent(agentName) {
|
|
1356
1360
|
if (agentName === "ToolLoopAgent") {
|
|
1357
|
-
return
|
|
1361
|
+
return _chunkAW4QECG5js.aiSDKChannels.toolLoopAgentStream;
|
|
1358
1362
|
}
|
|
1359
1363
|
if (agentName === "WorkflowAgent") {
|
|
1360
|
-
return
|
|
1364
|
+
return _chunkAW4QECG5js.aiSDKChannels.workflowAgentStream;
|
|
1361
1365
|
}
|
|
1362
|
-
return
|
|
1366
|
+
return _chunkAW4QECG5js.aiSDKChannels.agentStream;
|
|
1363
1367
|
}
|
|
1364
1368
|
var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
|
|
1365
1369
|
const wrapper = async function(allParams) {
|
|
@@ -1383,7 +1387,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
1383
1387
|
};
|
|
1384
1388
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
1385
1389
|
return makeGenerateTextWrapper(
|
|
1386
|
-
|
|
1390
|
+
_chunkAW4QECG5js.aiSDKChannels.generateText,
|
|
1387
1391
|
"generateText",
|
|
1388
1392
|
generateText,
|
|
1389
1393
|
{ aiSDK },
|
|
@@ -1392,7 +1396,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
1392
1396
|
};
|
|
1393
1397
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
1394
1398
|
return makeGenerateTextWrapper(
|
|
1395
|
-
|
|
1399
|
+
_chunkAW4QECG5js.aiSDKChannels.generateObject,
|
|
1396
1400
|
"generateObject",
|
|
1397
1401
|
generateObject,
|
|
1398
1402
|
{ aiSDK },
|
|
@@ -1406,7 +1410,7 @@ var makeGenerateImageWrapper = (generateImage, contextOptions = {}, options = {}
|
|
|
1406
1410
|
const wrapper = async function(allParams) {
|
|
1407
1411
|
const { span_info, ...params } = allParams;
|
|
1408
1412
|
const tracedParams = { ...params };
|
|
1409
|
-
return
|
|
1413
|
+
return _chunkAW4QECG5js.aiSDKChannels.generateImage.tracePromise(
|
|
1410
1414
|
() => generateImage(tracedParams),
|
|
1411
1415
|
createAISDKChannelContext(tracedParams, {
|
|
1412
1416
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1447,7 +1451,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
1447
1451
|
};
|
|
1448
1452
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
1449
1453
|
return makeEmbedWrapper(
|
|
1450
|
-
|
|
1454
|
+
_chunkAW4QECG5js.aiSDKChannels.embed,
|
|
1451
1455
|
"embed",
|
|
1452
1456
|
embed,
|
|
1453
1457
|
{ aiSDK },
|
|
@@ -1456,7 +1460,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
1456
1460
|
};
|
|
1457
1461
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
1458
1462
|
return makeEmbedWrapper(
|
|
1459
|
-
|
|
1463
|
+
_chunkAW4QECG5js.aiSDKChannels.embedMany,
|
|
1460
1464
|
"embedMany",
|
|
1461
1465
|
embedMany,
|
|
1462
1466
|
{ aiSDK },
|
|
@@ -1467,7 +1471,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
1467
1471
|
const wrapper = async function(allParams) {
|
|
1468
1472
|
const { span_info, ...params } = allParams;
|
|
1469
1473
|
const tracedParams = { ...params };
|
|
1470
|
-
return
|
|
1474
|
+
return _chunkAW4QECG5js.aiSDKChannels.rerank.tracePromise(
|
|
1471
1475
|
() => rerank(tracedParams),
|
|
1472
1476
|
createAISDKChannelContext(tracedParams, {
|
|
1473
1477
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1506,7 +1510,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
1506
1510
|
};
|
|
1507
1511
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
1508
1512
|
return makeStreamWrapper(
|
|
1509
|
-
|
|
1513
|
+
_chunkAW4QECG5js.aiSDKChannels.streamText,
|
|
1510
1514
|
"streamText",
|
|
1511
1515
|
streamText,
|
|
1512
1516
|
{ aiSDK },
|
|
@@ -1515,7 +1519,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
1515
1519
|
};
|
|
1516
1520
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
1517
1521
|
return makeStreamWrapper(
|
|
1518
|
-
|
|
1522
|
+
_chunkAW4QECG5js.aiSDKChannels.streamObject,
|
|
1519
1523
|
"streamObject",
|
|
1520
1524
|
streamObject,
|
|
1521
1525
|
{ aiSDK },
|
|
@@ -1587,19 +1591,19 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1587
1591
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1588
1592
|
// propagate those via async local storage
|
|
1589
1593
|
async doGenerate(options) {
|
|
1590
|
-
const span =
|
|
1591
|
-
|
|
1594
|
+
const span = _chunkBTRLPQG5js.startSpan.call(void 0,
|
|
1595
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0,
|
|
1592
1596
|
{
|
|
1593
1597
|
name: "Chat Completion",
|
|
1594
1598
|
spanAttributes: {
|
|
1595
1599
|
type: "llm"
|
|
1596
1600
|
}
|
|
1597
1601
|
},
|
|
1598
|
-
|
|
1602
|
+
_chunkAW4QECG5js.INSTRUMENTATION_NAMES.AI_SDK
|
|
1599
1603
|
)
|
|
1600
1604
|
);
|
|
1601
1605
|
const { prompt, mode, ...rest } = options;
|
|
1602
|
-
const startTime =
|
|
1606
|
+
const startTime = _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, );
|
|
1603
1607
|
try {
|
|
1604
1608
|
const ret = await this.model.doGenerate(options);
|
|
1605
1609
|
span.log({
|
|
@@ -1611,12 +1615,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1611
1615
|
},
|
|
1612
1616
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1613
1617
|
metrics: {
|
|
1614
|
-
time_to_first_token:
|
|
1615
|
-
tokens: !
|
|
1618
|
+
time_to_first_token: _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, ) - startTime,
|
|
1619
|
+
tokens: !_chunkBTRLPQG5js.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
1616
1620
|
prompt_tokens: _optionalChain([ret, 'access', _32 => _32.usage, 'optionalAccess', _33 => _33.promptTokens]),
|
|
1617
1621
|
completion_tokens: _optionalChain([ret, 'access', _34 => _34.usage, 'optionalAccess', _35 => _35.completionTokens]),
|
|
1618
|
-
cached:
|
|
1619
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _36 => _36.rawResponse, 'optionalAccess', _37 => _37.headers, 'optionalAccess', _38 => _38[
|
|
1622
|
+
cached: _chunkBTRLPQG5js.parseCachedHeader.call(void 0,
|
|
1623
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _36 => _36.rawResponse, 'optionalAccess', _37 => _37.headers, 'optionalAccess', _38 => _38[_chunkBTRLPQG5js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _39 => _39.rawResponse, 'optionalAccess', _40 => _40.headers, 'optionalAccess', _41 => _41[_chunkBTRLPQG5js.LEGACY_CACHED_HEADER]])))
|
|
1620
1624
|
)
|
|
1621
1625
|
}
|
|
1622
1626
|
});
|
|
@@ -1627,16 +1631,16 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1627
1631
|
}
|
|
1628
1632
|
async doStream(options) {
|
|
1629
1633
|
const { prompt, mode, ...rest } = options;
|
|
1630
|
-
const startTime =
|
|
1631
|
-
const span =
|
|
1632
|
-
|
|
1634
|
+
const startTime = _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, );
|
|
1635
|
+
const span = _chunkBTRLPQG5js.startSpan.call(void 0,
|
|
1636
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0,
|
|
1633
1637
|
{
|
|
1634
1638
|
name: "Chat Completion",
|
|
1635
1639
|
spanAttributes: {
|
|
1636
1640
|
type: "llm"
|
|
1637
1641
|
}
|
|
1638
1642
|
},
|
|
1639
|
-
|
|
1643
|
+
_chunkAW4QECG5js.INSTRUMENTATION_NAMES.AI_SDK
|
|
1640
1644
|
)
|
|
1641
1645
|
);
|
|
1642
1646
|
span.log({
|
|
@@ -1667,7 +1671,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1667
1671
|
new TransformStream({
|
|
1668
1672
|
transform(chunk, controller) {
|
|
1669
1673
|
if (time_to_first_token === void 0) {
|
|
1670
|
-
time_to_first_token =
|
|
1674
|
+
time_to_first_token = _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1671
1675
|
span.log({ metrics: { time_to_first_token } });
|
|
1672
1676
|
}
|
|
1673
1677
|
switch (chunk.type) {
|
|
@@ -1712,11 +1716,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1712
1716
|
),
|
|
1713
1717
|
metrics: {
|
|
1714
1718
|
time_to_first_token,
|
|
1715
|
-
tokens: !
|
|
1719
|
+
tokens: !_chunkBTRLPQG5js.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1716
1720
|
prompt_tokens: _optionalChain([usage, 'optionalAccess', _42 => _42.promptTokens]),
|
|
1717
1721
|
completion_tokens: _optionalChain([usage, 'optionalAccess', _43 => _43.completionTokens]),
|
|
1718
|
-
cached:
|
|
1719
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _44 => _44.rawResponse, 'optionalAccess', _45 => _45.headers, 'optionalAccess', _46 => _46[
|
|
1722
|
+
cached: _chunkBTRLPQG5js.parseCachedHeader.call(void 0,
|
|
1723
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _44 => _44.rawResponse, 'optionalAccess', _45 => _45.headers, 'optionalAccess', _46 => _46[_chunkBTRLPQG5js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _47 => _47.rawResponse, 'optionalAccess', _48 => _48.headers, 'optionalAccess', _49 => _49[_chunkBTRLPQG5js.LEGACY_CACHED_HEADER]])))
|
|
1720
1724
|
)
|
|
1721
1725
|
}
|
|
1722
1726
|
});
|
|
@@ -1901,12 +1905,12 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1901
1905
|
anthropicMetadata.usage,
|
|
1902
1906
|
"cache_creation_input_tokens"
|
|
1903
1907
|
) || 0;
|
|
1904
|
-
const cacheTokens =
|
|
1908
|
+
const cacheTokens = _chunkBTRLPQG5js.extractAnthropicCacheTokens.call(void 0,
|
|
1905
1909
|
cacheReadTokens,
|
|
1906
1910
|
cacheCreationTokens
|
|
1907
1911
|
);
|
|
1908
1912
|
Object.assign(metrics, cacheTokens);
|
|
1909
|
-
return
|
|
1913
|
+
return _chunkBTRLPQG5js.toNumericMetrics.call(void 0, _chunkBTRLPQG5js.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1910
1914
|
}
|
|
1911
1915
|
}
|
|
1912
1916
|
return metrics;
|
|
@@ -1978,7 +1982,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1978
1982
|
model: modelFromWrapGenerate
|
|
1979
1983
|
}) => {
|
|
1980
1984
|
const rawInput = extractInput(params);
|
|
1981
|
-
const processedInput =
|
|
1985
|
+
const processedInput = _chunkBTRLPQG5js.processInputAttachments.call(void 0, rawInput);
|
|
1982
1986
|
const spanArgs = {
|
|
1983
1987
|
name: _optionalChain([config, 'access', _66 => _66.spanInfo, 'optionalAccess', _67 => _67.name]) || "ai-sdk.doGenerate",
|
|
1984
1988
|
spanAttributes: {
|
|
@@ -1993,8 +1997,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1993
1997
|
}
|
|
1994
1998
|
}
|
|
1995
1999
|
};
|
|
1996
|
-
const span =
|
|
1997
|
-
|
|
2000
|
+
const span = _chunkBTRLPQG5js.startSpan.call(void 0,
|
|
2001
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0, spanArgs, _chunkAW4QECG5js.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1998
2002
|
);
|
|
1999
2003
|
try {
|
|
2000
2004
|
const result = await doGenerate();
|
|
@@ -2042,7 +2046,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
2042
2046
|
},
|
|
2043
2047
|
wrapStream: async ({ doStream, params }) => {
|
|
2044
2048
|
const rawInput = extractInput(params);
|
|
2045
|
-
const processedInput =
|
|
2049
|
+
const processedInput = _chunkBTRLPQG5js.processInputAttachments.call(void 0, rawInput);
|
|
2046
2050
|
const spanArgs = {
|
|
2047
2051
|
name: _optionalChain([config, 'access', _75 => _75.spanInfo, 'optionalAccess', _76 => _76.name]) || "ai-sdk.doStream",
|
|
2048
2052
|
spanAttributes: {
|
|
@@ -2057,8 +2061,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
2057
2061
|
}
|
|
2058
2062
|
}
|
|
2059
2063
|
};
|
|
2060
|
-
const span =
|
|
2061
|
-
|
|
2064
|
+
const span = _chunkBTRLPQG5js.startSpan.call(void 0,
|
|
2065
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0, spanArgs, _chunkAW4QECG5js.INSTRUMENTATION_NAMES.AI_SDK)
|
|
2062
2066
|
);
|
|
2063
2067
|
try {
|
|
2064
2068
|
const { stream, ...rest } = await doStream();
|
|
@@ -2183,7 +2187,7 @@ function createLegacyEveInstrumentation(options) {
|
|
|
2183
2187
|
try {
|
|
2184
2188
|
captureEveModelInput(state, input);
|
|
2185
2189
|
} catch (error) {
|
|
2186
|
-
|
|
2190
|
+
_chunkAW4QECG5js.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
2187
2191
|
}
|
|
2188
2192
|
}
|
|
2189
2193
|
},
|
|
@@ -2193,7 +2197,7 @@ function createLegacyEveInstrumentation(options) {
|
|
|
2193
2197
|
};
|
|
2194
2198
|
}
|
|
2195
2199
|
function isEveHandleMessageStreamEvent(event) {
|
|
2196
|
-
return
|
|
2200
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
2197
2201
|
}
|
|
2198
2202
|
var ResumedEveSpan = class {
|
|
2199
2203
|
constructor(reference) {
|
|
@@ -2214,7 +2218,7 @@ var ResumedEveSpan = class {
|
|
|
2214
2218
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
2215
2219
|
...event.metrics
|
|
2216
2220
|
};
|
|
2217
|
-
|
|
2221
|
+
_chunkBTRLPQG5js.updateSpan.call(void 0, {
|
|
2218
2222
|
exported: this.reference.exported,
|
|
2219
2223
|
...this.reference.startEvent,
|
|
2220
2224
|
...event,
|
|
@@ -2223,7 +2227,7 @@ var ResumedEveSpan = class {
|
|
|
2223
2227
|
}
|
|
2224
2228
|
end(args) {
|
|
2225
2229
|
if (this.endTime === void 0) {
|
|
2226
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _84 => _84.endTime]), () => (
|
|
2230
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _84 => _84.endTime]), () => ( _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, )));
|
|
2227
2231
|
this.log({ metrics: { end: this.endTime } });
|
|
2228
2232
|
}
|
|
2229
2233
|
return this.endTime;
|
|
@@ -2235,13 +2239,13 @@ var EveBridge = (_class = class {
|
|
|
2235
2239
|
}
|
|
2236
2240
|
|
|
2237
2241
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
2238
|
-
__init2() {this.completedToolKeys = new (0,
|
|
2242
|
+
__init2() {this.completedToolKeys = new (0, _chunkBTRLPQG5js.LRUCache)({
|
|
2239
2243
|
max: MAX_EVE_CACHE_ENTRIES
|
|
2240
2244
|
})}
|
|
2241
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
2245
|
+
__init3() {this.toolsByCallKey = new (0, _chunkBTRLPQG5js.LRUCache)({
|
|
2242
2246
|
max: MAX_EVE_CACHE_ENTRIES
|
|
2243
2247
|
})}
|
|
2244
|
-
__init4() {this.turnsByKey = new (0,
|
|
2248
|
+
__init4() {this.turnsByKey = new (0, _chunkBTRLPQG5js.LRUCache)({
|
|
2245
2249
|
max: MAX_EVE_CACHE_ENTRIES
|
|
2246
2250
|
})}
|
|
2247
2251
|
async startEveSpan(args) {
|
|
@@ -2252,7 +2256,7 @@ var EveBridge = (_class = class {
|
|
|
2252
2256
|
if (reference) {
|
|
2253
2257
|
return new ResumedEveSpan(reference);
|
|
2254
2258
|
}
|
|
2255
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _87 => _87.startTime]), () => (
|
|
2259
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _87 => _87.startTime]), () => ( _chunkBTRLPQG5js.getCurrentUnixTimestamp.call(void 0, )));
|
|
2256
2260
|
const parentSpanIds = _optionalChain([args, 'optionalAccess', _88 => _88.parentSpanIds]);
|
|
2257
2261
|
const startEvent = {
|
|
2258
2262
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2264,12 +2268,12 @@ var EveBridge = (_class = class {
|
|
|
2264
2268
|
},
|
|
2265
2269
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
2266
2270
|
};
|
|
2267
|
-
const span =
|
|
2268
|
-
|
|
2269
|
-
() =>
|
|
2270
|
-
|
|
2271
|
+
const span = _chunkBTRLPQG5js.withCurrent.call(void 0,
|
|
2272
|
+
_chunkBTRLPQG5js.NOOP_SPAN,
|
|
2273
|
+
() => _chunkBTRLPQG5js._internalStartSpanWithInitialMerge.call(void 0,
|
|
2274
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0,
|
|
2271
2275
|
{ ...args, startTime },
|
|
2272
|
-
|
|
2276
|
+
_chunkAW4QECG5js.INSTRUMENTATION_NAMES.EVE
|
|
2273
2277
|
)
|
|
2274
2278
|
)
|
|
2275
2279
|
);
|
|
@@ -2297,7 +2301,7 @@ var EveBridge = (_class = class {
|
|
|
2297
2301
|
};
|
|
2298
2302
|
});
|
|
2299
2303
|
} catch (error) {
|
|
2300
|
-
|
|
2304
|
+
_chunkAW4QECG5js.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
2301
2305
|
}
|
|
2302
2306
|
return span;
|
|
2303
2307
|
}
|
|
@@ -2384,7 +2388,7 @@ var EveBridge = (_class = class {
|
|
|
2384
2388
|
}
|
|
2385
2389
|
}
|
|
2386
2390
|
} catch (error) {
|
|
2387
|
-
|
|
2391
|
+
_chunkAW4QECG5js.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
2388
2392
|
}
|
|
2389
2393
|
};
|
|
2390
2394
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -2612,7 +2616,7 @@ var EveBridge = (_class = class {
|
|
|
2612
2616
|
return;
|
|
2613
2617
|
}
|
|
2614
2618
|
const existingMessage = eveOutputMessage(step.output);
|
|
2615
|
-
const existingToolCalls =
|
|
2619
|
+
const existingToolCalls = _chunkBTRLPQG5js.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2616
2620
|
step.output = mergeEveReasoning(
|
|
2617
2621
|
[
|
|
2618
2622
|
{
|
|
@@ -2676,11 +2680,11 @@ var EveBridge = (_class = class {
|
|
|
2676
2680
|
return;
|
|
2677
2681
|
}
|
|
2678
2682
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2679
|
-
if (Array.isArray(step.output) &&
|
|
2683
|
+
if (Array.isArray(step.output) && _chunkBTRLPQG5js.isObject.call(void 0, step.output[0])) {
|
|
2680
2684
|
const message = step.output[0]["message"];
|
|
2681
|
-
if (
|
|
2685
|
+
if (_chunkBTRLPQG5js.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2682
2686
|
for (const toolCall of message["tool_calls"]) {
|
|
2683
|
-
if (
|
|
2687
|
+
if (_chunkBTRLPQG5js.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2684
2688
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2685
2689
|
}
|
|
2686
2690
|
}
|
|
@@ -2889,7 +2893,7 @@ var EveBridge = (_class = class {
|
|
|
2889
2893
|
};
|
|
2890
2894
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2891
2895
|
const sessionId = sessionIdFromContext(ctx);
|
|
2892
|
-
if (Array.isArray(step.output) &&
|
|
2896
|
+
if (Array.isArray(step.output) && _chunkBTRLPQG5js.isObject.call(void 0, step.output[0])) {
|
|
2893
2897
|
const finishReason = step.output[0].finish_reason;
|
|
2894
2898
|
if (typeof finishReason !== "string") {
|
|
2895
2899
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -3227,10 +3231,10 @@ var EveBridge = (_class = class {
|
|
|
3227
3231
|
return state;
|
|
3228
3232
|
}
|
|
3229
3233
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
3230
|
-
const session =
|
|
3231
|
-
const parent =
|
|
3232
|
-
const parentTurn =
|
|
3233
|
-
const parentLineage =
|
|
3234
|
+
const session = _chunkBTRLPQG5js.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
|
|
3235
|
+
const parent = _chunkBTRLPQG5js.isObject.call(void 0, session) ? session["parent"] : void 0;
|
|
3236
|
+
const parentTurn = _chunkBTRLPQG5js.isObject.call(void 0, parent) ? parent["turn"] : void 0;
|
|
3237
|
+
const parentLineage = _chunkBTRLPQG5js.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkBTRLPQG5js.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
|
|
3234
3238
|
callId: parent["callId"],
|
|
3235
3239
|
sessionId: parent["sessionId"],
|
|
3236
3240
|
turnId: parentTurn["id"]
|
|
@@ -3337,10 +3341,10 @@ var EveBridge = (_class = class {
|
|
|
3337
3341
|
}
|
|
3338
3342
|
async flushInstrumentation() {
|
|
3339
3343
|
try {
|
|
3340
|
-
await
|
|
3344
|
+
await _chunkBTRLPQG5js.flush.call(void 0, );
|
|
3341
3345
|
return true;
|
|
3342
3346
|
} catch (error) {
|
|
3343
|
-
|
|
3347
|
+
_chunkAW4QECG5js.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
3344
3348
|
return false;
|
|
3345
3349
|
}
|
|
3346
3350
|
}
|
|
@@ -3355,12 +3359,12 @@ function emptyEveTraceState() {
|
|
|
3355
3359
|
};
|
|
3356
3360
|
}
|
|
3357
3361
|
function normalizeEveTraceState(state) {
|
|
3358
|
-
if (!
|
|
3362
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, state)) {
|
|
3359
3363
|
return emptyEveTraceState();
|
|
3360
3364
|
}
|
|
3361
|
-
const metadata =
|
|
3365
|
+
const metadata = _chunkBTRLPQG5js.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
3362
3366
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
3363
|
-
if (!
|
|
3367
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, entry)) {
|
|
3364
3368
|
return [];
|
|
3365
3369
|
}
|
|
3366
3370
|
const exported = entry["exported"];
|
|
@@ -3369,11 +3373,11 @@ function normalizeEveTraceState(state) {
|
|
|
3369
3373
|
const rowId = entry["rowId"];
|
|
3370
3374
|
const spanId = entry["spanId"];
|
|
3371
3375
|
const startEvent = entry["startEvent"];
|
|
3372
|
-
const startEventCreated =
|
|
3373
|
-
const startEventMetrics =
|
|
3374
|
-
const startEventSpanAttributes =
|
|
3375
|
-
const startEventSpanParents =
|
|
3376
|
-
const normalizedStartEvent = typeof startEventCreated === "string" &&
|
|
3376
|
+
const startEventCreated = _chunkBTRLPQG5js.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
|
|
3377
|
+
const startEventMetrics = _chunkBTRLPQG5js.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
|
|
3378
|
+
const startEventSpanAttributes = _chunkBTRLPQG5js.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
|
|
3379
|
+
const startEventSpanParents = _chunkBTRLPQG5js.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
|
|
3380
|
+
const normalizedStartEvent = typeof startEventCreated === "string" && _chunkBTRLPQG5js.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkBTRLPQG5js.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
|
|
3377
3381
|
(parent) => typeof parent === "string"
|
|
3378
3382
|
) ? {
|
|
3379
3383
|
created: startEventCreated,
|
|
@@ -3393,7 +3397,7 @@ function normalizeEveTraceState(state) {
|
|
|
3393
3397
|
] : [];
|
|
3394
3398
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
3395
3399
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
3396
|
-
if (!
|
|
3400
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, entry)) {
|
|
3397
3401
|
return [];
|
|
3398
3402
|
}
|
|
3399
3403
|
const key = entry["key"];
|
|
@@ -3401,7 +3405,7 @@ function normalizeEveTraceState(state) {
|
|
|
3401
3405
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
3402
3406
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
3403
3407
|
const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
|
|
3404
|
-
if (!
|
|
3408
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, entry)) {
|
|
3405
3409
|
return [];
|
|
3406
3410
|
}
|
|
3407
3411
|
const content = entry["content"];
|
|
@@ -3416,7 +3420,7 @@ function normalizeEveTraceState(state) {
|
|
|
3416
3420
|
] : [];
|
|
3417
3421
|
}).slice(-MAX_STORED_REASONING_BLOCKS) : [];
|
|
3418
3422
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
3419
|
-
if (!
|
|
3423
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, entry)) {
|
|
3420
3424
|
return [];
|
|
3421
3425
|
}
|
|
3422
3426
|
const ordinal = entry["ordinal"];
|
|
@@ -3493,14 +3497,14 @@ function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
|
3493
3497
|
});
|
|
3494
3498
|
}
|
|
3495
3499
|
function eveOutputMessage(output) {
|
|
3496
|
-
return Array.isArray(output) &&
|
|
3500
|
+
return Array.isArray(output) && _chunkBTRLPQG5js.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
|
|
3497
3501
|
}
|
|
3498
3502
|
function mergeEveReasoning(output, reasoning) {
|
|
3499
3503
|
if (reasoning.length === 0) {
|
|
3500
3504
|
return output;
|
|
3501
3505
|
}
|
|
3502
|
-
const choice = Array.isArray(output) &&
|
|
3503
|
-
const message =
|
|
3506
|
+
const choice = Array.isArray(output) && _chunkBTRLPQG5js.isObject.call(void 0, output[0]) ? output[0] : {};
|
|
3507
|
+
const message = _chunkBTRLPQG5js.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
|
|
3504
3508
|
return [
|
|
3505
3509
|
{
|
|
3506
3510
|
...choice,
|
|
@@ -3554,7 +3558,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
3554
3558
|
});
|
|
3555
3559
|
return input;
|
|
3556
3560
|
} catch (error) {
|
|
3557
|
-
|
|
3561
|
+
_chunkAW4QECG5js.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
3558
3562
|
return void 0;
|
|
3559
3563
|
}
|
|
3560
3564
|
}
|
|
@@ -3694,14 +3698,14 @@ function capturedEveModelContentPart(part) {
|
|
|
3694
3698
|
}
|
|
3695
3699
|
function isCapturedModelInput(input) {
|
|
3696
3700
|
return Array.isArray(input) && input.every(
|
|
3697
|
-
(message) =>
|
|
3701
|
+
(message) => _chunkBTRLPQG5js.isObject.call(void 0, message) && (message["role"] === "system" || message["role"] === "user" || message["role"] === "assistant" || message["role"] === "tool") && (typeof message["content"] === "string" || Array.isArray(message["content"]) && message["content"].every(_chunkBTRLPQG5js.isObject))
|
|
3698
3702
|
);
|
|
3699
3703
|
}
|
|
3700
3704
|
function llmInputKey(sessionId, turnId, stepIndex) {
|
|
3701
3705
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3702
3706
|
}
|
|
3703
3707
|
function modelMetadataFromRuntime(runtime) {
|
|
3704
|
-
if (!
|
|
3708
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, runtime)) {
|
|
3705
3709
|
return {};
|
|
3706
3710
|
}
|
|
3707
3711
|
const modelId = runtime["modelId"];
|
|
@@ -3724,11 +3728,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3724
3728
|
};
|
|
3725
3729
|
}
|
|
3726
3730
|
function sessionIdFromContext(ctx) {
|
|
3727
|
-
if (!
|
|
3731
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, ctx)) {
|
|
3728
3732
|
return void 0;
|
|
3729
3733
|
}
|
|
3730
3734
|
const session = ctx["session"];
|
|
3731
|
-
if (!
|
|
3735
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, session)) {
|
|
3732
3736
|
return void 0;
|
|
3733
3737
|
}
|
|
3734
3738
|
const id = session["id"];
|
|
@@ -3739,19 +3743,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3739
3743
|
return metadata;
|
|
3740
3744
|
}
|
|
3741
3745
|
function isToolCallAction(action) {
|
|
3742
|
-
return
|
|
3746
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkBTRLPQG5js.isObject.call(void 0, action["input"]);
|
|
3743
3747
|
}
|
|
3744
3748
|
function isLocalSubagentCallAction(action) {
|
|
3745
|
-
return
|
|
3749
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkBTRLPQG5js.isObject.call(void 0, action["input"]);
|
|
3746
3750
|
}
|
|
3747
3751
|
function isTraceableActionRequest(action) {
|
|
3748
3752
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3749
3753
|
}
|
|
3750
3754
|
function isToolResult(result) {
|
|
3751
|
-
return
|
|
3755
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3752
3756
|
}
|
|
3753
3757
|
function isSubagentResult(result) {
|
|
3754
|
-
return
|
|
3758
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3755
3759
|
}
|
|
3756
3760
|
function normalizedFinishReason(finishReason) {
|
|
3757
3761
|
switch (finishReason) {
|
|
@@ -3838,7 +3842,7 @@ function createEveInstrumentationProvider(options = {}) {
|
|
|
3838
3842
|
"turn.failed": (event, context) => bridge.handleTurnTerminal(event, context),
|
|
3839
3843
|
"turn.started": (event, context) => bridge.handleTurnStarted(event, context)
|
|
3840
3844
|
},
|
|
3841
|
-
flush:
|
|
3845
|
+
flush: _chunkBTRLPQG5js.flush,
|
|
3842
3846
|
setup: options.setup
|
|
3843
3847
|
};
|
|
3844
3848
|
}
|
|
@@ -3850,10 +3854,10 @@ var EveProviderBridge = (_class2 = class {
|
|
|
3850
3854
|
__init5() {this.activeActions = /* @__PURE__ */ new Map()}
|
|
3851
3855
|
__init6() {this.activeModels = /* @__PURE__ */ new Map()}
|
|
3852
3856
|
__init7() {this.modelsByAttempt = /* @__PURE__ */ new Map()}
|
|
3853
|
-
__init8() {this.settledOperations = new (0,
|
|
3857
|
+
__init8() {this.settledOperations = new (0, _chunkBTRLPQG5js.LRUCache)({
|
|
3854
3858
|
max: MAX_EVE_PROVIDER_CACHE_ENTRIES
|
|
3855
3859
|
})}
|
|
3856
|
-
__init9() {this.turns = new (0,
|
|
3860
|
+
__init9() {this.turns = new (0, _chunkBTRLPQG5js.LRUCache)({
|
|
3857
3861
|
max: MAX_EVE_PROVIDER_CACHE_ENTRIES
|
|
3858
3862
|
})}
|
|
3859
3863
|
async handleTurnStarted(event, context) {
|
|
@@ -3928,7 +3932,7 @@ var EveProviderBridge = (_class2 = class {
|
|
|
3928
3932
|
this.drainActionsForTurn(event.sessionId, event.turnId, error);
|
|
3929
3933
|
const stored = storedSpan(context);
|
|
3930
3934
|
if (stored && "exported" in stored) {
|
|
3931
|
-
|
|
3935
|
+
_chunkBTRLPQG5js.updateSpan.call(void 0, {
|
|
3932
3936
|
exported: stored.exported,
|
|
3933
3937
|
...error !== void 0 ? { error } : {},
|
|
3934
3938
|
metrics: { end: Date.now() / 1e3 }
|
|
@@ -3999,7 +4003,7 @@ var EveProviderBridge = (_class2 = class {
|
|
|
3999
4003
|
} else {
|
|
4000
4004
|
const stored = storedSpan(context);
|
|
4001
4005
|
if (stored && "exported" in stored) {
|
|
4002
|
-
|
|
4006
|
+
_chunkBTRLPQG5js.updateSpan.call(void 0, {
|
|
4003
4007
|
exported: stored.exported,
|
|
4004
4008
|
...event.type === "model.call.failed" ? event.error !== void 0 ? { error: event.error } : {} : { output: modelOutput(event) },
|
|
4005
4009
|
metrics: {
|
|
@@ -4081,7 +4085,7 @@ var EveProviderBridge = (_class2 = class {
|
|
|
4081
4085
|
} else {
|
|
4082
4086
|
const stored2 = storedSpan(context);
|
|
4083
4087
|
if (stored2 && "exported" in stored2) {
|
|
4084
|
-
|
|
4088
|
+
_chunkBTRLPQG5js.updateSpan.call(void 0, {
|
|
4085
4089
|
exported: stored2.exported,
|
|
4086
4090
|
...event.type === "action.failed" ? {
|
|
4087
4091
|
error: _nullishCoalesce(event.error, () => ( new Error(_nullishCoalesce(event.errorCode, () => ( `Eve action ${event.outcome}`)))))
|
|
@@ -4132,10 +4136,10 @@ var EveProviderBridge = (_class2 = class {
|
|
|
4132
4136
|
return { rootSpanId, spanId };
|
|
4133
4137
|
}
|
|
4134
4138
|
async startSpan(context, args, rootSpanId) {
|
|
4135
|
-
const span =
|
|
4136
|
-
|
|
4137
|
-
() =>
|
|
4138
|
-
|
|
4139
|
+
const span = _chunkBTRLPQG5js.withCurrent.call(void 0,
|
|
4140
|
+
_chunkBTRLPQG5js.NOOP_SPAN,
|
|
4141
|
+
() => _chunkBTRLPQG5js._internalStartSpanWithInitialMerge.call(void 0,
|
|
4142
|
+
_chunkAW4QECG5js.withSpanInstrumentationName.call(void 0, _nullishCoalesce(args, () => ( {})), _chunkAW4QECG5js.INSTRUMENTATION_NAMES.EVE)
|
|
4139
4143
|
)
|
|
4140
4144
|
);
|
|
4141
4145
|
try {
|
|
@@ -4144,7 +4148,7 @@ var EveProviderBridge = (_class2 = class {
|
|
|
4144
4148
|
...rootSpanId ? { rootSpanId } : {}
|
|
4145
4149
|
});
|
|
4146
4150
|
} catch (error) {
|
|
4147
|
-
|
|
4151
|
+
_chunkAW4QECG5js.debugLogger.warn("Error exporting Eve provider span:", error);
|
|
4148
4152
|
}
|
|
4149
4153
|
return span;
|
|
4150
4154
|
}
|
|
@@ -4173,13 +4177,13 @@ var EveProviderBridge = (_class2 = class {
|
|
|
4173
4177
|
try {
|
|
4174
4178
|
await fn();
|
|
4175
4179
|
} catch (error) {
|
|
4176
|
-
|
|
4180
|
+
_chunkAW4QECG5js.debugLogger.warn(`Error in Eve provider ${operation}:`, error);
|
|
4177
4181
|
}
|
|
4178
4182
|
}
|
|
4179
4183
|
}, _class2);
|
|
4180
4184
|
function storedSpan(context) {
|
|
4181
4185
|
const value = context.state.get();
|
|
4182
|
-
if (!
|
|
4186
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, value)) return void 0;
|
|
4183
4187
|
if (value["skip"] === true) return { skip: true };
|
|
4184
4188
|
return typeof value["exported"] === "string" ? {
|
|
4185
4189
|
exported: value["exported"],
|
|
@@ -4335,7 +4339,7 @@ function betaSessionEventsProxy(events) {
|
|
|
4335
4339
|
if (prop === "stream") {
|
|
4336
4340
|
return new TypedApplyProxy(target.stream, {
|
|
4337
4341
|
apply(stream, thisArg, argArray) {
|
|
4338
|
-
return
|
|
4342
|
+
return _chunkAW4QECG5js.anthropicChannels.betaSessionsEventsStream.tracePromise(
|
|
4339
4343
|
() => Reflect.apply(stream, thisArg, argArray),
|
|
4340
4344
|
{ arguments: argArray }
|
|
4341
4345
|
);
|
|
@@ -4362,7 +4366,7 @@ function betaSessionThreadEventsProxy(events) {
|
|
|
4362
4366
|
if (prop === "stream") {
|
|
4363
4367
|
return new TypedApplyProxy(target.stream, {
|
|
4364
4368
|
apply(stream, thisArg, argArray) {
|
|
4365
|
-
return
|
|
4369
|
+
return _chunkAW4QECG5js.anthropicChannels.betaSessionsThreadsEventsStream.tracePromise(
|
|
4366
4370
|
() => Reflect.apply(stream, thisArg, argArray),
|
|
4367
4371
|
{ arguments: argArray }
|
|
4368
4372
|
);
|
|
@@ -4377,7 +4381,7 @@ function messagesProxy(messages) {
|
|
|
4377
4381
|
return new Proxy(messages, {
|
|
4378
4382
|
get(target, prop, receiver) {
|
|
4379
4383
|
if (prop === "create") {
|
|
4380
|
-
return createProxy(target.create,
|
|
4384
|
+
return createProxy(target.create, _chunkAW4QECG5js.anthropicChannels.messagesCreate);
|
|
4381
4385
|
}
|
|
4382
4386
|
return Reflect.get(target, prop, receiver);
|
|
4383
4387
|
}
|
|
@@ -4387,7 +4391,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
4387
4391
|
return new Proxy(messages, {
|
|
4388
4392
|
get(target, prop, receiver) {
|
|
4389
4393
|
if (prop === "create") {
|
|
4390
|
-
return createProxy(target.create,
|
|
4394
|
+
return createProxy(target.create, _chunkAW4QECG5js.anthropicChannels.betaMessagesCreate);
|
|
4391
4395
|
}
|
|
4392
4396
|
if (prop === "toolRunner") {
|
|
4393
4397
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -4396,7 +4400,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
4396
4400
|
return toolRunnerProxy(
|
|
4397
4401
|
target.toolRunner,
|
|
4398
4402
|
anthropic,
|
|
4399
|
-
|
|
4403
|
+
_chunkAW4QECG5js.anthropicChannels.betaMessagesToolRunner
|
|
4400
4404
|
);
|
|
4401
4405
|
}
|
|
4402
4406
|
return Reflect.get(target, prop, receiver);
|
|
@@ -4453,11 +4457,11 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
4453
4457
|
...params,
|
|
4454
4458
|
options: {
|
|
4455
4459
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
4456
|
-
[
|
|
4460
|
+
[_chunkBTRLPQG5js.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
4457
4461
|
}
|
|
4458
4462
|
};
|
|
4459
4463
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
4460
|
-
return
|
|
4464
|
+
return _chunkAW4QECG5js.claudeAgentSDKChannels.query.invoke(
|
|
4461
4465
|
target,
|
|
4462
4466
|
invocationTarget,
|
|
4463
4467
|
[wrappedParams],
|
|
@@ -4485,7 +4489,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
4485
4489
|
}
|
|
4486
4490
|
const localToolMetadata = { toolName };
|
|
4487
4491
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
4488
|
-
wrappedArgs[handlerIndex] =
|
|
4492
|
+
wrappedArgs[handlerIndex] = _chunkBTRLPQG5js.wrapLocalClaudeToolHandler.call(void 0,
|
|
4489
4493
|
originalHandler,
|
|
4490
4494
|
() => localToolMetadata
|
|
4491
4495
|
);
|
|
@@ -4592,7 +4596,7 @@ function patchThinkClass(Think) {
|
|
|
4592
4596
|
...descriptor,
|
|
4593
4597
|
value: function wrappedCloudflareThinkRunInferenceLoop(input) {
|
|
4594
4598
|
const args = [input];
|
|
4595
|
-
return
|
|
4599
|
+
return _chunkAW4QECG5js.cloudflareThinkChannels.runInferenceLoop.tracePromise(
|
|
4596
4600
|
() => Reflect.apply(original, this, args),
|
|
4597
4601
|
{
|
|
4598
4602
|
arguments: args,
|
|
@@ -4714,7 +4718,7 @@ function wrapCodexThread(thread) {
|
|
|
4714
4718
|
if (prop === "run" && typeof value === "function") {
|
|
4715
4719
|
return function(input, turnOptions) {
|
|
4716
4720
|
const args = [input, turnOptions];
|
|
4717
|
-
return
|
|
4721
|
+
return _chunkAW4QECG5js.openAICodexChannels.run.tracePromise(
|
|
4718
4722
|
() => Reflect.apply(value, target, args),
|
|
4719
4723
|
{
|
|
4720
4724
|
arguments: args,
|
|
@@ -4727,7 +4731,7 @@ function wrapCodexThread(thread) {
|
|
|
4727
4731
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
4728
4732
|
return function(input, turnOptions) {
|
|
4729
4733
|
const args = [input, turnOptions];
|
|
4730
|
-
return
|
|
4734
|
+
return _chunkAW4QECG5js.openAICodexChannels.runStreamed.tracePromise(
|
|
4731
4735
|
() => Reflect.apply(value, target, args),
|
|
4732
4736
|
{
|
|
4733
4737
|
arguments: args,
|
|
@@ -4795,7 +4799,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
4795
4799
|
if (prop === "create" && typeof value === "function") {
|
|
4796
4800
|
const wrapped = async function(options) {
|
|
4797
4801
|
const args = [options];
|
|
4798
|
-
return
|
|
4802
|
+
return _chunkAW4QECG5js.cursorSDKChannels.create.tracePromise(
|
|
4799
4803
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
4800
4804
|
{ arguments: args }
|
|
4801
4805
|
);
|
|
@@ -4806,7 +4810,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
4806
4810
|
if (prop === "resume" && typeof value === "function") {
|
|
4807
4811
|
const wrapped = async function(agentId, options) {
|
|
4808
4812
|
const args = [agentId, options];
|
|
4809
|
-
return
|
|
4813
|
+
return _chunkAW4QECG5js.cursorSDKChannels.resume.tracePromise(
|
|
4810
4814
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
4811
4815
|
{ arguments: args }
|
|
4812
4816
|
);
|
|
@@ -4817,7 +4821,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
4817
4821
|
if (prop === "prompt" && typeof value === "function") {
|
|
4818
4822
|
const wrapped = async function(message, options) {
|
|
4819
4823
|
const args = [message, options];
|
|
4820
|
-
return
|
|
4824
|
+
return _chunkAW4QECG5js.cursorSDKChannels.prompt.tracePromise(
|
|
4821
4825
|
() => Reflect.apply(value, target, args),
|
|
4822
4826
|
{ arguments: args }
|
|
4823
4827
|
);
|
|
@@ -4850,7 +4854,7 @@ function wrapCursorAgent(agent) {
|
|
|
4850
4854
|
if (prop === "send" && typeof value === "function") {
|
|
4851
4855
|
return function(message, options) {
|
|
4852
4856
|
const args = [message, options];
|
|
4853
|
-
return
|
|
4857
|
+
return _chunkAW4QECG5js.cursorSDKChannels.send.tracePromise(
|
|
4854
4858
|
() => Reflect.apply(value, target, args),
|
|
4855
4859
|
{
|
|
4856
4860
|
agent: target,
|
|
@@ -4900,7 +4904,7 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
4900
4904
|
...descriptor,
|
|
4901
4905
|
value: function wrappedPiCodingAgentPrompt(text, options) {
|
|
4902
4906
|
const args = [text, options];
|
|
4903
|
-
return
|
|
4907
|
+
return _chunkAW4QECG5js.piCodingAgentChannels.prompt.invoke(originalPrompt, this, args, {
|
|
4904
4908
|
session: this
|
|
4905
4909
|
});
|
|
4906
4910
|
}
|
|
@@ -4946,7 +4950,7 @@ function wrapCloudflareAgent(Agent) {
|
|
|
4946
4950
|
if (ownValue(options, "detached")) {
|
|
4947
4951
|
return Reflect.apply(originalRunAgentTool, this, args);
|
|
4948
4952
|
}
|
|
4949
|
-
return
|
|
4953
|
+
return _chunkAW4QECG5js.cloudflareAgentsChannels.runAgentTool.tracePromise(
|
|
4950
4954
|
() => Reflect.apply(originalRunAgentTool, this, args),
|
|
4951
4955
|
{ arguments: args, self: this }
|
|
4952
4956
|
);
|
|
@@ -4970,7 +4974,7 @@ function isObjectLike(value) {
|
|
|
4970
4974
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
4971
4975
|
}
|
|
4972
4976
|
function warnUnsupportedAgent() {
|
|
4973
|
-
|
|
4977
|
+
_chunkAW4QECG5js.debugLogger.warn("Unsupported Cloudflare Agents Agent class. Not wrapping.");
|
|
4974
4978
|
}
|
|
4975
4979
|
|
|
4976
4980
|
// src/wrappers/strands-agent-sdk.ts
|
|
@@ -5076,7 +5080,7 @@ function wrapAgentInstance(agent) {
|
|
|
5076
5080
|
if (prop === "stream" && typeof value === "function") {
|
|
5077
5081
|
return function(args, options) {
|
|
5078
5082
|
const callArgs = [args, options];
|
|
5079
|
-
return
|
|
5083
|
+
return _chunkAW4QECG5js.strandsAgentSDKChannels.agentStream.invoke(
|
|
5080
5084
|
value,
|
|
5081
5085
|
target,
|
|
5082
5086
|
callArgs,
|
|
@@ -5110,7 +5114,7 @@ function wrapMultiAgentInstance(orchestrator, kind) {
|
|
|
5110
5114
|
if (prop === "stream" && typeof value === "function") {
|
|
5111
5115
|
return function(input, options) {
|
|
5112
5116
|
const callArgs = [input, options];
|
|
5113
|
-
const channel = kind === "graph" ?
|
|
5117
|
+
const channel = kind === "graph" ? _chunkAW4QECG5js.strandsAgentSDKChannels.graphStream : _chunkAW4QECG5js.strandsAgentSDKChannels.swarmStream;
|
|
5114
5118
|
return channel.invoke(
|
|
5115
5119
|
value,
|
|
5116
5120
|
target,
|
|
@@ -5150,11 +5154,11 @@ function wrapCloudflareAIChat(module) {
|
|
|
5150
5154
|
try {
|
|
5151
5155
|
AIChatAgent = Reflect.get(candidate, "AIChatAgent");
|
|
5152
5156
|
} catch (error) {
|
|
5153
|
-
|
|
5157
|
+
_chunkAW4QECG5js.debugLogger.debug("Failed to inspect @cloudflare/ai-chat module:", error);
|
|
5154
5158
|
return module;
|
|
5155
5159
|
}
|
|
5156
5160
|
if (typeof AIChatAgent !== "function") {
|
|
5157
|
-
|
|
5161
|
+
_chunkAW4QECG5js.debugLogger.warn(
|
|
5158
5162
|
"Unsupported @cloudflare/ai-chat module. AIChatAgent was not found; not wrapping."
|
|
5159
5163
|
);
|
|
5160
5164
|
return module;
|
|
@@ -5188,7 +5192,7 @@ function wrapAIChatAgentClass(AgentClass) {
|
|
|
5188
5192
|
args,
|
|
5189
5193
|
newTarget
|
|
5190
5194
|
);
|
|
5191
|
-
return
|
|
5195
|
+
return _chunkBTRLPQG5js.instrumentCloudflareAIChatAgent.call(void 0, instance);
|
|
5192
5196
|
}
|
|
5193
5197
|
});
|
|
5194
5198
|
wrappedClasses.set(AgentClass, wrapped);
|
|
@@ -5214,6 +5218,75 @@ function isModuleNamespace5(value) {
|
|
|
5214
5218
|
}
|
|
5215
5219
|
}
|
|
5216
5220
|
|
|
5221
|
+
// src/wrappers/google-generative-ai.ts
|
|
5222
|
+
function wrapGoogleGenerativeAI(client) {
|
|
5223
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, client) || typeof client.getGenerativeModel !== "function")
|
|
5224
|
+
return client;
|
|
5225
|
+
return wrapClient(client);
|
|
5226
|
+
}
|
|
5227
|
+
var proxies = /* @__PURE__ */ new WeakMap();
|
|
5228
|
+
function wrapClient(client) {
|
|
5229
|
+
const cached = proxies.get(client);
|
|
5230
|
+
if (cached) return cached;
|
|
5231
|
+
const proxy = new Proxy(client, {
|
|
5232
|
+
get(target, prop, receiver) {
|
|
5233
|
+
const value = Reflect.get(target, prop, receiver);
|
|
5234
|
+
if (typeof value !== "function") return value;
|
|
5235
|
+
if (prop === "getGenerativeModel" || prop === "getGenerativeModelFromCachedContent" || prop === "startChat") {
|
|
5236
|
+
return (...args) => wrapClient(Reflect.apply(value, target, args));
|
|
5237
|
+
}
|
|
5238
|
+
switch (prop) {
|
|
5239
|
+
case "generateContent":
|
|
5240
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.generateContent.invoke(
|
|
5241
|
+
value,
|
|
5242
|
+
target,
|
|
5243
|
+
args,
|
|
5244
|
+
{}
|
|
5245
|
+
);
|
|
5246
|
+
case "generateContentStream":
|
|
5247
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.generateContentStream.invoke(
|
|
5248
|
+
value,
|
|
5249
|
+
target,
|
|
5250
|
+
args,
|
|
5251
|
+
{}
|
|
5252
|
+
);
|
|
5253
|
+
case "embedContent":
|
|
5254
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.embedContent.invoke(
|
|
5255
|
+
value,
|
|
5256
|
+
target,
|
|
5257
|
+
args,
|
|
5258
|
+
{}
|
|
5259
|
+
);
|
|
5260
|
+
case "batchEmbedContents":
|
|
5261
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.batchEmbedContents.invoke(
|
|
5262
|
+
value,
|
|
5263
|
+
target,
|
|
5264
|
+
args,
|
|
5265
|
+
{}
|
|
5266
|
+
);
|
|
5267
|
+
case "sendMessage":
|
|
5268
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.sendMessage.invoke(
|
|
5269
|
+
value,
|
|
5270
|
+
target,
|
|
5271
|
+
args,
|
|
5272
|
+
{}
|
|
5273
|
+
);
|
|
5274
|
+
case "sendMessageStream":
|
|
5275
|
+
return (...args) => _chunkAW4QECG5js.googleGenerativeAIChannels.sendMessageStream.invoke(
|
|
5276
|
+
value,
|
|
5277
|
+
target,
|
|
5278
|
+
args,
|
|
5279
|
+
{}
|
|
5280
|
+
);
|
|
5281
|
+
}
|
|
5282
|
+
return value.bind(target);
|
|
5283
|
+
}
|
|
5284
|
+
});
|
|
5285
|
+
proxies.set(client, proxy);
|
|
5286
|
+
proxies.set(proxy, proxy);
|
|
5287
|
+
return proxy;
|
|
5288
|
+
}
|
|
5289
|
+
|
|
5217
5290
|
// src/wrappers/google-genai.ts
|
|
5218
5291
|
function wrapGoogleGenAI(googleGenAI) {
|
|
5219
5292
|
if (!googleGenAI || typeof googleGenAI !== "object") {
|
|
@@ -5260,7 +5333,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
5260
5333
|
}
|
|
5261
5334
|
if (prop === "interactions") {
|
|
5262
5335
|
const interactions = Reflect.get(target, prop, receiver);
|
|
5263
|
-
if (!
|
|
5336
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
5264
5337
|
return interactions;
|
|
5265
5338
|
}
|
|
5266
5339
|
if (interactions !== originalInteractions) {
|
|
@@ -5274,7 +5347,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
5274
5347
|
});
|
|
5275
5348
|
}
|
|
5276
5349
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
5277
|
-
if (!
|
|
5350
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
5278
5351
|
return;
|
|
5279
5352
|
}
|
|
5280
5353
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -5307,7 +5380,7 @@ function wrapInteractions(interactions) {
|
|
|
5307
5380
|
}
|
|
5308
5381
|
function wrapGenerateContent(original) {
|
|
5309
5382
|
return function(params) {
|
|
5310
|
-
return
|
|
5383
|
+
return _chunkAW4QECG5js.googleGenAIChannels.generateContent.tracePromise(
|
|
5311
5384
|
() => original(params),
|
|
5312
5385
|
{ arguments: [params] }
|
|
5313
5386
|
);
|
|
@@ -5315,7 +5388,7 @@ function wrapGenerateContent(original) {
|
|
|
5315
5388
|
}
|
|
5316
5389
|
function wrapGenerateContentStream(original) {
|
|
5317
5390
|
return function(params) {
|
|
5318
|
-
return
|
|
5391
|
+
return _chunkAW4QECG5js.googleGenAIChannels.generateContentStream.tracePromise(
|
|
5319
5392
|
() => original(params),
|
|
5320
5393
|
{ arguments: [params] }
|
|
5321
5394
|
);
|
|
@@ -5323,7 +5396,7 @@ function wrapGenerateContentStream(original) {
|
|
|
5323
5396
|
}
|
|
5324
5397
|
function wrapEmbedContent(original) {
|
|
5325
5398
|
return function(params) {
|
|
5326
|
-
return
|
|
5399
|
+
return _chunkAW4QECG5js.googleGenAIChannels.embedContent.tracePromise(
|
|
5327
5400
|
() => original(params),
|
|
5328
5401
|
{ arguments: [params] }
|
|
5329
5402
|
);
|
|
@@ -5335,7 +5408,7 @@ function wrapInteractionCreate(original) {
|
|
|
5335
5408
|
return options === void 0 ? original(params) : original(params, options);
|
|
5336
5409
|
}
|
|
5337
5410
|
const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
|
|
5338
|
-
return
|
|
5411
|
+
return _chunkAW4QECG5js.googleGenAIChannels.interactionsCreate.tracePromise(
|
|
5339
5412
|
() => options === void 0 ? original(params) : original(params, options),
|
|
5340
5413
|
traceContext
|
|
5341
5414
|
);
|
|
@@ -5396,7 +5469,7 @@ function wrapRunnerInstance(runner) {
|
|
|
5396
5469
|
function wrapRunnerRunAsync(runner) {
|
|
5397
5470
|
const original = runner.runAsync.bind(runner);
|
|
5398
5471
|
return function(params) {
|
|
5399
|
-
return
|
|
5472
|
+
return _chunkAW4QECG5js.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
5400
5473
|
arguments: [params],
|
|
5401
5474
|
self: runner
|
|
5402
5475
|
});
|
|
@@ -5423,7 +5496,7 @@ function wrapAgentInstance2(agent) {
|
|
|
5423
5496
|
function wrapAgentRunAsync(agent) {
|
|
5424
5497
|
const original = agent.runAsync.bind(agent);
|
|
5425
5498
|
return function(parentContext) {
|
|
5426
|
-
return
|
|
5499
|
+
return _chunkAW4QECG5js.googleADKChannels.agentRunAsync.traceSync(
|
|
5427
5500
|
() => original(parentContext),
|
|
5428
5501
|
{ arguments: [parentContext], self: agent }
|
|
5429
5502
|
);
|
|
@@ -5450,7 +5523,7 @@ function wrapToolInstance(tool) {
|
|
|
5450
5523
|
function wrapToolRunAsync(tool) {
|
|
5451
5524
|
const original = tool.runAsync.bind(tool);
|
|
5452
5525
|
return function(req) {
|
|
5453
|
-
return
|
|
5526
|
+
return _chunkAW4QECG5js.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
5454
5527
|
arguments: [req],
|
|
5455
5528
|
self: tool
|
|
5456
5529
|
});
|
|
@@ -5597,27 +5670,27 @@ function patchGenkitRegistryConstructor(registry) {
|
|
|
5597
5670
|
}
|
|
5598
5671
|
}
|
|
5599
5672
|
function wrapGenerate(generate) {
|
|
5600
|
-
return (input) =>
|
|
5673
|
+
return (input) => _chunkAW4QECG5js.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
5601
5674
|
arguments: [input]
|
|
5602
5675
|
});
|
|
5603
5676
|
}
|
|
5604
5677
|
function wrapGenerateStream(generateStream) {
|
|
5605
|
-
return (input) =>
|
|
5678
|
+
return (input) => _chunkAW4QECG5js.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
5606
5679
|
arguments: [input]
|
|
5607
5680
|
});
|
|
5608
5681
|
}
|
|
5609
5682
|
function wrapEmbed2(embed) {
|
|
5610
|
-
return (params) =>
|
|
5683
|
+
return (params) => _chunkAW4QECG5js.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
5611
5684
|
arguments: [params]
|
|
5612
5685
|
});
|
|
5613
5686
|
}
|
|
5614
5687
|
function wrapEmbedMany2(embedMany) {
|
|
5615
|
-
return (params) =>
|
|
5688
|
+
return (params) => _chunkAW4QECG5js.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
5616
5689
|
arguments: [params]
|
|
5617
5690
|
});
|
|
5618
5691
|
}
|
|
5619
5692
|
function wrapRun(run) {
|
|
5620
|
-
return (name, inputOrFn, maybeFn) =>
|
|
5693
|
+
return (name, inputOrFn, maybeFn) => _chunkAW4QECG5js.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
5621
5694
|
arguments: [name, inputOrFn, maybeFn]
|
|
5622
5695
|
});
|
|
5623
5696
|
}
|
|
@@ -5656,13 +5729,13 @@ function isGenkitAction(value) {
|
|
|
5656
5729
|
return typeof value === "function" && "__action" in value;
|
|
5657
5730
|
}
|
|
5658
5731
|
function traceActionRun(action, run) {
|
|
5659
|
-
return (input, options) =>
|
|
5732
|
+
return (input, options) => _chunkAW4QECG5js.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
5660
5733
|
arguments: [input, options],
|
|
5661
5734
|
self: action
|
|
5662
5735
|
});
|
|
5663
5736
|
}
|
|
5664
5737
|
function traceActionStream(action, stream) {
|
|
5665
|
-
return (input, options) =>
|
|
5738
|
+
return (input, options) => _chunkAW4QECG5js.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
5666
5739
|
arguments: [input, options],
|
|
5667
5740
|
self: action
|
|
5668
5741
|
});
|
|
@@ -5708,10 +5781,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
5708
5781
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
5709
5782
|
}
|
|
5710
5783
|
function hasFunction2(value, methodName) {
|
|
5711
|
-
return
|
|
5784
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
5712
5785
|
}
|
|
5713
5786
|
function isSupportedHuggingFaceModule(value) {
|
|
5714
|
-
if (!
|
|
5787
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, value)) {
|
|
5715
5788
|
return false;
|
|
5716
5789
|
}
|
|
5717
5790
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -5819,14 +5892,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
5819
5892
|
const context = {
|
|
5820
5893
|
arguments: [traceParams]
|
|
5821
5894
|
};
|
|
5822
|
-
return
|
|
5895
|
+
return _chunkAW4QECG5js.huggingFaceChannels.chatCompletion.tracePromise(
|
|
5823
5896
|
() => original(params, options),
|
|
5824
5897
|
context
|
|
5825
5898
|
);
|
|
5826
5899
|
};
|
|
5827
5900
|
}
|
|
5828
5901
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
5829
|
-
return (params, options) =>
|
|
5902
|
+
return (params, options) => _chunkAW4QECG5js.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
5830
5903
|
() => original(params, options),
|
|
5831
5904
|
{
|
|
5832
5905
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -5839,14 +5912,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
5839
5912
|
const context = {
|
|
5840
5913
|
arguments: [traceParams]
|
|
5841
5914
|
};
|
|
5842
|
-
return
|
|
5915
|
+
return _chunkAW4QECG5js.huggingFaceChannels.textGeneration.tracePromise(
|
|
5843
5916
|
() => original(params, options),
|
|
5844
5917
|
context
|
|
5845
5918
|
);
|
|
5846
5919
|
};
|
|
5847
5920
|
}
|
|
5848
5921
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
5849
|
-
return (params, options) =>
|
|
5922
|
+
return (params, options) => _chunkAW4QECG5js.huggingFaceChannels.textGenerationStream.traceSync(
|
|
5850
5923
|
() => original(params, options),
|
|
5851
5924
|
{
|
|
5852
5925
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -5859,7 +5932,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
5859
5932
|
const context = {
|
|
5860
5933
|
arguments: [traceParams]
|
|
5861
5934
|
};
|
|
5862
|
-
return
|
|
5935
|
+
return _chunkAW4QECG5js.huggingFaceChannels.featureExtraction.tracePromise(
|
|
5863
5936
|
() => original(params, options),
|
|
5864
5937
|
context
|
|
5865
5938
|
);
|
|
@@ -5877,7 +5950,7 @@ var PIPELINE_CONSTRUCTOR_KEYS = /* @__PURE__ */ new Set([
|
|
|
5877
5950
|
var wrappedValues = /* @__PURE__ */ new WeakMap();
|
|
5878
5951
|
function wrapHuggingFaceTransformers(transformers) {
|
|
5879
5952
|
const pipelineTask = _optionalChain([transformers, 'optionalAccess', _141 => _141.task]);
|
|
5880
|
-
if (typeof transformers === "function" &&
|
|
5953
|
+
if (typeof transformers === "function" && _chunkAW4QECG5js.isSupportedHuggingFaceTransformersTask.call(void 0, pipelineTask)) {
|
|
5881
5954
|
return wrapPipeline(transformers);
|
|
5882
5955
|
}
|
|
5883
5956
|
if (!isSupportedModule(transformers)) {
|
|
@@ -5929,8 +6002,8 @@ function wrapPipelineFactory(factory) {
|
|
|
5929
6002
|
const context = {
|
|
5930
6003
|
arguments: args
|
|
5931
6004
|
};
|
|
5932
|
-
return
|
|
5933
|
-
if (
|
|
6005
|
+
return _chunkAW4QECG5js.huggingFaceTransformersChannels.pipeline.tracePromise(() => Reflect.apply(factory, this, args), context).then((pipeline) => {
|
|
6006
|
+
if (_chunkAW4QECG5js.isSupportedHuggingFaceTransformersTask.call(void 0, _nullishCoalesce(pipeline.task, () => ( task)))) {
|
|
5934
6007
|
return wrapPipeline(pipeline);
|
|
5935
6008
|
}
|
|
5936
6009
|
return pipeline;
|
|
@@ -5948,7 +6021,7 @@ function wrapPipelineConstructor(constructor) {
|
|
|
5948
6021
|
const proxy = new Proxy(constructor, {
|
|
5949
6022
|
construct(target, args, newTarget) {
|
|
5950
6023
|
const pipeline = Reflect.construct(target, args, newTarget);
|
|
5951
|
-
if (
|
|
6024
|
+
if (_chunkAW4QECG5js.isSupportedHuggingFaceTransformersTask.call(void 0, pipeline.task)) {
|
|
5952
6025
|
return wrapPipeline(pipeline);
|
|
5953
6026
|
}
|
|
5954
6027
|
return pipeline;
|
|
@@ -5969,7 +6042,7 @@ function wrapPipeline(pipeline) {
|
|
|
5969
6042
|
arguments: args,
|
|
5970
6043
|
self: target
|
|
5971
6044
|
};
|
|
5972
|
-
return
|
|
6045
|
+
return _chunkAW4QECG5js.huggingFaceTransformersChannels.pipelineCall.tracePromise(
|
|
5973
6046
|
() => Reflect.apply(target, thisArg, args),
|
|
5974
6047
|
context
|
|
5975
6048
|
);
|
|
@@ -6020,7 +6093,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
6020
6093
|
const request = cloneCallModelRequest(argArray[0]);
|
|
6021
6094
|
const options = argArray[1];
|
|
6022
6095
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
6023
|
-
return
|
|
6096
|
+
return _chunkAW4QECG5js.openRouterAgentChannels.callModel.traceSync(
|
|
6024
6097
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
6025
6098
|
{
|
|
6026
6099
|
arguments: [request]
|
|
@@ -6116,24 +6189,24 @@ function rerankProxy(rerank) {
|
|
|
6116
6189
|
});
|
|
6117
6190
|
}
|
|
6118
6191
|
function wrapChatSend(send) {
|
|
6119
|
-
return (request, options) =>
|
|
6192
|
+
return (request, options) => _chunkAW4QECG5js.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
6120
6193
|
arguments: [request]
|
|
6121
6194
|
});
|
|
6122
6195
|
}
|
|
6123
6196
|
function wrapEmbeddingsGenerate(generate) {
|
|
6124
|
-
return (request, options) =>
|
|
6197
|
+
return (request, options) => _chunkAW4QECG5js.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
6125
6198
|
() => generate(request, options),
|
|
6126
6199
|
{ arguments: [request] }
|
|
6127
6200
|
);
|
|
6128
6201
|
}
|
|
6129
6202
|
function wrapResponsesSend(send) {
|
|
6130
|
-
return (request, options) =>
|
|
6203
|
+
return (request, options) => _chunkAW4QECG5js.openRouterChannels.betaResponsesSend.tracePromise(
|
|
6131
6204
|
() => send(request, options),
|
|
6132
6205
|
{ arguments: [request] }
|
|
6133
6206
|
);
|
|
6134
6207
|
}
|
|
6135
6208
|
function wrapRerank2(rerank) {
|
|
6136
|
-
return (request, options) =>
|
|
6209
|
+
return (request, options) => _chunkAW4QECG5js.openRouterChannels.rerankRerank.tracePromise(
|
|
6137
6210
|
() => rerank(request, options),
|
|
6138
6211
|
{ arguments: [request] }
|
|
6139
6212
|
);
|
|
@@ -6141,7 +6214,7 @@ function wrapRerank2(rerank) {
|
|
|
6141
6214
|
function wrapCallModel2(callModel) {
|
|
6142
6215
|
return (request, options) => {
|
|
6143
6216
|
const tracedRequest = { ...request };
|
|
6144
|
-
return
|
|
6217
|
+
return _chunkAW4QECG5js.openRouterChannels.callModel.traceSync(
|
|
6145
6218
|
() => callModel(tracedRequest, options),
|
|
6146
6219
|
{
|
|
6147
6220
|
arguments: [tracedRequest]
|
|
@@ -6274,7 +6347,7 @@ function classifiersProxy(classifiers) {
|
|
|
6274
6347
|
});
|
|
6275
6348
|
}
|
|
6276
6349
|
function wrapChatComplete(complete) {
|
|
6277
|
-
return (request, options) =>
|
|
6350
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.chatComplete.tracePromise(
|
|
6278
6351
|
() => complete(request, options),
|
|
6279
6352
|
{
|
|
6280
6353
|
arguments: [request]
|
|
@@ -6282,52 +6355,52 @@ function wrapChatComplete(complete) {
|
|
|
6282
6355
|
);
|
|
6283
6356
|
}
|
|
6284
6357
|
function wrapChatStream(stream) {
|
|
6285
|
-
return (request, options) =>
|
|
6358
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
6286
6359
|
arguments: [request]
|
|
6287
6360
|
});
|
|
6288
6361
|
}
|
|
6289
6362
|
function wrapEmbeddingsCreate(create) {
|
|
6290
|
-
return (request, options) =>
|
|
6363
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.embeddingsCreate.tracePromise(
|
|
6291
6364
|
() => create(request, options),
|
|
6292
6365
|
{ arguments: [request] }
|
|
6293
6366
|
);
|
|
6294
6367
|
}
|
|
6295
6368
|
function wrapClassifiersModerate(moderate) {
|
|
6296
|
-
return (request, options) =>
|
|
6369
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.classifiersModerate.tracePromise(
|
|
6297
6370
|
() => moderate(request, options),
|
|
6298
6371
|
{ arguments: [request] }
|
|
6299
6372
|
);
|
|
6300
6373
|
}
|
|
6301
6374
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
6302
|
-
return (request, options) =>
|
|
6375
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.classifiersModerateChat.tracePromise(
|
|
6303
6376
|
() => moderateChat(request, options),
|
|
6304
6377
|
{ arguments: [request] }
|
|
6305
6378
|
);
|
|
6306
6379
|
}
|
|
6307
6380
|
function wrapClassifiersClassify(classify) {
|
|
6308
|
-
return (request, options) =>
|
|
6381
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.classifiersClassify.tracePromise(
|
|
6309
6382
|
() => classify(request, options),
|
|
6310
6383
|
{ arguments: [request] }
|
|
6311
6384
|
);
|
|
6312
6385
|
}
|
|
6313
6386
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
6314
|
-
return (request, options) =>
|
|
6387
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
6315
6388
|
() => classifyChat(request, options),
|
|
6316
6389
|
{ arguments: [request] }
|
|
6317
6390
|
);
|
|
6318
6391
|
}
|
|
6319
6392
|
function wrapFimComplete(complete) {
|
|
6320
|
-
return (request, options) =>
|
|
6393
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
6321
6394
|
arguments: [request]
|
|
6322
6395
|
});
|
|
6323
6396
|
}
|
|
6324
6397
|
function wrapFimStream(stream) {
|
|
6325
|
-
return (request, options) =>
|
|
6398
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
6326
6399
|
arguments: [request]
|
|
6327
6400
|
});
|
|
6328
6401
|
}
|
|
6329
6402
|
function wrapAgentsComplete(complete) {
|
|
6330
|
-
return (request, options) =>
|
|
6403
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.agentsComplete.tracePromise(
|
|
6331
6404
|
() => complete(request, options),
|
|
6332
6405
|
{
|
|
6333
6406
|
arguments: [request]
|
|
@@ -6335,7 +6408,7 @@ function wrapAgentsComplete(complete) {
|
|
|
6335
6408
|
);
|
|
6336
6409
|
}
|
|
6337
6410
|
function wrapAgentsStream(stream) {
|
|
6338
|
-
return (request, options) =>
|
|
6411
|
+
return (request, options) => _chunkAW4QECG5js.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
6339
6412
|
arguments: [request]
|
|
6340
6413
|
});
|
|
6341
6414
|
}
|
|
@@ -6345,12 +6418,12 @@ function wrapOllama(ollama) {
|
|
|
6345
6418
|
if (isSupportedOllamaClient(ollama)) {
|
|
6346
6419
|
return ollamaProxy(ollama);
|
|
6347
6420
|
}
|
|
6348
|
-
|
|
6421
|
+
_chunkAW4QECG5js.debugLogger.warn("Unsupported Ollama library. Not wrapping.");
|
|
6349
6422
|
return ollama;
|
|
6350
6423
|
}
|
|
6351
6424
|
var ollamaProxyCache = /* @__PURE__ */ new WeakMap();
|
|
6352
6425
|
function isSupportedOllamaClient(value) {
|
|
6353
|
-
return
|
|
6426
|
+
return _chunkBTRLPQG5js.isObject.call(void 0, value) && ["chat", "generate", "embed"].some(
|
|
6354
6427
|
(name) => typeof value[name] === "function"
|
|
6355
6428
|
);
|
|
6356
6429
|
}
|
|
@@ -6402,17 +6475,17 @@ function ollamaProxy(ollama) {
|
|
|
6402
6475
|
return proxy;
|
|
6403
6476
|
}
|
|
6404
6477
|
function wrapChat(chat) {
|
|
6405
|
-
return (request) =>
|
|
6478
|
+
return (request) => _chunkAW4QECG5js.ollamaChannels.chat.tracePromise(() => chat(request), {
|
|
6406
6479
|
arguments: [request]
|
|
6407
6480
|
});
|
|
6408
6481
|
}
|
|
6409
6482
|
function wrapGenerate2(generate) {
|
|
6410
|
-
return (request) =>
|
|
6483
|
+
return (request) => _chunkAW4QECG5js.ollamaChannels.generate.tracePromise(() => generate(request), {
|
|
6411
6484
|
arguments: [request]
|
|
6412
6485
|
});
|
|
6413
6486
|
}
|
|
6414
6487
|
function wrapEmbed3(embed) {
|
|
6415
|
-
return (request) =>
|
|
6488
|
+
return (request) => _chunkAW4QECG5js.ollamaChannels.embed.tracePromise(() => embed(request), {
|
|
6416
6489
|
arguments: [request]
|
|
6417
6490
|
});
|
|
6418
6491
|
}
|
|
@@ -6465,22 +6538,22 @@ function cohereProxy(cohere) {
|
|
|
6465
6538
|
return proxy;
|
|
6466
6539
|
}
|
|
6467
6540
|
function wrapChat2(chat) {
|
|
6468
|
-
return (request, options) =>
|
|
6541
|
+
return (request, options) => _chunkAW4QECG5js.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
6469
6542
|
arguments: [request]
|
|
6470
6543
|
});
|
|
6471
6544
|
}
|
|
6472
6545
|
function wrapChatStream2(chatStream) {
|
|
6473
|
-
return (request, options) =>
|
|
6546
|
+
return (request, options) => _chunkAW4QECG5js.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
6474
6547
|
arguments: [request]
|
|
6475
6548
|
});
|
|
6476
6549
|
}
|
|
6477
6550
|
function wrapEmbed4(embed) {
|
|
6478
|
-
return (request, options) =>
|
|
6551
|
+
return (request, options) => _chunkAW4QECG5js.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
6479
6552
|
arguments: [request]
|
|
6480
6553
|
});
|
|
6481
6554
|
}
|
|
6482
6555
|
function wrapRerank3(rerank) {
|
|
6483
|
-
return (request, options) =>
|
|
6556
|
+
return (request, options) => _chunkAW4QECG5js.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
6484
6557
|
arguments: [request]
|
|
6485
6558
|
});
|
|
6486
6559
|
}
|
|
@@ -6518,7 +6591,7 @@ function voyageAIProxy(client) {
|
|
|
6518
6591
|
if (typeof target.embed !== "function") {
|
|
6519
6592
|
return target.embed;
|
|
6520
6593
|
}
|
|
6521
|
-
return (request, options) =>
|
|
6594
|
+
return (request, options) => _chunkAW4QECG5js.voyageAIChannels.embed.invoke(
|
|
6522
6595
|
target.embed,
|
|
6523
6596
|
target,
|
|
6524
6597
|
[request, options],
|
|
@@ -6528,7 +6601,7 @@ function voyageAIProxy(client) {
|
|
|
6528
6601
|
if (typeof target.multimodalEmbed !== "function") {
|
|
6529
6602
|
return target.multimodalEmbed;
|
|
6530
6603
|
}
|
|
6531
|
-
return (request, options) =>
|
|
6604
|
+
return (request, options) => _chunkAW4QECG5js.voyageAIChannels.multimodalEmbed.invoke(
|
|
6532
6605
|
target.multimodalEmbed,
|
|
6533
6606
|
target,
|
|
6534
6607
|
[request, options],
|
|
@@ -6538,7 +6611,7 @@ function voyageAIProxy(client) {
|
|
|
6538
6611
|
if (typeof target.rerank !== "function") {
|
|
6539
6612
|
return target.rerank;
|
|
6540
6613
|
}
|
|
6541
|
-
return (request, options) =>
|
|
6614
|
+
return (request, options) => _chunkAW4QECG5js.voyageAIChannels.rerank.invoke(
|
|
6542
6615
|
target.rerank,
|
|
6543
6616
|
target,
|
|
6544
6617
|
[request, options],
|
|
@@ -6548,7 +6621,7 @@ function voyageAIProxy(client) {
|
|
|
6548
6621
|
if (typeof target.contextualizedEmbed !== "function") {
|
|
6549
6622
|
return target.contextualizedEmbed;
|
|
6550
6623
|
}
|
|
6551
|
-
return (request, options) =>
|
|
6624
|
+
return (request, options) => _chunkAW4QECG5js.voyageAIChannels.contextualizedEmbed.invoke(
|
|
6552
6625
|
target.contextualizedEmbed,
|
|
6553
6626
|
target,
|
|
6554
6627
|
[request, options],
|
|
@@ -6640,13 +6713,13 @@ function groqProxy(groq) {
|
|
|
6640
6713
|
return topLevelProxy;
|
|
6641
6714
|
}
|
|
6642
6715
|
function wrapChatCompletionsCreate(create) {
|
|
6643
|
-
return (request, options) =>
|
|
6716
|
+
return (request, options) => _chunkAW4QECG5js.groqChannels.chatCompletionsCreate.tracePromise(
|
|
6644
6717
|
() => create(request, options),
|
|
6645
6718
|
{ arguments: [request] }
|
|
6646
6719
|
);
|
|
6647
6720
|
}
|
|
6648
6721
|
function wrapEmbeddingsCreate2(create) {
|
|
6649
|
-
return (request, options) =>
|
|
6722
|
+
return (request, options) => _chunkAW4QECG5js.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
6650
6723
|
arguments: [request]
|
|
6651
6724
|
});
|
|
6652
6725
|
}
|
|
@@ -6720,16 +6793,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
6720
6793
|
}
|
|
6721
6794
|
function wrapSend(send) {
|
|
6722
6795
|
return (command, optionsOrCb, cb) => {
|
|
6723
|
-
if (
|
|
6796
|
+
if (_chunkBTRLPQG5js.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
6724
6797
|
return send(command, optionsOrCb, cb);
|
|
6725
6798
|
}
|
|
6726
|
-
return
|
|
6727
|
-
() =>
|
|
6799
|
+
return _chunkAW4QECG5js.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
6800
|
+
() => _chunkBTRLPQG5js.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
6728
6801
|
() => send(command, optionsOrCb)
|
|
6729
6802
|
),
|
|
6730
6803
|
{
|
|
6731
6804
|
arguments: [command, optionsOrCb],
|
|
6732
|
-
span_info:
|
|
6805
|
+
span_info: _chunkBTRLPQG5js.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
6733
6806
|
}
|
|
6734
6807
|
);
|
|
6735
6808
|
};
|
|
@@ -6778,13 +6851,13 @@ function copilotClientProxy(client) {
|
|
|
6778
6851
|
return proxy;
|
|
6779
6852
|
}
|
|
6780
6853
|
function wrappedCreateSession(client) {
|
|
6781
|
-
return (config) =>
|
|
6854
|
+
return (config) => _chunkAW4QECG5js.gitHubCopilotChannels.createSession.tracePromise(
|
|
6782
6855
|
() => client.createSession(config),
|
|
6783
6856
|
{ arguments: [config] }
|
|
6784
6857
|
);
|
|
6785
6858
|
}
|
|
6786
6859
|
function wrappedResumeSession(client) {
|
|
6787
|
-
return (sessionId, config) =>
|
|
6860
|
+
return (sessionId, config) => _chunkAW4QECG5js.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
6788
6861
|
() => client.resumeSession(sessionId, config),
|
|
6789
6862
|
{ arguments: [sessionId, config] }
|
|
6790
6863
|
);
|
|
@@ -6962,13 +7035,13 @@ function wrapRunTreeInstance(runTree) {
|
|
|
6962
7035
|
wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
|
|
6963
7036
|
} else if (prop === "postRun") {
|
|
6964
7037
|
const method = value;
|
|
6965
|
-
wrapped = (...args) =>
|
|
7038
|
+
wrapped = (...args) => _chunkAW4QECG5js.langSmithChannels.createRun.tracePromise(
|
|
6966
7039
|
() => Reflect.apply(method, target, args),
|
|
6967
7040
|
{ arguments: [target] }
|
|
6968
7041
|
);
|
|
6969
7042
|
} else if (prop === "patchRun") {
|
|
6970
7043
|
const method = value;
|
|
6971
|
-
wrapped = (...args) =>
|
|
7044
|
+
wrapped = (...args) => _chunkAW4QECG5js.langSmithChannels.updateRun.tracePromise(
|
|
6972
7045
|
() => Reflect.apply(method, target, args),
|
|
6973
7046
|
{
|
|
6974
7047
|
arguments: [
|
|
@@ -7017,19 +7090,19 @@ function wrapClientInstance(client) {
|
|
|
7017
7090
|
let wrapped;
|
|
7018
7091
|
if (prop === "createRun") {
|
|
7019
7092
|
const method = value;
|
|
7020
|
-
wrapped = (...args) =>
|
|
7093
|
+
wrapped = (...args) => _chunkAW4QECG5js.langSmithChannels.createRun.tracePromise(
|
|
7021
7094
|
() => Reflect.apply(method, target, args),
|
|
7022
7095
|
{ arguments: args }
|
|
7023
7096
|
);
|
|
7024
7097
|
} else if (prop === "updateRun") {
|
|
7025
7098
|
const method = value;
|
|
7026
|
-
wrapped = (...args) =>
|
|
7099
|
+
wrapped = (...args) => _chunkAW4QECG5js.langSmithChannels.updateRun.tracePromise(
|
|
7027
7100
|
() => Reflect.apply(method, target, args),
|
|
7028
7101
|
{ arguments: args }
|
|
7029
7102
|
);
|
|
7030
7103
|
} else if (prop === "batchIngestRuns") {
|
|
7031
7104
|
const method = value;
|
|
7032
|
-
wrapped = (...args) =>
|
|
7105
|
+
wrapped = (...args) => _chunkAW4QECG5js.langSmithChannels.batchIngestRuns.tracePromise(
|
|
7033
7106
|
() => Reflect.apply(method, target, args),
|
|
7034
7107
|
{ arguments: args }
|
|
7035
7108
|
);
|
|
@@ -7045,13 +7118,13 @@ function publishRunUpdate(runTree) {
|
|
|
7045
7118
|
return;
|
|
7046
7119
|
}
|
|
7047
7120
|
try {
|
|
7048
|
-
void
|
|
7121
|
+
void _chunkAW4QECG5js.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
7049
7122
|
arguments: [runTree.id, runTree]
|
|
7050
7123
|
}).catch((error) => {
|
|
7051
|
-
|
|
7124
|
+
_chunkAW4QECG5js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
7052
7125
|
});
|
|
7053
7126
|
} catch (error) {
|
|
7054
|
-
|
|
7127
|
+
_chunkAW4QECG5js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
7055
7128
|
}
|
|
7056
7129
|
}
|
|
7057
7130
|
|
|
@@ -7063,7 +7136,7 @@ var VitestContextManager = class {
|
|
|
7063
7136
|
*/
|
|
7064
7137
|
|
|
7065
7138
|
constructor() {
|
|
7066
|
-
this.contextStorage =
|
|
7139
|
+
this.contextStorage = _chunkAW4QECG5js.isomorph_default.newAsyncLocalStorage();
|
|
7067
7140
|
}
|
|
7068
7141
|
getCurrentContext() {
|
|
7069
7142
|
return this.contextStorage.getStore();
|
|
@@ -7101,7 +7174,7 @@ var FlushCoordinator = (_class3 = class {constructor() { _class3.prototype.__ini
|
|
|
7101
7174
|
if (this.activeFlushes.has(experimentId)) {
|
|
7102
7175
|
return this.activeFlushes.get(experimentId);
|
|
7103
7176
|
}
|
|
7104
|
-
const flushPromise =
|
|
7177
|
+
const flushPromise = _chunkBTRLPQG5js.summarizeAndFlush.call(void 0, context.experiment, {
|
|
7105
7178
|
displaySummary: config.displaySummary
|
|
7106
7179
|
});
|
|
7107
7180
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -7199,7 +7272,7 @@ async function runTracedEval(args) {
|
|
|
7199
7272
|
}
|
|
7200
7273
|
if (testError) {
|
|
7201
7274
|
span.log({ scores: { pass: 0 } });
|
|
7202
|
-
|
|
7275
|
+
_chunkBTRLPQG5js.logError.call(void 0, span, testError);
|
|
7203
7276
|
throw testError;
|
|
7204
7277
|
}
|
|
7205
7278
|
span.log({
|
|
@@ -7373,10 +7446,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
7373
7446
|
const getOrCreateContext = () => {
|
|
7374
7447
|
if (!context) {
|
|
7375
7448
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
7376
|
-
const experiment = config.projectId ?
|
|
7449
|
+
const experiment = config.projectId ? _chunkBTRLPQG5js.initExperiment.call(void 0, {
|
|
7377
7450
|
projectId: config.projectId,
|
|
7378
7451
|
experiment: experimentName
|
|
7379
|
-
}) :
|
|
7452
|
+
}) : _chunkBTRLPQG5js.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
7380
7453
|
experiment: experimentName
|
|
7381
7454
|
});
|
|
7382
7455
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -7483,7 +7556,7 @@ function wrapExpect(originalExpect) {
|
|
|
7483
7556
|
return originalExpect(value);
|
|
7484
7557
|
}
|
|
7485
7558
|
const assertion = originalExpect(value, message);
|
|
7486
|
-
const span =
|
|
7559
|
+
const span = _chunkBTRLPQG5js.currentSpan.call(void 0, );
|
|
7487
7560
|
if (!span) {
|
|
7488
7561
|
return assertion;
|
|
7489
7562
|
}
|
|
@@ -7495,16 +7568,16 @@ function wrapExpect(originalExpect) {
|
|
|
7495
7568
|
|
|
7496
7569
|
// src/wrappers/shared/logging.ts
|
|
7497
7570
|
function logOutputs(outputs) {
|
|
7498
|
-
|
|
7571
|
+
_chunkBTRLPQG5js.currentSpan.call(void 0, ).log({ output: outputs });
|
|
7499
7572
|
}
|
|
7500
7573
|
function logFeedback(feedback) {
|
|
7501
|
-
|
|
7574
|
+
_chunkBTRLPQG5js.currentSpan.call(void 0, ).log({
|
|
7502
7575
|
scores: { [feedback.name]: feedback.score },
|
|
7503
7576
|
metadata: feedback.metadata
|
|
7504
7577
|
});
|
|
7505
7578
|
}
|
|
7506
7579
|
function getCurrentSpan() {
|
|
7507
|
-
return
|
|
7580
|
+
return _chunkBTRLPQG5js.currentSpan.call(void 0, );
|
|
7508
7581
|
}
|
|
7509
7582
|
|
|
7510
7583
|
// src/wrappers/vitest/index.ts
|
|
@@ -7552,7 +7625,7 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
7552
7625
|
);
|
|
7553
7626
|
return;
|
|
7554
7627
|
}
|
|
7555
|
-
await
|
|
7628
|
+
await _chunkBTRLPQG5js.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
7556
7629
|
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _156 => _156.displaySummary]), () => ( config.displaySummary))
|
|
7557
7630
|
});
|
|
7558
7631
|
}
|
|
@@ -7567,7 +7640,7 @@ function initNodeTestSuite(config) {
|
|
|
7567
7640
|
return experiment;
|
|
7568
7641
|
}
|
|
7569
7642
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
7570
|
-
experiment =
|
|
7643
|
+
experiment = _chunkBTRLPQG5js.initExperiment.call(void 0, config.projectName, {
|
|
7571
7644
|
experiment: experimentName
|
|
7572
7645
|
});
|
|
7573
7646
|
return experiment;
|
|
@@ -7616,7 +7689,7 @@ function initNodeTestSuite(config) {
|
|
|
7616
7689
|
if (!experiment) {
|
|
7617
7690
|
return;
|
|
7618
7691
|
}
|
|
7619
|
-
await
|
|
7692
|
+
await _chunkBTRLPQG5js.summarizeAndFlush.call(void 0, experiment, {
|
|
7620
7693
|
displaySummary: config.displaySummary
|
|
7621
7694
|
});
|
|
7622
7695
|
experiment = void 0;
|
|
@@ -7633,7 +7706,7 @@ function initNodeTestSuite(config) {
|
|
|
7633
7706
|
|
|
7634
7707
|
// src/graph-framework.ts
|
|
7635
7708
|
var graph_framework_exports = {};
|
|
7636
|
-
|
|
7709
|
+
_chunkAW4QECG5js.__export.call(void 0, graph_framework_exports, {
|
|
7637
7710
|
AggregatorNode: () => AggregatorNode,
|
|
7638
7711
|
GateNode: () => GateNode,
|
|
7639
7712
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -7707,7 +7780,7 @@ var GraphBuilder = (_class4 = class {
|
|
|
7707
7780
|
};
|
|
7708
7781
|
}
|
|
7709
7782
|
resolveNode(node) {
|
|
7710
|
-
if (node instanceof
|
|
7783
|
+
if (node instanceof _chunkBTRLPQG5js.Prompt) {
|
|
7711
7784
|
const cached = this.nodeLikeNodes.get(node);
|
|
7712
7785
|
if (cached) {
|
|
7713
7786
|
return [cached, []];
|
|
@@ -7757,7 +7830,7 @@ var GraphBuilder = (_class4 = class {
|
|
|
7757
7830
|
// }
|
|
7758
7831
|
// Helper to generate node IDs
|
|
7759
7832
|
generateId(name) {
|
|
7760
|
-
const uuid =
|
|
7833
|
+
const uuid = _chunkBTRLPQG5js.newId.call(void 0, );
|
|
7761
7834
|
if (name) {
|
|
7762
7835
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
7763
7836
|
} else {
|
|
@@ -8957,7 +9030,7 @@ function waterfall(tasks, callback) {
|
|
|
8957
9030
|
var waterfall$1 = awaitify(waterfall);
|
|
8958
9031
|
|
|
8959
9032
|
// src/trace.ts
|
|
8960
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
9033
|
+
var SpanFetcher = class _SpanFetcher extends _chunkBTRLPQG5js.ObjectFetcher {
|
|
8961
9034
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
8962
9035
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
8963
9036
|
rootSpanId,
|
|
@@ -9274,20 +9347,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
9274
9347
|
prompt: _v3.z.string()
|
|
9275
9348
|
}),
|
|
9276
9349
|
_v3.z.object({
|
|
9277
|
-
messages: _v3.z.array(
|
|
9350
|
+
messages: _v3.z.array(_chunkBTRLPQG5js.ChatCompletionMessageParam)
|
|
9278
9351
|
})
|
|
9279
9352
|
]);
|
|
9280
9353
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
9281
9354
|
_v3.z.object({
|
|
9282
9355
|
model: _v3.z.string(),
|
|
9283
|
-
params:
|
|
9356
|
+
params: _chunkBTRLPQG5js.ModelParams.optional(),
|
|
9284
9357
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
9285
9358
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
9286
9359
|
})
|
|
9287
9360
|
);
|
|
9288
9361
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
9289
9362
|
_v3.z.object({
|
|
9290
|
-
tools: _v3.z.array(
|
|
9363
|
+
tools: _v3.z.array(_chunkBTRLPQG5js.ToolFunctionDefinition).optional()
|
|
9291
9364
|
})
|
|
9292
9365
|
);
|
|
9293
9366
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -9335,7 +9408,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
9335
9408
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
9336
9409
|
return parameters;
|
|
9337
9410
|
}
|
|
9338
|
-
if (
|
|
9411
|
+
if (_chunkBTRLPQG5js.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
9339
9412
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
9340
9413
|
...resolvedSchema.data,
|
|
9341
9414
|
...parameters
|
|
@@ -9357,14 +9430,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
9357
9430
|
const value = parameters[name];
|
|
9358
9431
|
try {
|
|
9359
9432
|
if ("type" in schema && schema.type === "prompt") {
|
|
9360
|
-
const promptData = value ?
|
|
9433
|
+
const promptData = value ? _chunkBTRLPQG5js.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
9361
9434
|
schema.default,
|
|
9362
9435
|
schema.default.tools
|
|
9363
9436
|
) : void 0;
|
|
9364
9437
|
if (!promptData) {
|
|
9365
9438
|
throw new Error(`Parameter '${name}' is required`);
|
|
9366
9439
|
}
|
|
9367
|
-
return [name,
|
|
9440
|
+
return [name, _chunkBTRLPQG5js.Prompt.fromPromptData(name, promptData)];
|
|
9368
9441
|
} else if ("type" in schema && schema.type === "model") {
|
|
9369
9442
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
9370
9443
|
if (model === void 0) {
|
|
@@ -9415,7 +9488,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
9415
9488
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
9416
9489
|
return [
|
|
9417
9490
|
name,
|
|
9418
|
-
|
|
9491
|
+
_chunkBTRLPQG5js.Prompt.fromPromptData(name, _chunkBTRLPQG5js.PromptData.parse(value))
|
|
9419
9492
|
];
|
|
9420
9493
|
}
|
|
9421
9494
|
return [name, value];
|
|
@@ -9465,7 +9538,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
9465
9538
|
return out;
|
|
9466
9539
|
}
|
|
9467
9540
|
function initExperiment2(state, options = {}) {
|
|
9468
|
-
return
|
|
9541
|
+
return _chunkBTRLPQG5js.init.call(void 0, {
|
|
9469
9542
|
state,
|
|
9470
9543
|
...options,
|
|
9471
9544
|
setCurrent: false
|
|
@@ -9476,7 +9549,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
9476
9549
|
return void 0;
|
|
9477
9550
|
}
|
|
9478
9551
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
9479
|
-
if (!
|
|
9552
|
+
if (!_chunkBTRLPQG5js.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
9480
9553
|
return void 0;
|
|
9481
9554
|
}
|
|
9482
9555
|
if (resolvedParameters.id === void 0) {
|
|
@@ -9503,7 +9576,7 @@ async function _internalInitEvaluatorExperiment(projectName, evaluator, data, op
|
|
|
9503
9576
|
baseExperimentId: evaluator.baseExperimentId,
|
|
9504
9577
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
9505
9578
|
repoInfo: evaluator.repoInfo,
|
|
9506
|
-
dataset:
|
|
9579
|
+
dataset: _chunkBTRLPQG5js.Dataset.isDataset(data) ? data : void 0,
|
|
9507
9580
|
parameters
|
|
9508
9581
|
});
|
|
9509
9582
|
}
|
|
@@ -9539,7 +9612,7 @@ async function _internalResolveEvaluatorData(evaluator, experiment) {
|
|
|
9539
9612
|
);
|
|
9540
9613
|
}
|
|
9541
9614
|
let name = dataResult.name;
|
|
9542
|
-
if (
|
|
9615
|
+
if (_chunkBTRLPQG5js.isEmpty.call(void 0, name)) {
|
|
9543
9616
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
9544
9617
|
if (!baseExperiment) {
|
|
9545
9618
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -9574,10 +9647,10 @@ globalThis._evals = {
|
|
|
9574
9647
|
reporters: {}
|
|
9575
9648
|
};
|
|
9576
9649
|
function _initializeSpanContext() {
|
|
9577
|
-
globalThis._spanContext = { currentSpan:
|
|
9650
|
+
globalThis._spanContext = { currentSpan: _chunkBTRLPQG5js.currentSpan, withCurrent: _chunkBTRLPQG5js.withCurrent, startSpan: _chunkBTRLPQG5js.startSpan, NOOP_SPAN: _chunkBTRLPQG5js.NOOP_SPAN };
|
|
9578
9651
|
}
|
|
9579
9652
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
9580
|
-
const options =
|
|
9653
|
+
const options = _chunkBTRLPQG5js.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
9581
9654
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
9582
9655
|
if (globalThis._evals.evaluators[evalName]) {
|
|
9583
9656
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -9636,7 +9709,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
9636
9709
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
9637
9710
|
let ret;
|
|
9638
9711
|
if (options.parent) {
|
|
9639
|
-
ret = await
|
|
9712
|
+
ret = await _chunkBTRLPQG5js.withParent.call(void 0,
|
|
9640
9713
|
options.parent,
|
|
9641
9714
|
() => runEvaluator(
|
|
9642
9715
|
null,
|
|
@@ -9672,7 +9745,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
9672
9745
|
if (experiment) {
|
|
9673
9746
|
await experiment.flush().catch(console.error);
|
|
9674
9747
|
} else if (options.parent) {
|
|
9675
|
-
await
|
|
9748
|
+
await _chunkBTRLPQG5js.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
9676
9749
|
}
|
|
9677
9750
|
}
|
|
9678
9751
|
} finally {
|
|
@@ -9756,7 +9829,7 @@ function _internalPrepareEvaluatorScore(scoreValue, name) {
|
|
|
9756
9829
|
if (Array.isArray(scoreValue)) {
|
|
9757
9830
|
const names = /* @__PURE__ */ new Set();
|
|
9758
9831
|
for (const score of scoreValue) {
|
|
9759
|
-
if (!(typeof score === "object" && !
|
|
9832
|
+
if (!(typeof score === "object" && !_chunkBTRLPQG5js.isEmpty.call(void 0, score))) {
|
|
9760
9833
|
throw new Error(
|
|
9761
9834
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(score)}`
|
|
9762
9835
|
);
|
|
@@ -9775,7 +9848,7 @@ function _internalPrepareEvaluatorScore(scoreValue, name) {
|
|
|
9775
9848
|
let results;
|
|
9776
9849
|
if (Array.isArray(scoreValue)) {
|
|
9777
9850
|
results = scoreValue;
|
|
9778
|
-
} else if (typeof scoreValue === "object" && !
|
|
9851
|
+
} else if (typeof scoreValue === "object" && !_chunkBTRLPQG5js.isEmpty.call(void 0, scoreValue)) {
|
|
9779
9852
|
results = [{ ...scoreValue, name: _nullishCoalesce(scoreValue.name, () => ( name)) }];
|
|
9780
9853
|
} else {
|
|
9781
9854
|
results = [{ name, score: scoreValue }];
|
|
@@ -9819,7 +9892,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
9819
9892
|
return failing;
|
|
9820
9893
|
}
|
|
9821
9894
|
function validateClassificationResult(value, scorerName2) {
|
|
9822
|
-
if (!(typeof value === "object" && value !== null && !
|
|
9895
|
+
if (!(typeof value === "object" && value !== null && !_chunkBTRLPQG5js.isEmpty.call(void 0, value))) {
|
|
9823
9896
|
throw new Error(
|
|
9824
9897
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
9825
9898
|
);
|
|
@@ -9869,7 +9942,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
9869
9942
|
);
|
|
9870
9943
|
metadata[`${kind}_errors`] = errorMap;
|
|
9871
9944
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
9872
|
-
|
|
9945
|
+
_chunkAW4QECG5js.debugLogger.forState(state).warn(
|
|
9873
9946
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
9874
9947
|
failures.map((f) => f.error)
|
|
9875
9948
|
);
|
|
@@ -9903,7 +9976,7 @@ var defaultErrorScoreHandler = ({
|
|
|
9903
9976
|
};
|
|
9904
9977
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
9905
9978
|
if (enableCache) {
|
|
9906
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
9979
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _170 => _170.spanCache, 'optionalAccess', _171 => _171.start, 'call', _172 => _172()]);
|
|
9907
9980
|
}
|
|
9908
9981
|
try {
|
|
9909
9982
|
parameters = await validateParameters(
|
|
@@ -9934,7 +10007,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9934
10007
|
if (cancelled) {
|
|
9935
10008
|
return;
|
|
9936
10009
|
}
|
|
9937
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
10010
|
+
const eventDataset = experiment ? experiment.dataset : _chunkBTRLPQG5js.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
9938
10011
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
9939
10012
|
object_type: "dataset",
|
|
9940
10013
|
object_id: await eventDataset.id,
|
|
@@ -9942,7 +10015,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9942
10015
|
created: datum.created,
|
|
9943
10016
|
_xact_id: datum._xact_id
|
|
9944
10017
|
} : void 0;
|
|
9945
|
-
const parsedDatumOrigin =
|
|
10018
|
+
const parsedDatumOrigin = _chunkBTRLPQG5js.ObjectReference.safeParse(datum.origin);
|
|
9946
10019
|
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _173 => _173.success]) ? parsedDatumOrigin.data : void 0)));
|
|
9947
10020
|
const baseEvent = {
|
|
9948
10021
|
name: "eval",
|
|
@@ -9958,23 +10031,23 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9958
10031
|
}
|
|
9959
10032
|
};
|
|
9960
10033
|
const callback = async (rootSpan) => {
|
|
9961
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
10034
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )));
|
|
9962
10035
|
const ensureSpansFlushed = async () => {
|
|
9963
10036
|
if (experiment) {
|
|
9964
|
-
await
|
|
10037
|
+
await _chunkBTRLPQG5js.flush.call(void 0, { state: experiment.loggingState });
|
|
9965
10038
|
} else if (state) {
|
|
9966
|
-
await
|
|
10039
|
+
await _chunkBTRLPQG5js.flush.call(void 0, { state });
|
|
9967
10040
|
} else {
|
|
9968
|
-
await
|
|
10041
|
+
await _chunkBTRLPQG5js.flush.call(void 0, );
|
|
9969
10042
|
}
|
|
9970
10043
|
if (state) {
|
|
9971
10044
|
await state.flushOtel();
|
|
9972
10045
|
}
|
|
9973
10046
|
};
|
|
9974
10047
|
const parentStr = state.currentParent.getStore();
|
|
9975
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
10048
|
+
const parentComponents = typeof parentStr === "string" ? _chunkBTRLPQG5js.SpanComponentsV4.fromStr(parentStr) : null;
|
|
9976
10049
|
const trace = state ? new LocalTrace({
|
|
9977
|
-
objectType: parentComponents ?
|
|
10050
|
+
objectType: parentComponents ? _chunkBTRLPQG5js.spanObjectTypeV3ToTypedString.call(void 0,
|
|
9978
10051
|
parentComponents.data.object_type
|
|
9979
10052
|
) : "experiment",
|
|
9980
10053
|
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _174 => _174.data, 'access', async _175 => _175.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
@@ -10039,7 +10112,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10039
10112
|
trace
|
|
10040
10113
|
};
|
|
10041
10114
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
10042
|
-
const propagatedEvent =
|
|
10115
|
+
const propagatedEvent = _chunkBTRLPQG5js.makeScorerPropagatedEvent.call(void 0,
|
|
10043
10116
|
await rootSpan.export()
|
|
10044
10117
|
);
|
|
10045
10118
|
const [scoreResults, classificationResults] = await Promise.all([
|
|
@@ -10134,7 +10207,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10134
10207
|
evaluator.state
|
|
10135
10208
|
);
|
|
10136
10209
|
} catch (e) {
|
|
10137
|
-
|
|
10210
|
+
_chunkBTRLPQG5js.logError.call(void 0, rootSpan, e);
|
|
10138
10211
|
error = e;
|
|
10139
10212
|
} finally {
|
|
10140
10213
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -10168,7 +10241,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10168
10241
|
}
|
|
10169
10242
|
};
|
|
10170
10243
|
if (!experiment) {
|
|
10171
|
-
return await
|
|
10244
|
+
return await _chunkBTRLPQG5js.traced.call(void 0, callback, {
|
|
10172
10245
|
...baseEvent,
|
|
10173
10246
|
state: evaluator.state
|
|
10174
10247
|
});
|
|
@@ -10222,7 +10295,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10222
10295
|
const cancel = async () => {
|
|
10223
10296
|
await new Promise((_, reject2) => {
|
|
10224
10297
|
if (cancelled) {
|
|
10225
|
-
reject2(new (0,
|
|
10298
|
+
reject2(new (0, _chunkBTRLPQG5js.InternalAbortError)("Evaluator already cancelled"));
|
|
10226
10299
|
return;
|
|
10227
10300
|
}
|
|
10228
10301
|
const rejectOnce = (error) => {
|
|
@@ -10235,12 +10308,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10235
10308
|
};
|
|
10236
10309
|
if (evaluator.timeout) {
|
|
10237
10310
|
timeoutId = setTimeout(() => {
|
|
10238
|
-
rejectOnce(new (0,
|
|
10311
|
+
rejectOnce(new (0, _chunkBTRLPQG5js.InternalAbortError)("Evaluator timed out"));
|
|
10239
10312
|
}, evaluator.timeout);
|
|
10240
10313
|
}
|
|
10241
10314
|
if (evaluator.signal) {
|
|
10242
10315
|
abortHandler = () => {
|
|
10243
|
-
rejectOnce(new (0,
|
|
10316
|
+
rejectOnce(new (0, _chunkBTRLPQG5js.InternalAbortError)("Evaluator aborted"));
|
|
10244
10317
|
};
|
|
10245
10318
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
10246
10319
|
}
|
|
@@ -10263,9 +10336,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10263
10336
|
}
|
|
10264
10337
|
} catch (e) {
|
|
10265
10338
|
q.kill();
|
|
10266
|
-
if (e instanceof
|
|
10267
|
-
if (
|
|
10268
|
-
|
|
10339
|
+
if (e instanceof _chunkBTRLPQG5js.InternalAbortError) {
|
|
10340
|
+
if (_chunkAW4QECG5js.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
10341
|
+
_chunkAW4QECG5js.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
10269
10342
|
}
|
|
10270
10343
|
}
|
|
10271
10344
|
throw e;
|
|
@@ -10290,7 +10363,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
10290
10363
|
);
|
|
10291
10364
|
} finally {
|
|
10292
10365
|
if (enableCache) {
|
|
10293
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
10366
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _183 => _183.spanCache]);
|
|
10294
10367
|
_optionalChain([spanCache, 'optionalAccess', _184 => _184.dispose, 'call', _185 => _185()]);
|
|
10295
10368
|
_optionalChain([spanCache, 'optionalAccess', _186 => _186.stop, 'call', _187 => _187()]);
|
|
10296
10369
|
}
|
|
@@ -10385,25 +10458,25 @@ var defaultReporter = {
|
|
|
10385
10458
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
10386
10459
|
}
|
|
10387
10460
|
if (jsonl) {
|
|
10388
|
-
|
|
10461
|
+
_chunkAW4QECG5js.isomorph_default.writeln(JSON.stringify(summary));
|
|
10389
10462
|
} else {
|
|
10390
|
-
|
|
10391
|
-
|
|
10463
|
+
_chunkAW4QECG5js.isomorph_default.writeln("Experiment summary");
|
|
10464
|
+
_chunkAW4QECG5js.isomorph_default.writeln("==================");
|
|
10392
10465
|
if (summary.comparisonExperimentName) {
|
|
10393
|
-
|
|
10466
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10394
10467
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
10395
10468
|
);
|
|
10396
|
-
|
|
10469
|
+
_chunkAW4QECG5js.isomorph_default.writeln("");
|
|
10397
10470
|
}
|
|
10398
10471
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
10399
10472
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
10400
10473
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
10401
10474
|
if (hasScores || hasMetrics) {
|
|
10402
10475
|
if (hasComparison) {
|
|
10403
|
-
|
|
10476
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10404
10477
|
"Name Value Change Improvements Regressions"
|
|
10405
10478
|
);
|
|
10406
|
-
|
|
10479
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10407
10480
|
"----------------------------------------------------------------"
|
|
10408
10481
|
);
|
|
10409
10482
|
}
|
|
@@ -10412,18 +10485,18 @@ var defaultReporter = {
|
|
|
10412
10485
|
const scoreValue = `${scorePercent}%`;
|
|
10413
10486
|
if (hasComparison) {
|
|
10414
10487
|
let diffString = "-";
|
|
10415
|
-
if (!
|
|
10488
|
+
if (!_chunkBTRLPQG5js.isEmpty.call(void 0, score.diff)) {
|
|
10416
10489
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
10417
10490
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
10418
10491
|
diffString = `${diffSign}${diffPercent}%`;
|
|
10419
10492
|
}
|
|
10420
10493
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
10421
10494
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
10422
|
-
|
|
10495
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10423
10496
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
10424
10497
|
);
|
|
10425
10498
|
} else {
|
|
10426
|
-
|
|
10499
|
+
_chunkAW4QECG5js.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
10427
10500
|
}
|
|
10428
10501
|
}
|
|
10429
10502
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -10432,30 +10505,30 @@ var defaultReporter = {
|
|
|
10432
10505
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
10433
10506
|
if (hasComparison) {
|
|
10434
10507
|
let diffString = "-";
|
|
10435
|
-
if (!
|
|
10508
|
+
if (!_chunkBTRLPQG5js.isEmpty.call(void 0, metric.diff)) {
|
|
10436
10509
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
10437
10510
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
10438
10511
|
diffString = `${diffSign}${diffPercent}%`;
|
|
10439
10512
|
}
|
|
10440
10513
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
10441
10514
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
10442
|
-
|
|
10515
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10443
10516
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
10444
10517
|
);
|
|
10445
10518
|
} else {
|
|
10446
|
-
|
|
10519
|
+
_chunkAW4QECG5js.isomorph_default.writeln(
|
|
10447
10520
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
10448
10521
|
);
|
|
10449
10522
|
}
|
|
10450
10523
|
}
|
|
10451
10524
|
}
|
|
10452
10525
|
if (summary.experimentUrl) {
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10526
|
+
_chunkAW4QECG5js.isomorph_default.writeln("");
|
|
10527
|
+
_chunkAW4QECG5js.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
10528
|
+
_chunkAW4QECG5js.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
10456
10529
|
}
|
|
10457
10530
|
}
|
|
10458
|
-
|
|
10531
|
+
_chunkAW4QECG5js.isomorph_default.writeln("");
|
|
10459
10532
|
return failingResults.length === 0;
|
|
10460
10533
|
},
|
|
10461
10534
|
async reportRun(evalReports) {
|
|
@@ -10502,13 +10575,13 @@ var DurableEvalRedisStore = class {
|
|
|
10502
10575
|
if (typeof value !== "string") {
|
|
10503
10576
|
throw new Error("DurableEvalRedisStore expected GET to return a string");
|
|
10504
10577
|
}
|
|
10505
|
-
return
|
|
10578
|
+
return _chunkBTRLPQG5js.base64ToUint8Array.call(void 0, value);
|
|
10506
10579
|
}
|
|
10507
10580
|
async write(key, value) {
|
|
10508
10581
|
const client = this.client;
|
|
10509
10582
|
const set = client.set;
|
|
10510
10583
|
const redisKey = `${this.keyPrefix}${key}`;
|
|
10511
|
-
const encoded =
|
|
10584
|
+
const encoded = _chunkBTRLPQG5js.uint8ArrayToBase64.call(void 0, value);
|
|
10512
10585
|
if (typeof client.defineCommand === "function") {
|
|
10513
10586
|
await set.call(client, redisKey, encoded, "PX", this.ttlMs);
|
|
10514
10587
|
} else if (typeof client.sendCommand === "function") {
|
|
@@ -10523,7 +10596,7 @@ var DurableEvalRedisStore = class {
|
|
|
10523
10596
|
}
|
|
10524
10597
|
async getOrSet(key, value) {
|
|
10525
10598
|
const redisKey = `${this.keyPrefix}${key}`;
|
|
10526
|
-
const encoded =
|
|
10599
|
+
const encoded = _chunkBTRLPQG5js.uint8ArrayToBase64.call(void 0, value);
|
|
10527
10600
|
const client = this.client;
|
|
10528
10601
|
const set = client.set;
|
|
10529
10602
|
let setOptions;
|
|
@@ -10545,7 +10618,7 @@ var DurableEvalRedisStore = class {
|
|
|
10545
10618
|
"DurableEvalRedisStore expected atomic SET to return a string or null"
|
|
10546
10619
|
);
|
|
10547
10620
|
}
|
|
10548
|
-
return { value:
|
|
10621
|
+
return { value: _chunkBTRLPQG5js.base64ToUint8Array.call(void 0, existing), created: false };
|
|
10549
10622
|
}
|
|
10550
10623
|
};
|
|
10551
10624
|
var BatchTask = (_class9 = class {
|
|
@@ -10579,7 +10652,7 @@ function defineDurableEval(projectName, evaluator) {
|
|
|
10579
10652
|
}
|
|
10580
10653
|
async function startDurableEval(definition, options) {
|
|
10581
10654
|
const store = definition.evaluator.store;
|
|
10582
|
-
const runId =
|
|
10655
|
+
const runId = _chunkBTRLPQG5js.newId.call(void 0, );
|
|
10583
10656
|
const key = runKey(definition.projectName, definition.evalName, runId);
|
|
10584
10657
|
const { data } = callEvaluatorData(definition.evaluator.data);
|
|
10585
10658
|
const parameters = await validateParameters(
|
|
@@ -10792,9 +10865,9 @@ function currentStatus(definition, state) {
|
|
|
10792
10865
|
return { status: "waiting", runId: state.runId, pending };
|
|
10793
10866
|
}
|
|
10794
10867
|
async function startCaseRoot(definition, state, record, experiment) {
|
|
10795
|
-
if (!experiment) return
|
|
10868
|
+
if (!experiment) return _chunkBTRLPQG5js.NOOP_SPAN;
|
|
10796
10869
|
const datum = record.datum;
|
|
10797
|
-
return
|
|
10870
|
+
return _chunkBTRLPQG5js._internalStartSpanWithInitialMerge.call(void 0, {
|
|
10798
10871
|
...definition.evaluator.state ? { state: definition.evaluator.state } : {},
|
|
10799
10872
|
parent: await experiment.export(),
|
|
10800
10873
|
name: "eval",
|
|
@@ -10860,7 +10933,7 @@ async function logTaskResult(definition, state, record, experiment, task) {
|
|
|
10860
10933
|
record.rootSpan = await root.export();
|
|
10861
10934
|
record.taskLogged = true;
|
|
10862
10935
|
} catch (error) {
|
|
10863
|
-
|
|
10936
|
+
_chunkBTRLPQG5js.logError.call(void 0, root, error);
|
|
10864
10937
|
throw error;
|
|
10865
10938
|
} finally {
|
|
10866
10939
|
root.end();
|
|
@@ -10970,11 +11043,11 @@ function scorerArgs(record) {
|
|
|
10970
11043
|
};
|
|
10971
11044
|
}
|
|
10972
11045
|
function resumeCaseRoot(definition, record, experiment) {
|
|
10973
|
-
if (!experiment) return
|
|
11046
|
+
if (!experiment) return _chunkBTRLPQG5js.NOOP_SPAN;
|
|
10974
11047
|
if (!record.rootSpan) {
|
|
10975
11048
|
throw new Error(`Durable eval case ${record.caseId} has no root span`);
|
|
10976
11049
|
}
|
|
10977
|
-
return
|
|
11050
|
+
return _chunkBTRLPQG5js._internalResumeSpan.call(void 0, {
|
|
10978
11051
|
exported: record.rootSpan,
|
|
10979
11052
|
state: definition.evaluator.state
|
|
10980
11053
|
});
|
|
@@ -11006,14 +11079,14 @@ async function evaluateAndLogScore(definition, state, record, name, experiment,
|
|
|
11006
11079
|
type: "score" /* SCORE */,
|
|
11007
11080
|
purpose: "scorer"
|
|
11008
11081
|
},
|
|
11009
|
-
propagatedEvent:
|
|
11082
|
+
propagatedEvent: _chunkBTRLPQG5js.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
|
|
11010
11083
|
event: { input: scorerArgs(record) }
|
|
11011
11084
|
}
|
|
11012
11085
|
);
|
|
11013
11086
|
if (prepared.scores) root.log({ scores: prepared.scores });
|
|
11014
11087
|
record.loggedScores[name] = true;
|
|
11015
11088
|
} catch (error) {
|
|
11016
|
-
|
|
11089
|
+
_chunkBTRLPQG5js.logError.call(void 0, root, error);
|
|
11017
11090
|
throw error;
|
|
11018
11091
|
} finally {
|
|
11019
11092
|
root.end();
|
|
@@ -11045,7 +11118,7 @@ async function evaluateAndLogClassification(definition, state, record, name, cla
|
|
|
11045
11118
|
type: "classifier" /* CLASSIFIER */,
|
|
11046
11119
|
purpose: "scorer"
|
|
11047
11120
|
},
|
|
11048
|
-
propagatedEvent:
|
|
11121
|
+
propagatedEvent: _chunkBTRLPQG5js.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
|
|
11049
11122
|
event: { input: scorerArgs(record) }
|
|
11050
11123
|
}
|
|
11051
11124
|
);
|
|
@@ -11054,7 +11127,7 @@ async function evaluateAndLogClassification(definition, state, record, name, cla
|
|
|
11054
11127
|
}
|
|
11055
11128
|
record.loggedClassifications[name] = true;
|
|
11056
11129
|
} catch (error) {
|
|
11057
|
-
|
|
11130
|
+
_chunkBTRLPQG5js.logError.call(void 0, root, error);
|
|
11058
11131
|
throw error;
|
|
11059
11132
|
} finally {
|
|
11060
11133
|
root.end();
|
|
@@ -11315,7 +11388,7 @@ function runKey(projectName, evalName, runId) {
|
|
|
11315
11388
|
return `durable-eval/v1/runs/${contentVersion(encoder.encode(`${projectName}\0${evalName}\0${runId}`))}`;
|
|
11316
11389
|
}
|
|
11317
11390
|
function encodedKeyPart(value) {
|
|
11318
|
-
return
|
|
11391
|
+
return _chunkBTRLPQG5js.uint8ArrayToBase64.call(void 0, encoder.encode(value)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
11319
11392
|
}
|
|
11320
11393
|
function caseRecordKey(key, caseId, kind, ...names) {
|
|
11321
11394
|
const suffix = names.map(encodedKeyPart).join("/");
|
|
@@ -11560,7 +11633,7 @@ function deterministicId(value) {
|
|
|
11560
11633
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
|
|
11561
11634
|
}
|
|
11562
11635
|
function contentVersion(value) {
|
|
11563
|
-
if (
|
|
11636
|
+
if (_chunkAW4QECG5js.isomorph_default.hash) return _chunkAW4QECG5js.isomorph_default.hash(decoder.decode(value));
|
|
11564
11637
|
let hash = 2166136261;
|
|
11565
11638
|
for (const byte of value) {
|
|
11566
11639
|
hash ^= byte;
|
|
@@ -12040,7 +12113,7 @@ var Project2 = (_class11 = class {
|
|
|
12040
12113
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
12041
12114
|
return;
|
|
12042
12115
|
}
|
|
12043
|
-
await
|
|
12116
|
+
await _chunkBTRLPQG5js.login.call(void 0, );
|
|
12044
12117
|
const projectMap = new ProjectNameIdMap();
|
|
12045
12118
|
const functionDefinitions = [];
|
|
12046
12119
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -12054,7 +12127,7 @@ var Project2 = (_class11 = class {
|
|
|
12054
12127
|
functionDefinitions.push(functionDefinition);
|
|
12055
12128
|
}
|
|
12056
12129
|
}
|
|
12057
|
-
await
|
|
12130
|
+
await _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
12058
12131
|
functions: functionDefinitions
|
|
12059
12132
|
});
|
|
12060
12133
|
}
|
|
@@ -12073,12 +12146,12 @@ var ToolBuilder = (_class12 = class {
|
|
|
12073
12146
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
12074
12147
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
12075
12148
|
if (resolvedName.trim().length === 0) {
|
|
12076
|
-
resolvedName = `Tool ${
|
|
12149
|
+
resolvedName = `Tool ${_chunkAW4QECG5js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
12077
12150
|
}
|
|
12078
12151
|
const tool = new CodeFunction(this.project, {
|
|
12079
12152
|
handler,
|
|
12080
12153
|
name: resolvedName,
|
|
12081
|
-
slug: _nullishCoalesce(slug, () => (
|
|
12154
|
+
slug: _nullishCoalesce(slug, () => ( _chunkBTRLPQG5js.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
12082
12155
|
type: "tool",
|
|
12083
12156
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
12084
12157
|
parameters,
|
|
@@ -12103,9 +12176,9 @@ var ScorerBuilder = (_class13 = class {
|
|
|
12103
12176
|
resolvedName = opts.handler.name;
|
|
12104
12177
|
}
|
|
12105
12178
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
12106
|
-
resolvedName = `Scorer ${
|
|
12179
|
+
resolvedName = `Scorer ${_chunkAW4QECG5js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
12107
12180
|
}
|
|
12108
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
12181
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkBTRLPQG5js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
12109
12182
|
if ("handler" in opts) {
|
|
12110
12183
|
const scorer = new CodeFunction(this.project, {
|
|
12111
12184
|
...opts,
|
|
@@ -12160,9 +12233,9 @@ var ClassifierBuilder = (_class14 = class {
|
|
|
12160
12233
|
this.taskCounter++;
|
|
12161
12234
|
let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
|
|
12162
12235
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
12163
|
-
resolvedName = `Classifier ${
|
|
12236
|
+
resolvedName = `Classifier ${_chunkAW4QECG5js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
12164
12237
|
}
|
|
12165
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
12238
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkBTRLPQG5js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
12166
12239
|
const classifier = new CodeFunction(this.project, {
|
|
12167
12240
|
...opts,
|
|
12168
12241
|
name: resolvedName,
|
|
@@ -12291,18 +12364,18 @@ var PromptBuilder = class {
|
|
|
12291
12364
|
rawTools.push(tool);
|
|
12292
12365
|
}
|
|
12293
12366
|
}
|
|
12294
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
12367
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkBTRLPQG5js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
12295
12368
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
12296
12369
|
const promptRow = {
|
|
12297
12370
|
id: opts.id,
|
|
12298
|
-
_xact_id: opts.version ?
|
|
12371
|
+
_xact_id: opts.version ? _chunkBTRLPQG5js.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
12299
12372
|
name: opts.name,
|
|
12300
12373
|
slug,
|
|
12301
12374
|
prompt_data: promptData,
|
|
12302
12375
|
tags: opts.tags,
|
|
12303
12376
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
12304
12377
|
};
|
|
12305
|
-
const prompt = new (0,
|
|
12378
|
+
const prompt = new (0, _chunkBTRLPQG5js.Prompt)(
|
|
12306
12379
|
promptRow,
|
|
12307
12380
|
{},
|
|
12308
12381
|
// It doesn't make sense to specify defaults here.
|
|
@@ -12357,7 +12430,7 @@ var ParametersBuilder = class {
|
|
|
12357
12430
|
}
|
|
12358
12431
|
|
|
12359
12432
|
create(opts) {
|
|
12360
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
12433
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkBTRLPQG5js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
12361
12434
|
const codeParameters = new CodeParameters(this.project, {
|
|
12362
12435
|
name: opts.name,
|
|
12363
12436
|
slug,
|
|
@@ -12396,7 +12469,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
12396
12469
|
required.push(name);
|
|
12397
12470
|
}
|
|
12398
12471
|
} else {
|
|
12399
|
-
const schemaObj =
|
|
12472
|
+
const schemaObj = _chunkBTRLPQG5js.zodToJsonSchema.call(void 0, value);
|
|
12400
12473
|
properties[name] = schemaObj;
|
|
12401
12474
|
if (!("default" in schemaObj)) {
|
|
12402
12475
|
required.push(name);
|
|
@@ -12425,11 +12498,11 @@ var ProjectNameIdMap = (_class15 = class {constructor() { _class15.prototype.__i
|
|
|
12425
12498
|
__init31() {this.idToName = {}}
|
|
12426
12499
|
async getId(projectName) {
|
|
12427
12500
|
if (!(projectName in this.nameToId)) {
|
|
12428
|
-
const response = await
|
|
12501
|
+
const response = await _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
12429
12502
|
project_name: projectName
|
|
12430
12503
|
});
|
|
12431
12504
|
const result = _v3.z.object({
|
|
12432
|
-
project:
|
|
12505
|
+
project: _chunkBTRLPQG5js.Project
|
|
12433
12506
|
}).parse(response);
|
|
12434
12507
|
const projectId = result.project.id;
|
|
12435
12508
|
this.nameToId[projectName] = projectId;
|
|
@@ -12439,10 +12512,10 @@ var ProjectNameIdMap = (_class15 = class {constructor() { _class15.prototype.__i
|
|
|
12439
12512
|
}
|
|
12440
12513
|
async getName(projectId) {
|
|
12441
12514
|
if (!(projectId in this.idToName)) {
|
|
12442
|
-
const response = await
|
|
12515
|
+
const response = await _chunkBTRLPQG5js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
12443
12516
|
id: projectId
|
|
12444
12517
|
});
|
|
12445
|
-
const result = _v3.z.array(
|
|
12518
|
+
const result = _v3.z.array(_chunkBTRLPQG5js.Project).nonempty().parse(response);
|
|
12446
12519
|
const projectName = result[0].name;
|
|
12447
12520
|
this.idToName[projectId] = projectName;
|
|
12448
12521
|
this.nameToId[projectName] = projectId;
|
|
@@ -12462,16 +12535,16 @@ var ProjectNameIdMap = (_class15 = class {constructor() { _class15.prototype.__i
|
|
|
12462
12535
|
var evalBodySchema = _v3.z.object({
|
|
12463
12536
|
name: _v3.z.string(),
|
|
12464
12537
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
12465
|
-
data:
|
|
12538
|
+
data: _chunkBTRLPQG5js.RunEval.shape.data,
|
|
12466
12539
|
scores: _v3.z.array(
|
|
12467
12540
|
_v3.z.object({
|
|
12468
|
-
function_id:
|
|
12541
|
+
function_id: _chunkBTRLPQG5js.FunctionId,
|
|
12469
12542
|
name: _v3.z.string()
|
|
12470
12543
|
})
|
|
12471
12544
|
).nullish(),
|
|
12472
12545
|
experiment_name: _v3.z.string().nullish(),
|
|
12473
12546
|
project_id: _v3.z.string().nullish(),
|
|
12474
|
-
parent:
|
|
12547
|
+
parent: _chunkBTRLPQG5js.InvokeParent.optional(),
|
|
12475
12548
|
stream: _v3.z.boolean().optional()
|
|
12476
12549
|
});
|
|
12477
12550
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -12479,7 +12552,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
12479
12552
|
_v3.z.union([
|
|
12480
12553
|
_v3.z.object({
|
|
12481
12554
|
type: _v3.z.literal("prompt"),
|
|
12482
|
-
default:
|
|
12555
|
+
default: _chunkBTRLPQG5js.PromptData.optional(),
|
|
12483
12556
|
description: _v3.z.string().optional()
|
|
12484
12557
|
}),
|
|
12485
12558
|
_v3.z.object({
|
|
@@ -12534,8 +12607,69 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
12534
12607
|
evaluatorDefinitionSchema
|
|
12535
12608
|
);
|
|
12536
12609
|
|
|
12610
|
+
// src/wrappers/elevenlabs.ts
|
|
12611
|
+
var clients = /* @__PURE__ */ new WeakMap();
|
|
12612
|
+
function wrapElevenLabs(client) {
|
|
12613
|
+
if (!_chunkBTRLPQG5js.isObject.call(void 0, client) || !_chunkBTRLPQG5js.isObject.call(void 0, client.textToSpeech) || typeof client.textToSpeech.convert !== "function") {
|
|
12614
|
+
_chunkAW4QECG5js.debugLogger.warn("Unsupported ElevenLabs client. Not wrapping.");
|
|
12615
|
+
return client;
|
|
12616
|
+
}
|
|
12617
|
+
const cached = clients.get(client);
|
|
12618
|
+
if (cached) return cached;
|
|
12619
|
+
const sdk = client;
|
|
12620
|
+
const speech = new Proxy(sdk.textToSpeech, {
|
|
12621
|
+
get(target, prop, receiver) {
|
|
12622
|
+
switch (prop) {
|
|
12623
|
+
case "convert":
|
|
12624
|
+
case "stream":
|
|
12625
|
+
return (...args) => _chunkAW4QECG5js.elevenLabsChannels[prop].invoke(target[prop], target, args, {});
|
|
12626
|
+
case "convertWithTimestamps":
|
|
12627
|
+
return (...args) => _chunkAW4QECG5js.elevenLabsChannels.convertWithTimestamps.invoke(
|
|
12628
|
+
target.convertWithTimestamps,
|
|
12629
|
+
target,
|
|
12630
|
+
args,
|
|
12631
|
+
{}
|
|
12632
|
+
);
|
|
12633
|
+
case "streamWithTimestamps":
|
|
12634
|
+
return (...args) => _chunkAW4QECG5js.elevenLabsChannels.streamWithTimestamps.invoke(
|
|
12635
|
+
target.streamWithTimestamps,
|
|
12636
|
+
target,
|
|
12637
|
+
args,
|
|
12638
|
+
{}
|
|
12639
|
+
);
|
|
12640
|
+
default:
|
|
12641
|
+
return Reflect.get(target, prop, receiver);
|
|
12642
|
+
}
|
|
12643
|
+
}
|
|
12644
|
+
});
|
|
12645
|
+
const transcription = new Proxy(sdk.speechToText, {
|
|
12646
|
+
get(target, prop, receiver) {
|
|
12647
|
+
if (prop === "convert")
|
|
12648
|
+
return (request, options) => _chunkAW4QECG5js.elevenLabsChannels.transcribe.invoke(
|
|
12649
|
+
target.convert,
|
|
12650
|
+
target,
|
|
12651
|
+
[request, options],
|
|
12652
|
+
{}
|
|
12653
|
+
);
|
|
12654
|
+
return Reflect.get(target, prop, receiver);
|
|
12655
|
+
}
|
|
12656
|
+
});
|
|
12657
|
+
const proxy = new Proxy(sdk, {
|
|
12658
|
+
get(target, prop, receiver) {
|
|
12659
|
+
if (prop === "textToSpeech") return speech;
|
|
12660
|
+
if (prop === "speechToText") return transcription;
|
|
12661
|
+
return Reflect.get(target, prop, receiver);
|
|
12662
|
+
}
|
|
12663
|
+
});
|
|
12664
|
+
clients.set(client, proxy);
|
|
12665
|
+
clients.set(proxy, proxy);
|
|
12666
|
+
return proxy;
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12537
12669
|
// src/node/index.ts
|
|
12538
|
-
|
|
12670
|
+
_chunkBTRLPQG5js.configureNode.call(void 0, );
|
|
12671
|
+
|
|
12672
|
+
|
|
12539
12673
|
|
|
12540
12674
|
|
|
12541
12675
|
|
|
@@ -12721,4 +12855,4 @@ _chunkV32LW47Zjs.configureNode.call(void 0, );
|
|
|
12721
12855
|
|
|
12722
12856
|
|
|
12723
12857
|
|
|
12724
|
-
exports.Attachment = _chunkV32LW47Zjs.Attachment; exports.AttachmentReference = _chunkV32LW47Zjs.AttachmentReference; exports.BAGGAGE_HEADER = _chunkV32LW47Zjs.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkV32LW47Zjs.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkV32LW47Zjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkV32LW47Zjs.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkV32LW47Zjs.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BatchScorer = BatchScorer; exports.BatchTask = BatchTask; exports.BraintrustLangChainCallbackHandler = _chunkV32LW47Zjs.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkV32LW47Zjs.BraintrustObservabilityExporter; exports.BraintrustState = _chunkV32LW47Zjs.BraintrustState; exports.BraintrustStream = _chunkV32LW47Zjs.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkV32LW47Zjs.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkV32LW47Zjs.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkV32LW47Zjs.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkV32LW47Zjs.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.DurableEvalMemoryStore = DurableEvalMemoryStore; exports.DurableEvalRedisStore = DurableEvalRedisStore; exports.ERR_PERMALINK = _chunkV32LW47Zjs.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkV32LW47Zjs.Experiment; exports.ExternalAttachment = _chunkV32LW47Zjs.ExternalAttachment; exports.FailedHTTPResponse = _chunkV32LW47Zjs.FailedHTTPResponse; exports.IDGenerator = _chunkV32LW47Zjs.IDGenerator; exports.JSONAttachment = _chunkV32LW47Zjs.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkV32LW47Zjs.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkV32LW47Zjs.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkV32LW47Zjs.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkV32LW47Zjs.Logger; exports.LoginInvalidOrgError = _chunkV32LW47Zjs.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkV32LW47Zjs.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkV32LW47Zjs.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkV32LW47Zjs.NoopSpan; exports.OTELIDGenerator = _chunkV32LW47Zjs.OTELIDGenerator; exports.ObjectFetcher = _chunkV32LW47Zjs.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkV32LW47Zjs.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkV32LW47Zjs.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkV32LW47Zjs.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkV32LW47Zjs.SpanImpl; exports.TRACEPARENT_HEADER = _chunkV32LW47Zjs.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkV32LW47Zjs.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkV32LW47Zjs.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkV32LW47Zjs.UUIDGenerator; exports.X_CACHED_HEADER = _chunkV32LW47Zjs.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkV32LW47Zjs._exportsForTestingOnly; exports._internalGetGlobalState = _chunkV32LW47Zjs._internalGetGlobalState; exports._internalIso = _chunk4AQGZS6Xjs.isomorph_default; exports._internalSetInitialState = _chunkV32LW47Zjs._internalSetInitialState; exports.addAzureBlobHeaders = _chunkV32LW47Zjs.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkV32LW47Zjs.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkV32LW47Zjs.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkV32LW47Zjs.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkV32LW47Zjs.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.collectAnthropicSession = _chunkV32LW47Zjs.collectAnthropicSession; exports.completeOpenAIBatchTrace = completeOpenAIBatchTrace; exports.configureInstrumentation = _chunkV32LW47Zjs.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkV32LW47Zjs.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkV32LW47Zjs.createFinalValuePassThroughStream; exports.currentExperiment = _chunkV32LW47Zjs.currentExperiment; exports.currentLogger = _chunkV32LW47Zjs.currentLogger; exports.currentSpan = _chunkV32LW47Zjs.currentSpan; exports.deepCopyEvent = _chunkV32LW47Zjs.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.defineDurableEval = defineDurableEval; exports.deserializePlainStringAsJSON = _chunkV32LW47Zjs.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkV32LW47Zjs.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkV32LW47Zjs.extractTraceContextFromHeaders; exports.flush = _chunkV32LW47Zjs.flush; exports.getContextManager = _chunkV32LW47Zjs.getContextManager; exports.getIdGenerator = _chunkV32LW47Zjs.getIdGenerator; exports.getPromptVersions = _chunkV32LW47Zjs.getPromptVersions; exports.getSpanParentObject = _chunkV32LW47Zjs.getSpanParentObject; exports.getTemplateRenderer = _chunkV32LW47Zjs.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkV32LW47Zjs.init; exports.initDataset = _chunkV32LW47Zjs.initDataset; exports.initExperiment = _chunkV32LW47Zjs.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkV32LW47Zjs.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkV32LW47Zjs.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkV32LW47Zjs.isTemplateFormat; exports.loadParameters = _chunkV32LW47Zjs.loadParameters; exports.loadPrompt = _chunkV32LW47Zjs.loadPrompt; exports.log = _chunkV32LW47Zjs.log; exports.logError = _chunkV32LW47Zjs.logError; exports.login = _chunkV32LW47Zjs.login; exports.loginToState = _chunkV32LW47Zjs.loginToState; exports.logs3OverflowUploadSchema = _chunkV32LW47Zjs.logs3OverflowUploadSchema; exports.newId = _chunkV32LW47Zjs.newId; exports.openaiBatchesRetrieveTraced = openaiBatchesRetrieveTraced; exports.openaiFilesCreateTraced = openaiFilesCreateTraced; exports.parseCachedHeader = _chunkV32LW47Zjs.parseCachedHeader; exports.parseTemplateFormat = _chunkV32LW47Zjs.parseTemplateFormat; exports.permalink = _chunkV32LW47Zjs.permalink; exports.pickLogs3OverflowObjectIds = _chunkV32LW47Zjs.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkV32LW47Zjs.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkV32LW47Zjs.registerTemplatePlugin; exports.renderMessage = _chunkV32LW47Zjs.renderMessage; exports.renderPromptParams = _chunkV32LW47Zjs.renderPromptParams; exports.renderTemplateContent = _chunkV32LW47Zjs.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkV32LW47Zjs.setFetch; exports.setMaskingFunction = _chunkV32LW47Zjs.setMaskingFunction; exports.spanComponentsToObjectId = _chunkV32LW47Zjs.spanComponentsToObjectId; exports.startSpan = _chunkV32LW47Zjs.startSpan; exports.summarize = _chunkV32LW47Zjs.summarize; exports.templateRegistry = _chunkV32LW47Zjs.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkV32LW47Zjs.ToolFunctionDefinition; exports.traceable = _chunkV32LW47Zjs.traceable; exports.traced = _chunkV32LW47Zjs.traced; exports.updateSpan = _chunkV32LW47Zjs.updateSpan; exports.uploadLogs3OverflowPayload = _chunkV32LW47Zjs.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkV32LW47Zjs.utf8ByteLength; exports.withCurrent = _chunkV32LW47Zjs.withCurrent; exports.withDataset = _chunkV32LW47Zjs.withDataset; exports.withExperiment = _chunkV32LW47Zjs.withExperiment; exports.withLogger = _chunkV32LW47Zjs.withLogger; exports.withParent = _chunkV32LW47Zjs.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCloudflareAIChat = wrapCloudflareAIChat; exports.wrapCloudflareAgent = wrapCloudflareAgent; exports.wrapCloudflareThink = wrapCloudflareThink; 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.wrapHuggingFaceTransformers = wrapHuggingFaceTransformers; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkV32LW47Zjs.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOllama = wrapOllama; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkV32LW47Zjs.wrapTraced; exports.wrapVitest = wrapVitest; exports.wrapVoyageAI = wrapVoyageAI;
|
|
12858
|
+
exports.Attachment = _chunkBTRLPQG5js.Attachment; exports.AttachmentReference = _chunkBTRLPQG5js.AttachmentReference; exports.BAGGAGE_HEADER = _chunkBTRLPQG5js.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkBTRLPQG5js.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkBTRLPQG5js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkBTRLPQG5js.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkBTRLPQG5js.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BatchScorer = BatchScorer; exports.BatchTask = BatchTask; exports.BraintrustLangChainCallbackHandler = _chunkBTRLPQG5js.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkBTRLPQG5js.BraintrustObservabilityExporter; exports.BraintrustState = _chunkBTRLPQG5js.BraintrustState; exports.BraintrustStream = _chunkBTRLPQG5js.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkBTRLPQG5js.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkBTRLPQG5js.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkBTRLPQG5js.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkBTRLPQG5js.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.DurableEvalMemoryStore = DurableEvalMemoryStore; exports.DurableEvalRedisStore = DurableEvalRedisStore; exports.ERR_PERMALINK = _chunkBTRLPQG5js.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkBTRLPQG5js.Experiment; exports.ExternalAttachment = _chunkBTRLPQG5js.ExternalAttachment; exports.FailedHTTPResponse = _chunkBTRLPQG5js.FailedHTTPResponse; exports.IDGenerator = _chunkBTRLPQG5js.IDGenerator; exports.JSONAttachment = _chunkBTRLPQG5js.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkBTRLPQG5js.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkBTRLPQG5js.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkBTRLPQG5js.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkBTRLPQG5js.Logger; exports.LoginInvalidOrgError = _chunkBTRLPQG5js.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkBTRLPQG5js.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkBTRLPQG5js.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkBTRLPQG5js.NoopSpan; exports.OTELIDGenerator = _chunkBTRLPQG5js.OTELIDGenerator; exports.ObjectFetcher = _chunkBTRLPQG5js.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkBTRLPQG5js.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkBTRLPQG5js.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkBTRLPQG5js.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkBTRLPQG5js.SpanImpl; exports.TRACEPARENT_HEADER = _chunkBTRLPQG5js.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkBTRLPQG5js.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkBTRLPQG5js.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkBTRLPQG5js.UUIDGenerator; exports.X_CACHED_HEADER = _chunkBTRLPQG5js.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkBTRLPQG5js._exportsForTestingOnly; exports._internalGetGlobalState = _chunkBTRLPQG5js._internalGetGlobalState; exports._internalIso = _chunkAW4QECG5js.isomorph_default; exports._internalSetInitialState = _chunkBTRLPQG5js._internalSetInitialState; exports.addAzureBlobHeaders = _chunkBTRLPQG5js.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkBTRLPQG5js.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkBTRLPQG5js.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkBTRLPQG5js.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkBTRLPQG5js.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.collectAnthropicSession = _chunkBTRLPQG5js.collectAnthropicSession; exports.completeOpenAIBatchTrace = completeOpenAIBatchTrace; exports.configureInstrumentation = _chunkBTRLPQG5js.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkBTRLPQG5js.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkBTRLPQG5js.createFinalValuePassThroughStream; exports.currentExperiment = _chunkBTRLPQG5js.currentExperiment; exports.currentLogger = _chunkBTRLPQG5js.currentLogger; exports.currentSpan = _chunkBTRLPQG5js.currentSpan; exports.deepCopyEvent = _chunkBTRLPQG5js.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.defineDurableEval = defineDurableEval; exports.deserializePlainStringAsJSON = _chunkBTRLPQG5js.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkBTRLPQG5js.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkBTRLPQG5js.extractTraceContextFromHeaders; exports.flush = _chunkBTRLPQG5js.flush; exports.getContextManager = _chunkBTRLPQG5js.getContextManager; exports.getIdGenerator = _chunkBTRLPQG5js.getIdGenerator; exports.getPromptVersions = _chunkBTRLPQG5js.getPromptVersions; exports.getSpanParentObject = _chunkBTRLPQG5js.getSpanParentObject; exports.getTemplateRenderer = _chunkBTRLPQG5js.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkBTRLPQG5js.init; exports.initDataset = _chunkBTRLPQG5js.initDataset; exports.initExperiment = _chunkBTRLPQG5js.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkBTRLPQG5js.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkBTRLPQG5js.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkBTRLPQG5js.isTemplateFormat; exports.loadParameters = _chunkBTRLPQG5js.loadParameters; exports.loadPrompt = _chunkBTRLPQG5js.loadPrompt; exports.log = _chunkBTRLPQG5js.log; exports.logError = _chunkBTRLPQG5js.logError; exports.login = _chunkBTRLPQG5js.login; exports.loginToState = _chunkBTRLPQG5js.loginToState; exports.logs3OverflowUploadSchema = _chunkBTRLPQG5js.logs3OverflowUploadSchema; exports.newId = _chunkBTRLPQG5js.newId; exports.openaiBatchesRetrieveTraced = openaiBatchesRetrieveTraced; exports.openaiFilesCreateTraced = openaiFilesCreateTraced; exports.parseCachedHeader = _chunkBTRLPQG5js.parseCachedHeader; exports.parseTemplateFormat = _chunkBTRLPQG5js.parseTemplateFormat; exports.permalink = _chunkBTRLPQG5js.permalink; exports.pickLogs3OverflowObjectIds = _chunkBTRLPQG5js.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkBTRLPQG5js.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkBTRLPQG5js.registerTemplatePlugin; exports.renderMessage = _chunkBTRLPQG5js.renderMessage; exports.renderPromptParams = _chunkBTRLPQG5js.renderPromptParams; exports.renderTemplateContent = _chunkBTRLPQG5js.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkBTRLPQG5js.setFetch; exports.setMaskingFunction = _chunkBTRLPQG5js.setMaskingFunction; exports.spanComponentsToObjectId = _chunkBTRLPQG5js.spanComponentsToObjectId; exports.startSpan = _chunkBTRLPQG5js.startSpan; exports.summarize = _chunkBTRLPQG5js.summarize; exports.templateRegistry = _chunkBTRLPQG5js.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkBTRLPQG5js.ToolFunctionDefinition; exports.traceable = _chunkBTRLPQG5js.traceable; exports.traced = _chunkBTRLPQG5js.traced; exports.updateSpan = _chunkBTRLPQG5js.updateSpan; exports.uploadLogs3OverflowPayload = _chunkBTRLPQG5js.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkBTRLPQG5js.utf8ByteLength; exports.withCurrent = _chunkBTRLPQG5js.withCurrent; exports.withDataset = _chunkBTRLPQG5js.withDataset; exports.withExperiment = _chunkBTRLPQG5js.withExperiment; exports.withLogger = _chunkBTRLPQG5js.withLogger; exports.withParent = _chunkBTRLPQG5js.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCloudflareAIChat = wrapCloudflareAIChat; exports.wrapCloudflareAgent = wrapCloudflareAgent; exports.wrapCloudflareThink = wrapCloudflareThink; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapElevenLabs = wrapElevenLabs; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGoogleGenerativeAI = wrapGoogleGenerativeAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapHuggingFaceTransformers = wrapHuggingFaceTransformers; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkBTRLPQG5js.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOllama = wrapOllama; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkBTRLPQG5js.wrapTraced; exports.wrapVitest = wrapVitest; exports.wrapVoyageAI = wrapVoyageAI;
|