braintrust 3.25.0 → 3.27.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/NOTICE +6 -0
- package/dev/dist/index.d.mts +130 -2
- package/dev/dist/index.d.ts +130 -2
- package/dev/dist/index.js +4133 -1421
- package/dev/dist/index.mjs +3242 -530
- package/dist/apply-auto-instrumentation.js +526 -426
- package/dist/apply-auto-instrumentation.mjs +329 -229
- package/dist/auto-instrumentations/bundler/esbuild.cjs +1198 -364
- package/dist/auto-instrumentations/bundler/esbuild.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/esbuild.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/esbuild.mjs +6 -8
- package/dist/auto-instrumentations/bundler/next.cjs +1227 -413
- package/dist/auto-instrumentations/bundler/next.mjs +7 -29
- package/dist/auto-instrumentations/bundler/rollup.cjs +1198 -364
- package/dist/auto-instrumentations/bundler/rollup.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/rollup.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/rollup.mjs +6 -8
- package/dist/auto-instrumentations/bundler/vite.cjs +1249 -387
- package/dist/auto-instrumentations/bundler/vite.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/vite.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/vite.mjs +34 -8
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1368 -324
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +20 -12
- package/dist/auto-instrumentations/bundler/webpack.cjs +1198 -364
- package/dist/auto-instrumentations/bundler/webpack.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/webpack.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/webpack.mjs +6 -4
- package/dist/auto-instrumentations/chunk-2AMDGD65.mjs +1396 -0
- package/dist/auto-instrumentations/{chunk-7P6563SW.mjs → chunk-BW33ULMW.mjs} +2 -6
- package/dist/auto-instrumentations/{chunk-M6DLIJ2Z.mjs → chunk-I55G56ZL.mjs} +114 -221
- package/dist/auto-instrumentations/chunk-JPUFNW7X.mjs +649 -0
- package/dist/auto-instrumentations/{chunk-JPVCUKTY.mjs → chunk-XEYKUBLY.mjs} +191 -73
- package/dist/auto-instrumentations/{chunk-CZ24KNHT.mjs → chunk-ZNHTSSGI.mjs} +231 -69
- package/dist/auto-instrumentations/hook.mjs +406 -183
- package/dist/auto-instrumentations/index.cjs +853 -49
- package/dist/auto-instrumentations/index.d.mts +10 -2
- package/dist/auto-instrumentations/index.d.ts +10 -2
- package/dist/auto-instrumentations/index.mjs +10 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +566 -221
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +2 -2
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +2 -2
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +3 -2
- package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
- package/dist/auto-instrumentations/plugin-B-aZh7EP.d.ts +30 -0
- package/dist/auto-instrumentations/plugin-Bnj4E_6B.d.mts +30 -0
- package/dist/auto-instrumentations/{types-RNPaKi9o.d.mts → types-C1fVeiCp.d.mts} +1 -1
- package/dist/auto-instrumentations/{types-RNPaKi9o.d.ts → types-C1fVeiCp.d.ts} +1 -1
- package/dist/browser.d.mts +871 -199
- package/dist/browser.d.ts +871 -199
- package/dist/browser.js +3737 -549
- package/dist/browser.mjs +3737 -549
- package/dist/{chunk-ABR2QWDP.mjs → chunk-CZM5JIQL.mjs} +788 -132
- package/dist/{chunk-P25IOOU4.js → chunk-MF7NU6BT.js} +795 -139
- package/dist/{chunk-GSIDVFE6.js → chunk-QRHGVBKU.js} +3580 -1463
- package/dist/{chunk-2SANLSWX.mjs → chunk-YKD22IMR.mjs} +2505 -388
- package/dist/cli.js +3244 -533
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +3737 -552
- package/dist/edge-light.mjs +3737 -552
- package/dist/index.d.mts +871 -199
- package/dist/index.d.ts +871 -199
- package/dist/index.js +893 -446
- package/dist/index.mjs +463 -16
- package/dist/instrumentation/index.d.mts +138 -6
- package/dist/instrumentation/index.d.ts +138 -6
- package/dist/instrumentation/index.js +3362 -559
- package/dist/instrumentation/index.mjs +3362 -559
- package/dist/vitest-evals-reporter.js +45 -43
- package/dist/vitest-evals-reporter.mjs +5 -3
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +3737 -552
- package/dist/workerd.mjs +3737 -552
- package/licenses/node-diagnostics-channel/LICENSE +19 -0
- package/package.json +34 -35
- package/dist/auto-instrumentations/chunk-VT6DDNKM.mjs +0 -856
- package/dist/auto-instrumentations/plugin-D0KHwSJv.d.mts +0 -44
- package/dist/auto-instrumentations/plugin-G6fgxk1b.d.ts +0 -44
package/dist/index.js
CHANGED
|
@@ -139,9 +139,9 @@
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
var _chunkGSIDVFE6js = require('./chunk-GSIDVFE6.js');
|
|
143
142
|
|
|
144
143
|
|
|
144
|
+
var _chunkQRHGVBKUjs = require('./chunk-QRHGVBKU.js');
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
|
|
@@ -166,157 +166,168 @@ var _chunkGSIDVFE6js = require('./chunk-GSIDVFE6.js');
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
var _chunkMF7NU6BTjs = require('./chunk-MF7NU6BT.js');
|
|
170
177
|
|
|
171
178
|
// src/exports.ts
|
|
172
179
|
var exports_exports = {};
|
|
173
|
-
|
|
174
|
-
Attachment: () =>
|
|
175
|
-
AttachmentReference: () =>
|
|
176
|
-
BAGGAGE_HEADER: () =>
|
|
177
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
178
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
179
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
180
|
-
BaseAttachment: () =>
|
|
180
|
+
_chunkMF7NU6BTjs.__export.call(void 0, exports_exports, {
|
|
181
|
+
Attachment: () => _chunkQRHGVBKUjs.Attachment,
|
|
182
|
+
AttachmentReference: () => _chunkQRHGVBKUjs.AttachmentReference,
|
|
183
|
+
BAGGAGE_HEADER: () => _chunkQRHGVBKUjs.BAGGAGE_HEADER,
|
|
184
|
+
BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkQRHGVBKUjs.BRAINTRUST_CURRENT_SPAN_STORE,
|
|
185
|
+
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkQRHGVBKUjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
|
|
186
|
+
BRAINTRUST_PARENT_KEY: () => _chunkQRHGVBKUjs.BRAINTRUST_PARENT_KEY,
|
|
187
|
+
BaseAttachment: () => _chunkQRHGVBKUjs.BaseAttachment,
|
|
181
188
|
BaseExperiment: () => BaseExperiment,
|
|
182
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
189
|
+
BraintrustLangChainCallbackHandler: () => _chunkQRHGVBKUjs.BraintrustLangChainCallbackHandler,
|
|
183
190
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
184
|
-
BraintrustObservabilityExporter: () =>
|
|
185
|
-
BraintrustState: () =>
|
|
186
|
-
BraintrustStream: () =>
|
|
191
|
+
BraintrustObservabilityExporter: () => _chunkQRHGVBKUjs.BraintrustObservabilityExporter,
|
|
192
|
+
BraintrustState: () => _chunkQRHGVBKUjs.BraintrustState,
|
|
193
|
+
BraintrustStream: () => _chunkQRHGVBKUjs.BraintrustStream,
|
|
187
194
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
188
195
|
CodeFunction: () => CodeFunction,
|
|
189
196
|
CodePrompt: () => CodePrompt,
|
|
190
|
-
ContextManager: () =>
|
|
191
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
192
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
193
|
-
Dataset: () =>
|
|
197
|
+
ContextManager: () => _chunkQRHGVBKUjs.ContextManager,
|
|
198
|
+
DEFAULT_FETCH_BATCH_SIZE: () => _chunkQRHGVBKUjs.DEFAULT_FETCH_BATCH_SIZE,
|
|
199
|
+
DEFAULT_MAX_REQUEST_SIZE: () => _chunkQRHGVBKUjs.DEFAULT_MAX_REQUEST_SIZE,
|
|
200
|
+
Dataset: () => _chunkQRHGVBKUjs.Dataset,
|
|
194
201
|
DatasetPipeline: () => DatasetPipeline,
|
|
195
|
-
ERR_PERMALINK: () =>
|
|
202
|
+
ERR_PERMALINK: () => _chunkQRHGVBKUjs.ERR_PERMALINK,
|
|
196
203
|
Eval: () => Eval,
|
|
197
204
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
198
|
-
Experiment: () =>
|
|
199
|
-
ExternalAttachment: () =>
|
|
200
|
-
FailedHTTPResponse: () =>
|
|
201
|
-
IDGenerator: () =>
|
|
202
|
-
JSONAttachment: () =>
|
|
203
|
-
LEGACY_CACHED_HEADER: () =>
|
|
204
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
205
|
-
LazyValue: () =>
|
|
205
|
+
Experiment: () => _chunkQRHGVBKUjs.Experiment,
|
|
206
|
+
ExternalAttachment: () => _chunkQRHGVBKUjs.ExternalAttachment,
|
|
207
|
+
FailedHTTPResponse: () => _chunkQRHGVBKUjs.FailedHTTPResponse,
|
|
208
|
+
IDGenerator: () => _chunkQRHGVBKUjs.IDGenerator,
|
|
209
|
+
JSONAttachment: () => _chunkQRHGVBKUjs.JSONAttachment,
|
|
210
|
+
LEGACY_CACHED_HEADER: () => _chunkQRHGVBKUjs.LEGACY_CACHED_HEADER,
|
|
211
|
+
LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkQRHGVBKUjs.LOGS3_OVERFLOW_REFERENCE_TYPE,
|
|
212
|
+
LazyValue: () => _chunkQRHGVBKUjs.LazyValue,
|
|
206
213
|
LocalTrace: () => LocalTrace,
|
|
207
|
-
Logger: () =>
|
|
208
|
-
LoginInvalidOrgError: () =>
|
|
209
|
-
NOOP_SPAN: () =>
|
|
210
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
211
|
-
NoopSpan: () =>
|
|
212
|
-
OTELIDGenerator: () =>
|
|
213
|
-
ObjectFetcher: () =>
|
|
214
|
+
Logger: () => _chunkQRHGVBKUjs.Logger,
|
|
215
|
+
LoginInvalidOrgError: () => _chunkQRHGVBKUjs.LoginInvalidOrgError,
|
|
216
|
+
NOOP_SPAN: () => _chunkQRHGVBKUjs.NOOP_SPAN,
|
|
217
|
+
NOOP_SPAN_PERMALINK: () => _chunkQRHGVBKUjs.NOOP_SPAN_PERMALINK,
|
|
218
|
+
NoopSpan: () => _chunkQRHGVBKUjs.NoopSpan,
|
|
219
|
+
OTELIDGenerator: () => _chunkQRHGVBKUjs.OTELIDGenerator,
|
|
220
|
+
ObjectFetcher: () => _chunkQRHGVBKUjs.ObjectFetcher,
|
|
214
221
|
Project: () => Project2,
|
|
215
222
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
216
|
-
Prompt: () =>
|
|
223
|
+
Prompt: () => _chunkQRHGVBKUjs.Prompt,
|
|
217
224
|
PromptBuilder: () => PromptBuilder,
|
|
218
|
-
ReadonlyAttachment: () =>
|
|
219
|
-
ReadonlyExperiment: () =>
|
|
225
|
+
ReadonlyAttachment: () => _chunkQRHGVBKUjs.ReadonlyAttachment,
|
|
226
|
+
ReadonlyExperiment: () => _chunkQRHGVBKUjs.ReadonlyExperiment,
|
|
220
227
|
Reporter: () => Reporter,
|
|
221
228
|
ScorerBuilder: () => ScorerBuilder,
|
|
222
229
|
SpanFetcher: () => SpanFetcher,
|
|
223
|
-
SpanImpl: () =>
|
|
224
|
-
TRACEPARENT_HEADER: () =>
|
|
225
|
-
TRACESTATE_HEADER: () =>
|
|
226
|
-
TestBackgroundLogger: () =>
|
|
230
|
+
SpanImpl: () => _chunkQRHGVBKUjs.SpanImpl,
|
|
231
|
+
TRACEPARENT_HEADER: () => _chunkQRHGVBKUjs.TRACEPARENT_HEADER,
|
|
232
|
+
TRACESTATE_HEADER: () => _chunkQRHGVBKUjs.TRACESTATE_HEADER,
|
|
233
|
+
TestBackgroundLogger: () => _chunkQRHGVBKUjs.TestBackgroundLogger,
|
|
227
234
|
ToolBuilder: () => ToolBuilder,
|
|
228
|
-
UUIDGenerator: () =>
|
|
229
|
-
X_CACHED_HEADER: () =>
|
|
230
|
-
_exportsForTestingOnly: () =>
|
|
231
|
-
_internalGetGlobalState: () =>
|
|
232
|
-
_internalIso: () =>
|
|
233
|
-
_internalSetInitialState: () =>
|
|
234
|
-
addAzureBlobHeaders: () =>
|
|
235
|
+
UUIDGenerator: () => _chunkQRHGVBKUjs.UUIDGenerator,
|
|
236
|
+
X_CACHED_HEADER: () => _chunkQRHGVBKUjs.X_CACHED_HEADER,
|
|
237
|
+
_exportsForTestingOnly: () => _chunkQRHGVBKUjs._exportsForTestingOnly,
|
|
238
|
+
_internalGetGlobalState: () => _chunkQRHGVBKUjs._internalGetGlobalState,
|
|
239
|
+
_internalIso: () => _chunkMF7NU6BTjs.isomorph_default,
|
|
240
|
+
_internalSetInitialState: () => _chunkQRHGVBKUjs._internalSetInitialState,
|
|
241
|
+
addAzureBlobHeaders: () => _chunkQRHGVBKUjs.addAzureBlobHeaders,
|
|
235
242
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
236
|
-
braintrustAISDKTelemetry: () =>
|
|
243
|
+
braintrustAISDKTelemetry: () => _chunkQRHGVBKUjs.braintrustAISDKTelemetry,
|
|
237
244
|
braintrustEveHook: () => braintrustEveHook,
|
|
238
245
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
239
|
-
braintrustFlueInstrumentation: () =>
|
|
240
|
-
braintrustFlueObserver: () =>
|
|
241
|
-
braintrustStreamChunkSchema: () =>
|
|
246
|
+
braintrustFlueInstrumentation: () => _chunkQRHGVBKUjs.braintrustFlueInstrumentation,
|
|
247
|
+
braintrustFlueObserver: () => _chunkQRHGVBKUjs.braintrustFlueObserver,
|
|
248
|
+
braintrustStreamChunkSchema: () => _chunkQRHGVBKUjs.braintrustStreamChunkSchema,
|
|
242
249
|
buildLocalSummary: () => buildLocalSummary,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
collectAnthropicSession: () => _chunkQRHGVBKUjs.collectAnthropicSession,
|
|
251
|
+
configureInstrumentation: () => _chunkQRHGVBKUjs.configureInstrumentation,
|
|
252
|
+
constructLogs3OverflowRequest: () => _chunkQRHGVBKUjs.constructLogs3OverflowRequest,
|
|
253
|
+
createFinalValuePassThroughStream: () => _chunkQRHGVBKUjs.createFinalValuePassThroughStream,
|
|
254
|
+
currentExperiment: () => _chunkQRHGVBKUjs.currentExperiment,
|
|
255
|
+
currentLogger: () => _chunkQRHGVBKUjs.currentLogger,
|
|
256
|
+
currentSpan: () => _chunkQRHGVBKUjs.currentSpan,
|
|
257
|
+
deepCopyEvent: () => _chunkQRHGVBKUjs.deepCopyEvent,
|
|
250
258
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
251
|
-
deserializePlainStringAsJSON: () =>
|
|
252
|
-
devNullWritableStream: () =>
|
|
259
|
+
deserializePlainStringAsJSON: () => _chunkQRHGVBKUjs.deserializePlainStringAsJSON,
|
|
260
|
+
devNullWritableStream: () => _chunkQRHGVBKUjs.devNullWritableStream,
|
|
253
261
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
254
262
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
255
|
-
extractTraceContextFromHeaders: () =>
|
|
256
|
-
flush: () =>
|
|
257
|
-
getContextManager: () =>
|
|
258
|
-
getIdGenerator: () =>
|
|
259
|
-
getPromptVersions: () =>
|
|
260
|
-
getSpanParentObject: () =>
|
|
261
|
-
getTemplateRenderer: () =>
|
|
263
|
+
extractTraceContextFromHeaders: () => _chunkQRHGVBKUjs.extractTraceContextFromHeaders,
|
|
264
|
+
flush: () => _chunkQRHGVBKUjs.flush,
|
|
265
|
+
getContextManager: () => _chunkQRHGVBKUjs.getContextManager,
|
|
266
|
+
getIdGenerator: () => _chunkQRHGVBKUjs.getIdGenerator,
|
|
267
|
+
getPromptVersions: () => _chunkQRHGVBKUjs.getPromptVersions,
|
|
268
|
+
getSpanParentObject: () => _chunkQRHGVBKUjs.getSpanParentObject,
|
|
269
|
+
getTemplateRenderer: () => _chunkQRHGVBKUjs.getTemplateRenderer,
|
|
262
270
|
graph: () => graph_framework_exports,
|
|
263
|
-
init: () =>
|
|
264
|
-
initDataset: () =>
|
|
265
|
-
initExperiment: () =>
|
|
271
|
+
init: () => _chunkQRHGVBKUjs.init,
|
|
272
|
+
initDataset: () => _chunkQRHGVBKUjs.initDataset,
|
|
273
|
+
initExperiment: () => _chunkQRHGVBKUjs.initExperiment,
|
|
266
274
|
initFunction: () => initFunction,
|
|
267
|
-
initLogger: () =>
|
|
275
|
+
initLogger: () => _chunkQRHGVBKUjs.initLogger,
|
|
268
276
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
269
|
-
injectTraceContext: () =>
|
|
277
|
+
injectTraceContext: () => _chunkQRHGVBKUjs.injectTraceContext,
|
|
270
278
|
invoke: () => invoke,
|
|
271
|
-
isTemplateFormat: () =>
|
|
272
|
-
loadParameters: () =>
|
|
273
|
-
loadPrompt: () =>
|
|
274
|
-
log: () =>
|
|
275
|
-
logError: () =>
|
|
276
|
-
login: () =>
|
|
277
|
-
loginToState: () =>
|
|
278
|
-
logs3OverflowUploadSchema: () =>
|
|
279
|
-
newId: () =>
|
|
280
|
-
parseCachedHeader: () =>
|
|
281
|
-
parseTemplateFormat: () =>
|
|
282
|
-
permalink: () =>
|
|
283
|
-
pickLogs3OverflowObjectIds: () =>
|
|
279
|
+
isTemplateFormat: () => _chunkQRHGVBKUjs.isTemplateFormat,
|
|
280
|
+
loadParameters: () => _chunkQRHGVBKUjs.loadParameters,
|
|
281
|
+
loadPrompt: () => _chunkQRHGVBKUjs.loadPrompt,
|
|
282
|
+
log: () => _chunkQRHGVBKUjs.log,
|
|
283
|
+
logError: () => _chunkQRHGVBKUjs.logError,
|
|
284
|
+
login: () => _chunkQRHGVBKUjs.login,
|
|
285
|
+
loginToState: () => _chunkQRHGVBKUjs.loginToState,
|
|
286
|
+
logs3OverflowUploadSchema: () => _chunkQRHGVBKUjs.logs3OverflowUploadSchema,
|
|
287
|
+
newId: () => _chunkQRHGVBKUjs.newId,
|
|
288
|
+
parseCachedHeader: () => _chunkQRHGVBKUjs.parseCachedHeader,
|
|
289
|
+
parseTemplateFormat: () => _chunkQRHGVBKUjs.parseTemplateFormat,
|
|
290
|
+
permalink: () => _chunkQRHGVBKUjs.permalink,
|
|
291
|
+
pickLogs3OverflowObjectIds: () => _chunkQRHGVBKUjs.pickLogs3OverflowObjectIds,
|
|
284
292
|
projects: () => projects,
|
|
285
293
|
promptContentsSchema: () => promptContentsSchema,
|
|
286
294
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
287
295
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
288
296
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
289
|
-
registerOtelFlush: () =>
|
|
297
|
+
registerOtelFlush: () => _chunkQRHGVBKUjs.registerOtelFlush,
|
|
290
298
|
registerSandbox: () => registerSandbox,
|
|
291
|
-
registerTemplatePlugin: () =>
|
|
292
|
-
renderMessage: () =>
|
|
293
|
-
renderPromptParams: () =>
|
|
294
|
-
renderTemplateContent: () =>
|
|
299
|
+
registerTemplatePlugin: () => _chunkQRHGVBKUjs.registerTemplatePlugin,
|
|
300
|
+
renderMessage: () => _chunkQRHGVBKUjs.renderMessage,
|
|
301
|
+
renderPromptParams: () => _chunkQRHGVBKUjs.renderPromptParams,
|
|
302
|
+
renderTemplateContent: () => _chunkQRHGVBKUjs.renderTemplateContent,
|
|
295
303
|
reportFailures: () => reportFailures,
|
|
296
304
|
runEvaluator: () => runEvaluator,
|
|
297
|
-
setFetch: () =>
|
|
298
|
-
setMaskingFunction: () =>
|
|
299
|
-
spanComponentsToObjectId: () =>
|
|
300
|
-
startSpan: () =>
|
|
301
|
-
summarize: () =>
|
|
302
|
-
templateRegistry: () =>
|
|
303
|
-
toolFunctionDefinitionSchema: () =>
|
|
304
|
-
traceable: () =>
|
|
305
|
-
traced: () =>
|
|
306
|
-
updateSpan: () =>
|
|
307
|
-
uploadLogs3OverflowPayload: () =>
|
|
308
|
-
utf8ByteLength: () =>
|
|
309
|
-
withCurrent: () =>
|
|
310
|
-
withDataset: () =>
|
|
311
|
-
withExperiment: () =>
|
|
312
|
-
withLogger: () =>
|
|
313
|
-
withParent: () =>
|
|
305
|
+
setFetch: () => _chunkQRHGVBKUjs.setFetch,
|
|
306
|
+
setMaskingFunction: () => _chunkQRHGVBKUjs.setMaskingFunction,
|
|
307
|
+
spanComponentsToObjectId: () => _chunkQRHGVBKUjs.spanComponentsToObjectId,
|
|
308
|
+
startSpan: () => _chunkQRHGVBKUjs.startSpan,
|
|
309
|
+
summarize: () => _chunkQRHGVBKUjs.summarize,
|
|
310
|
+
templateRegistry: () => _chunkQRHGVBKUjs.templateRegistry,
|
|
311
|
+
toolFunctionDefinitionSchema: () => _chunkQRHGVBKUjs.ToolFunctionDefinition,
|
|
312
|
+
traceable: () => _chunkQRHGVBKUjs.traceable,
|
|
313
|
+
traced: () => _chunkQRHGVBKUjs.traced,
|
|
314
|
+
updateSpan: () => _chunkQRHGVBKUjs.updateSpan,
|
|
315
|
+
uploadLogs3OverflowPayload: () => _chunkQRHGVBKUjs.uploadLogs3OverflowPayload,
|
|
316
|
+
utf8ByteLength: () => _chunkQRHGVBKUjs.utf8ByteLength,
|
|
317
|
+
withCurrent: () => _chunkQRHGVBKUjs.withCurrent,
|
|
318
|
+
withDataset: () => _chunkQRHGVBKUjs.withDataset,
|
|
319
|
+
withExperiment: () => _chunkQRHGVBKUjs.withExperiment,
|
|
320
|
+
withLogger: () => _chunkQRHGVBKUjs.withLogger,
|
|
321
|
+
withParent: () => _chunkQRHGVBKUjs.withParent,
|
|
314
322
|
wrapAISDK: () => wrapAISDK,
|
|
315
323
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
316
324
|
wrapAgentClass: () => wrapAgentClass,
|
|
317
325
|
wrapAnthropic: () => wrapAnthropic,
|
|
318
326
|
wrapBedrockRuntime: () => wrapBedrockRuntime,
|
|
319
327
|
wrapClaudeAgentSDK: () => wrapClaudeAgentSDK,
|
|
328
|
+
wrapCloudflareAIChat: () => wrapCloudflareAIChat,
|
|
329
|
+
wrapCloudflareAgent: () => wrapCloudflareAgent,
|
|
330
|
+
wrapCloudflareThink: () => wrapCloudflareThink,
|
|
320
331
|
wrapCohere: () => wrapCohere,
|
|
321
332
|
wrapCopilotClient: () => wrapCopilotClient,
|
|
322
333
|
wrapCursorSDK: () => wrapCursorSDK,
|
|
@@ -325,11 +336,13 @@ _chunkP25IOOU4js.__export.call(void 0, exports_exports, {
|
|
|
325
336
|
wrapGoogleGenAI: () => wrapGoogleGenAI,
|
|
326
337
|
wrapGroq: () => wrapGroq,
|
|
327
338
|
wrapHuggingFace: () => wrapHuggingFace,
|
|
339
|
+
wrapHuggingFaceTransformers: () => wrapHuggingFaceTransformers,
|
|
328
340
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
329
341
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
330
342
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
331
|
-
wrapMastraAgent: () =>
|
|
343
|
+
wrapMastraAgent: () => _chunkQRHGVBKUjs.wrapMastraAgent,
|
|
332
344
|
wrapMistral: () => wrapMistral,
|
|
345
|
+
wrapOllama: () => wrapOllama,
|
|
333
346
|
wrapOpenAI: () => wrapOpenAI,
|
|
334
347
|
wrapOpenAICodexSDK: () => wrapOpenAICodexSDK,
|
|
335
348
|
wrapOpenAIv4: () => wrapOpenAIv4,
|
|
@@ -337,7 +350,7 @@ _chunkP25IOOU4js.__export.call(void 0, exports_exports, {
|
|
|
337
350
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
338
351
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
339
352
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
340
|
-
wrapTraced: () =>
|
|
353
|
+
wrapTraced: () => _chunkQRHGVBKUjs.wrapTraced,
|
|
341
354
|
wrapVitest: () => wrapVitest
|
|
342
355
|
});
|
|
343
356
|
|
|
@@ -345,7 +358,7 @@ _chunkP25IOOU4js.__export.call(void 0, exports_exports, {
|
|
|
345
358
|
var _v3 = require('zod/v3');
|
|
346
359
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
347
360
|
async function registerSandbox(options) {
|
|
348
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
361
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
349
362
|
await state.login({
|
|
350
363
|
apiKey: options.apiKey,
|
|
351
364
|
appUrl: options.appUrl,
|
|
@@ -386,7 +399,7 @@ async function registerSandbox(options) {
|
|
|
386
399
|
evaluatorDefinitions
|
|
387
400
|
)) {
|
|
388
401
|
const functionName = evalName;
|
|
389
|
-
const functionSlug =
|
|
402
|
+
const functionSlug = _chunkQRHGVBKUjs.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
390
403
|
const functionDef = {
|
|
391
404
|
project_id: projectId,
|
|
392
405
|
org_name: state.orgName,
|
|
@@ -457,7 +470,7 @@ async function invoke(args) {
|
|
|
457
470
|
projectId,
|
|
458
471
|
...functionIdArgs
|
|
459
472
|
} = args;
|
|
460
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
473
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
461
474
|
await state.login({
|
|
462
475
|
orgName,
|
|
463
476
|
apiKey,
|
|
@@ -465,8 +478,8 @@ async function invoke(args) {
|
|
|
465
478
|
forceLogin,
|
|
466
479
|
fetch
|
|
467
480
|
});
|
|
468
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
469
|
-
const functionId =
|
|
481
|
+
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkQRHGVBKUjs.getSpanParentObject.call(void 0, ).export();
|
|
482
|
+
const functionId = _chunkQRHGVBKUjs.FunctionId.safeParse({
|
|
470
483
|
function_id: functionIdArgs.function_id,
|
|
471
484
|
project_name: functionIdArgs.projectName,
|
|
472
485
|
slug: functionIdArgs.slug,
|
|
@@ -509,7 +522,7 @@ async function invoke(args) {
|
|
|
509
522
|
if (!resp.body) {
|
|
510
523
|
throw new Error("Received empty stream body");
|
|
511
524
|
}
|
|
512
|
-
return new (0,
|
|
525
|
+
return new (0, _chunkQRHGVBKUjs.BraintrustStream)(resp.body);
|
|
513
526
|
} else {
|
|
514
527
|
const data = await resp.json();
|
|
515
528
|
return schema ? schema.parse(data) : data;
|
|
@@ -521,7 +534,7 @@ function initFunction({
|
|
|
521
534
|
version,
|
|
522
535
|
state
|
|
523
536
|
}) {
|
|
524
|
-
const s = _nullishCoalesce(state, () => (
|
|
537
|
+
const s = _nullishCoalesce(state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
525
538
|
_optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
|
|
526
539
|
const f = async (input) => {
|
|
527
540
|
return await invoke({
|
|
@@ -599,22 +612,22 @@ function responsesProxy(openai) {
|
|
|
599
612
|
if (name === "create" && typeof target.create === "function") {
|
|
600
613
|
return wrapResponsesAsync(
|
|
601
614
|
target.create.bind(target),
|
|
602
|
-
|
|
615
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesCreate
|
|
603
616
|
);
|
|
604
617
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
605
618
|
return wrapResponsesSyncStream(
|
|
606
619
|
target.stream.bind(target),
|
|
607
|
-
|
|
620
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesStream
|
|
608
621
|
);
|
|
609
622
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
610
623
|
return wrapResponsesAsync(
|
|
611
624
|
target.parse.bind(target),
|
|
612
|
-
|
|
625
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesParse
|
|
613
626
|
);
|
|
614
627
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
615
628
|
return wrapResponsesAsync(
|
|
616
629
|
target.compact.bind(target),
|
|
617
|
-
|
|
630
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesCompact
|
|
618
631
|
);
|
|
619
632
|
}
|
|
620
633
|
return Reflect.get(target, name, receiver);
|
|
@@ -758,7 +771,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
758
771
|
const { span_info, params } = splitSpanInfo(
|
|
759
772
|
allParams
|
|
760
773
|
);
|
|
761
|
-
return
|
|
774
|
+
return _chunkMF7NU6BTjs.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
762
775
|
async () => await completion(params),
|
|
763
776
|
{ arguments: [params], span_info }
|
|
764
777
|
);
|
|
@@ -769,7 +782,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
769
782
|
const { span_info, params } = splitSpanInfo(
|
|
770
783
|
allParams
|
|
771
784
|
);
|
|
772
|
-
return
|
|
785
|
+
return _chunkMF7NU6BTjs.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
773
786
|
() => completion(params),
|
|
774
787
|
{ arguments: [params], span_info }
|
|
775
788
|
);
|
|
@@ -785,7 +798,7 @@ function wrapChatCompletion(completion) {
|
|
|
785
798
|
if (!executionPromise) {
|
|
786
799
|
executionPromise = (async () => {
|
|
787
800
|
const traceContext = createChannelContext(
|
|
788
|
-
|
|
801
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
789
802
|
params,
|
|
790
803
|
span_info
|
|
791
804
|
);
|
|
@@ -795,7 +808,7 @@ function wrapChatCompletion(completion) {
|
|
|
795
808
|
options
|
|
796
809
|
);
|
|
797
810
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
798
|
-
|
|
811
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
799
812
|
traceContext,
|
|
800
813
|
completionPromise
|
|
801
814
|
);
|
|
@@ -806,7 +819,7 @@ function wrapChatCompletion(completion) {
|
|
|
806
819
|
options
|
|
807
820
|
);
|
|
808
821
|
const { data, response } = await tracePromiseWithResponse(
|
|
809
|
-
|
|
822
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
810
823
|
traceContext,
|
|
811
824
|
completionResponse
|
|
812
825
|
);
|
|
@@ -849,8 +862,8 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
849
862
|
return createLazyAPIPromise(ensureExecuted);
|
|
850
863
|
};
|
|
851
864
|
}
|
|
852
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
853
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
865
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkMF7NU6BTjs.openAIChannels.embeddingsCreate);
|
|
866
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkMF7NU6BTjs.openAIChannels.moderationsCreate);
|
|
854
867
|
|
|
855
868
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
856
869
|
function isModuleNamespace(obj) {
|
|
@@ -953,7 +966,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
953
966
|
return wrapHarnessAgentGenerate(
|
|
954
967
|
original,
|
|
955
968
|
harnessAgent,
|
|
956
|
-
|
|
969
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.generate,
|
|
957
970
|
"HarnessAgent.generate",
|
|
958
971
|
options
|
|
959
972
|
);
|
|
@@ -961,7 +974,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
961
974
|
return wrapHarnessAgentStream(
|
|
962
975
|
original,
|
|
963
976
|
harnessAgent,
|
|
964
|
-
|
|
977
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.stream,
|
|
965
978
|
"HarnessAgent.stream",
|
|
966
979
|
options
|
|
967
980
|
);
|
|
@@ -969,7 +982,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
969
982
|
return wrapHarnessAgentGenerate(
|
|
970
983
|
original,
|
|
971
984
|
harnessAgent,
|
|
972
|
-
|
|
985
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.continueGenerate,
|
|
973
986
|
"HarnessAgent.continueGenerate",
|
|
974
987
|
options
|
|
975
988
|
);
|
|
@@ -977,7 +990,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
977
990
|
return wrapHarnessAgentStream(
|
|
978
991
|
original,
|
|
979
992
|
harnessAgent,
|
|
980
|
-
|
|
993
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.continueStream,
|
|
981
994
|
"HarnessAgent.continueStream",
|
|
982
995
|
options
|
|
983
996
|
);
|
|
@@ -1000,7 +1013,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1000
1013
|
};
|
|
1001
1014
|
var wrapHarnessAgentCreateSession = (createSession, instance) => {
|
|
1002
1015
|
const wrapper = function(params) {
|
|
1003
|
-
return
|
|
1016
|
+
return _chunkMF7NU6BTjs.harnessAgentChannels.createSession.tracePromise(
|
|
1004
1017
|
() => params === void 0 ? createSession.call(instance) : createSession.call(instance, params),
|
|
1005
1018
|
createAISDKChannelContext(_nullishCoalesce(params, () => ( {})), { self: instance })
|
|
1006
1019
|
);
|
|
@@ -1046,15 +1059,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
1046
1059
|
};
|
|
1047
1060
|
function generateChannelForAgent(agentName) {
|
|
1048
1061
|
if (agentName === "ToolLoopAgent") {
|
|
1049
|
-
return
|
|
1062
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.toolLoopAgentGenerate;
|
|
1050
1063
|
}
|
|
1051
|
-
return
|
|
1064
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.agentGenerate;
|
|
1052
1065
|
}
|
|
1053
1066
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
1054
1067
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
1055
1068
|
return (params) => {
|
|
1056
1069
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
1057
|
-
if (workflowAgent &&
|
|
1070
|
+
if (workflowAgent && _chunkQRHGVBKUjs.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
1058
1071
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
1059
1072
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
1060
1073
|
}
|
|
@@ -1073,12 +1086,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
1073
1086
|
};
|
|
1074
1087
|
function streamChannelForAgent(agentName) {
|
|
1075
1088
|
if (agentName === "ToolLoopAgent") {
|
|
1076
|
-
return
|
|
1089
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.toolLoopAgentStream;
|
|
1077
1090
|
}
|
|
1078
1091
|
if (agentName === "WorkflowAgent") {
|
|
1079
|
-
return
|
|
1092
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.workflowAgentStream;
|
|
1080
1093
|
}
|
|
1081
|
-
return
|
|
1094
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.agentStream;
|
|
1082
1095
|
}
|
|
1083
1096
|
var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
|
|
1084
1097
|
const wrapper = async function(allParams) {
|
|
@@ -1102,7 +1115,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
1102
1115
|
};
|
|
1103
1116
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
1104
1117
|
return makeGenerateTextWrapper(
|
|
1105
|
-
|
|
1118
|
+
_chunkMF7NU6BTjs.aiSDKChannels.generateText,
|
|
1106
1119
|
"generateText",
|
|
1107
1120
|
generateText,
|
|
1108
1121
|
{ aiSDK },
|
|
@@ -1111,7 +1124,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
1111
1124
|
};
|
|
1112
1125
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
1113
1126
|
return makeGenerateTextWrapper(
|
|
1114
|
-
|
|
1127
|
+
_chunkMF7NU6BTjs.aiSDKChannels.generateObject,
|
|
1115
1128
|
"generateObject",
|
|
1116
1129
|
generateObject,
|
|
1117
1130
|
{ aiSDK },
|
|
@@ -1140,7 +1153,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
1140
1153
|
};
|
|
1141
1154
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
1142
1155
|
return makeEmbedWrapper(
|
|
1143
|
-
|
|
1156
|
+
_chunkMF7NU6BTjs.aiSDKChannels.embed,
|
|
1144
1157
|
"embed",
|
|
1145
1158
|
embed,
|
|
1146
1159
|
{ aiSDK },
|
|
@@ -1149,7 +1162,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
1149
1162
|
};
|
|
1150
1163
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
1151
1164
|
return makeEmbedWrapper(
|
|
1152
|
-
|
|
1165
|
+
_chunkMF7NU6BTjs.aiSDKChannels.embedMany,
|
|
1153
1166
|
"embedMany",
|
|
1154
1167
|
embedMany,
|
|
1155
1168
|
{ aiSDK },
|
|
@@ -1160,7 +1173,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
1160
1173
|
const wrapper = async function(allParams) {
|
|
1161
1174
|
const { span_info, ...params } = allParams;
|
|
1162
1175
|
const tracedParams = { ...params };
|
|
1163
|
-
return
|
|
1176
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.rerank.tracePromise(
|
|
1164
1177
|
() => rerank(tracedParams),
|
|
1165
1178
|
createAISDKChannelContext(tracedParams, {
|
|
1166
1179
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1199,7 +1212,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
1199
1212
|
};
|
|
1200
1213
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
1201
1214
|
return makeStreamWrapper(
|
|
1202
|
-
|
|
1215
|
+
_chunkMF7NU6BTjs.aiSDKChannels.streamText,
|
|
1203
1216
|
"streamText",
|
|
1204
1217
|
streamText,
|
|
1205
1218
|
{ aiSDK },
|
|
@@ -1208,7 +1221,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
1208
1221
|
};
|
|
1209
1222
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
1210
1223
|
return makeStreamWrapper(
|
|
1211
|
-
|
|
1224
|
+
_chunkMF7NU6BTjs.aiSDKChannels.streamObject,
|
|
1212
1225
|
"streamObject",
|
|
1213
1226
|
streamObject,
|
|
1214
1227
|
{ aiSDK },
|
|
@@ -1280,19 +1293,19 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1280
1293
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1281
1294
|
// propagate those via async local storage
|
|
1282
1295
|
async doGenerate(options) {
|
|
1283
|
-
const span =
|
|
1284
|
-
|
|
1296
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1297
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1285
1298
|
{
|
|
1286
1299
|
name: "Chat Completion",
|
|
1287
1300
|
spanAttributes: {
|
|
1288
1301
|
type: "llm"
|
|
1289
1302
|
}
|
|
1290
1303
|
},
|
|
1291
|
-
|
|
1304
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK
|
|
1292
1305
|
)
|
|
1293
1306
|
);
|
|
1294
1307
|
const { prompt, mode, ...rest } = options;
|
|
1295
|
-
const startTime =
|
|
1308
|
+
const startTime = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1296
1309
|
try {
|
|
1297
1310
|
const ret = await this.model.doGenerate(options);
|
|
1298
1311
|
span.log({
|
|
@@ -1304,12 +1317,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1304
1317
|
},
|
|
1305
1318
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1306
1319
|
metrics: {
|
|
1307
|
-
time_to_first_token:
|
|
1308
|
-
tokens: !
|
|
1320
|
+
time_to_first_token: _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, ) - startTime,
|
|
1321
|
+
tokens: !_chunkQRHGVBKUjs.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
1309
1322
|
prompt_tokens: _optionalChain([ret, 'access', _26 => _26.usage, 'optionalAccess', _27 => _27.promptTokens]),
|
|
1310
1323
|
completion_tokens: _optionalChain([ret, 'access', _28 => _28.usage, 'optionalAccess', _29 => _29.completionTokens]),
|
|
1311
|
-
cached:
|
|
1312
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _30 => _30.rawResponse, 'optionalAccess', _31 => _31.headers, 'optionalAccess', _32 => _32[
|
|
1324
|
+
cached: _chunkQRHGVBKUjs.parseCachedHeader.call(void 0,
|
|
1325
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _30 => _30.rawResponse, 'optionalAccess', _31 => _31.headers, 'optionalAccess', _32 => _32[_chunkQRHGVBKUjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _33 => _33.rawResponse, 'optionalAccess', _34 => _34.headers, 'optionalAccess', _35 => _35[_chunkQRHGVBKUjs.LEGACY_CACHED_HEADER]])))
|
|
1313
1326
|
)
|
|
1314
1327
|
}
|
|
1315
1328
|
});
|
|
@@ -1320,16 +1333,16 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1320
1333
|
}
|
|
1321
1334
|
async doStream(options) {
|
|
1322
1335
|
const { prompt, mode, ...rest } = options;
|
|
1323
|
-
const startTime =
|
|
1324
|
-
const span =
|
|
1325
|
-
|
|
1336
|
+
const startTime = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1337
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1338
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1326
1339
|
{
|
|
1327
1340
|
name: "Chat Completion",
|
|
1328
1341
|
spanAttributes: {
|
|
1329
1342
|
type: "llm"
|
|
1330
1343
|
}
|
|
1331
1344
|
},
|
|
1332
|
-
|
|
1345
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK
|
|
1333
1346
|
)
|
|
1334
1347
|
);
|
|
1335
1348
|
span.log({
|
|
@@ -1360,7 +1373,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1360
1373
|
new TransformStream({
|
|
1361
1374
|
transform(chunk, controller) {
|
|
1362
1375
|
if (time_to_first_token === void 0) {
|
|
1363
|
-
time_to_first_token =
|
|
1376
|
+
time_to_first_token = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1364
1377
|
span.log({ metrics: { time_to_first_token } });
|
|
1365
1378
|
}
|
|
1366
1379
|
switch (chunk.type) {
|
|
@@ -1405,11 +1418,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1405
1418
|
),
|
|
1406
1419
|
metrics: {
|
|
1407
1420
|
time_to_first_token,
|
|
1408
|
-
tokens: !
|
|
1421
|
+
tokens: !_chunkQRHGVBKUjs.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1409
1422
|
prompt_tokens: _optionalChain([usage, 'optionalAccess', _36 => _36.promptTokens]),
|
|
1410
1423
|
completion_tokens: _optionalChain([usage, 'optionalAccess', _37 => _37.completionTokens]),
|
|
1411
|
-
cached:
|
|
1412
|
-
_nullishCoalesce(_optionalChain([ret, 'access', _38 => _38.rawResponse, 'optionalAccess', _39 => _39.headers, 'optionalAccess', _40 => _40[
|
|
1424
|
+
cached: _chunkQRHGVBKUjs.parseCachedHeader.call(void 0,
|
|
1425
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _38 => _38.rawResponse, 'optionalAccess', _39 => _39.headers, 'optionalAccess', _40 => _40[_chunkQRHGVBKUjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _41 => _41.rawResponse, 'optionalAccess', _42 => _42.headers, 'optionalAccess', _43 => _43[_chunkQRHGVBKUjs.LEGACY_CACHED_HEADER]])))
|
|
1413
1426
|
)
|
|
1414
1427
|
}
|
|
1415
1428
|
});
|
|
@@ -1594,12 +1607,12 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1594
1607
|
anthropicMetadata.usage,
|
|
1595
1608
|
"cache_creation_input_tokens"
|
|
1596
1609
|
) || 0;
|
|
1597
|
-
const cacheTokens =
|
|
1610
|
+
const cacheTokens = _chunkQRHGVBKUjs.extractAnthropicCacheTokens.call(void 0,
|
|
1598
1611
|
cacheReadTokens,
|
|
1599
1612
|
cacheCreationTokens
|
|
1600
1613
|
);
|
|
1601
1614
|
Object.assign(metrics, cacheTokens);
|
|
1602
|
-
Object.assign(metrics,
|
|
1615
|
+
Object.assign(metrics, _chunkQRHGVBKUjs.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1603
1616
|
}
|
|
1604
1617
|
}
|
|
1605
1618
|
return metrics;
|
|
@@ -1671,7 +1684,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1671
1684
|
model: modelFromWrapGenerate
|
|
1672
1685
|
}) => {
|
|
1673
1686
|
const rawInput = extractInput(params);
|
|
1674
|
-
const processedInput =
|
|
1687
|
+
const processedInput = _chunkQRHGVBKUjs.processInputAttachments.call(void 0, rawInput);
|
|
1675
1688
|
const spanArgs = {
|
|
1676
1689
|
name: _optionalChain([config, 'access', _60 => _60.spanInfo, 'optionalAccess', _61 => _61.name]) || "ai-sdk.doGenerate",
|
|
1677
1690
|
spanAttributes: {
|
|
@@ -1686,8 +1699,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1686
1699
|
}
|
|
1687
1700
|
}
|
|
1688
1701
|
};
|
|
1689
|
-
const span =
|
|
1690
|
-
|
|
1702
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1703
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1691
1704
|
);
|
|
1692
1705
|
try {
|
|
1693
1706
|
const result = await doGenerate();
|
|
@@ -1735,7 +1748,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1735
1748
|
},
|
|
1736
1749
|
wrapStream: async ({ doStream, params }) => {
|
|
1737
1750
|
const rawInput = extractInput(params);
|
|
1738
|
-
const processedInput =
|
|
1751
|
+
const processedInput = _chunkQRHGVBKUjs.processInputAttachments.call(void 0, rawInput);
|
|
1739
1752
|
const spanArgs = {
|
|
1740
1753
|
name: _optionalChain([config, 'access', _69 => _69.spanInfo, 'optionalAccess', _70 => _70.name]) || "ai-sdk.doStream",
|
|
1741
1754
|
spanAttributes: {
|
|
@@ -1750,8 +1763,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1750
1763
|
}
|
|
1751
1764
|
}
|
|
1752
1765
|
};
|
|
1753
|
-
const span =
|
|
1754
|
-
|
|
1766
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1767
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1755
1768
|
);
|
|
1756
1769
|
try {
|
|
1757
1770
|
const { stream, ...rest } = await doStream();
|
|
@@ -1876,7 +1889,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1876
1889
|
try {
|
|
1877
1890
|
captureEveModelInput(state, input);
|
|
1878
1891
|
} catch (error) {
|
|
1879
|
-
|
|
1892
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
1880
1893
|
}
|
|
1881
1894
|
}
|
|
1882
1895
|
},
|
|
@@ -1886,7 +1899,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1886
1899
|
};
|
|
1887
1900
|
}
|
|
1888
1901
|
function isEveHandleMessageStreamEvent(event) {
|
|
1889
|
-
return
|
|
1902
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
1890
1903
|
}
|
|
1891
1904
|
var ResumedEveSpan = class {
|
|
1892
1905
|
constructor(reference) {
|
|
@@ -1907,7 +1920,7 @@ var ResumedEveSpan = class {
|
|
|
1907
1920
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
1908
1921
|
...event.metrics
|
|
1909
1922
|
};
|
|
1910
|
-
|
|
1923
|
+
_chunkQRHGVBKUjs.updateSpan.call(void 0, {
|
|
1911
1924
|
exported: this.reference.exported,
|
|
1912
1925
|
...this.reference.startEvent,
|
|
1913
1926
|
...event,
|
|
@@ -1916,7 +1929,7 @@ var ResumedEveSpan = class {
|
|
|
1916
1929
|
}
|
|
1917
1930
|
end(args) {
|
|
1918
1931
|
if (this.endTime === void 0) {
|
|
1919
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => (
|
|
1932
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => ( _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1920
1933
|
this.log({ metrics: { end: this.endTime } });
|
|
1921
1934
|
}
|
|
1922
1935
|
return this.endTime;
|
|
@@ -1928,13 +1941,13 @@ var EveBridge = (_class = class {
|
|
|
1928
1941
|
}
|
|
1929
1942
|
|
|
1930
1943
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
1931
|
-
__init2() {this.completedToolKeys = new (0,
|
|
1944
|
+
__init2() {this.completedToolKeys = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1932
1945
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1933
1946
|
})}
|
|
1934
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
1947
|
+
__init3() {this.toolsByCallKey = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1935
1948
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1936
1949
|
})}
|
|
1937
|
-
__init4() {this.turnsByKey = new (0,
|
|
1950
|
+
__init4() {this.turnsByKey = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1938
1951
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1939
1952
|
})}
|
|
1940
1953
|
async startEveSpan(args) {
|
|
@@ -1945,7 +1958,7 @@ var EveBridge = (_class = class {
|
|
|
1945
1958
|
if (reference) {
|
|
1946
1959
|
return new ResumedEveSpan(reference);
|
|
1947
1960
|
}
|
|
1948
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => (
|
|
1961
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => ( _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1949
1962
|
const parentSpanIds = _optionalChain([args, 'optionalAccess', _82 => _82.parentSpanIds]);
|
|
1950
1963
|
const startEvent = {
|
|
1951
1964
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1957,12 +1970,12 @@ var EveBridge = (_class = class {
|
|
|
1957
1970
|
},
|
|
1958
1971
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
1959
1972
|
};
|
|
1960
|
-
const span =
|
|
1961
|
-
|
|
1962
|
-
() =>
|
|
1963
|
-
|
|
1973
|
+
const span = _chunkQRHGVBKUjs.withCurrent.call(void 0,
|
|
1974
|
+
_chunkQRHGVBKUjs.NOOP_SPAN,
|
|
1975
|
+
() => _chunkQRHGVBKUjs._internalStartSpanWithInitialMerge.call(void 0,
|
|
1976
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1964
1977
|
{ ...args, startTime },
|
|
1965
|
-
|
|
1978
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.EVE
|
|
1966
1979
|
)
|
|
1967
1980
|
)
|
|
1968
1981
|
);
|
|
@@ -1990,7 +2003,7 @@ var EveBridge = (_class = class {
|
|
|
1990
2003
|
};
|
|
1991
2004
|
});
|
|
1992
2005
|
} catch (error) {
|
|
1993
|
-
|
|
2006
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
1994
2007
|
}
|
|
1995
2008
|
return span;
|
|
1996
2009
|
}
|
|
@@ -2077,7 +2090,7 @@ var EveBridge = (_class = class {
|
|
|
2077
2090
|
}
|
|
2078
2091
|
}
|
|
2079
2092
|
} catch (error) {
|
|
2080
|
-
|
|
2093
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
2081
2094
|
}
|
|
2082
2095
|
};
|
|
2083
2096
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -2305,7 +2318,7 @@ var EveBridge = (_class = class {
|
|
|
2305
2318
|
return;
|
|
2306
2319
|
}
|
|
2307
2320
|
const existingMessage = eveOutputMessage(step.output);
|
|
2308
|
-
const existingToolCalls =
|
|
2321
|
+
const existingToolCalls = _chunkQRHGVBKUjs.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2309
2322
|
step.output = mergeEveReasoning(
|
|
2310
2323
|
[
|
|
2311
2324
|
{
|
|
@@ -2369,11 +2382,11 @@ var EveBridge = (_class = class {
|
|
|
2369
2382
|
return;
|
|
2370
2383
|
}
|
|
2371
2384
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2372
|
-
if (Array.isArray(step.output) &&
|
|
2385
|
+
if (Array.isArray(step.output) && _chunkQRHGVBKUjs.isObject.call(void 0, step.output[0])) {
|
|
2373
2386
|
const message = step.output[0]["message"];
|
|
2374
|
-
if (
|
|
2387
|
+
if (_chunkQRHGVBKUjs.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2375
2388
|
for (const toolCall of message["tool_calls"]) {
|
|
2376
|
-
if (
|
|
2389
|
+
if (_chunkQRHGVBKUjs.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2377
2390
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2378
2391
|
}
|
|
2379
2392
|
}
|
|
@@ -2582,7 +2595,7 @@ var EveBridge = (_class = class {
|
|
|
2582
2595
|
};
|
|
2583
2596
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2584
2597
|
const sessionId = sessionIdFromContext(ctx);
|
|
2585
|
-
if (Array.isArray(step.output) &&
|
|
2598
|
+
if (Array.isArray(step.output) && _chunkQRHGVBKUjs.isObject.call(void 0, step.output[0])) {
|
|
2586
2599
|
const finishReason = step.output[0].finish_reason;
|
|
2587
2600
|
if (typeof finishReason !== "string") {
|
|
2588
2601
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -2920,10 +2933,10 @@ var EveBridge = (_class = class {
|
|
|
2920
2933
|
return state;
|
|
2921
2934
|
}
|
|
2922
2935
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
2923
|
-
const session =
|
|
2924
|
-
const parent =
|
|
2925
|
-
const parentTurn =
|
|
2926
|
-
const parentLineage =
|
|
2936
|
+
const session = _chunkQRHGVBKUjs.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
|
|
2937
|
+
const parent = _chunkQRHGVBKUjs.isObject.call(void 0, session) ? session["parent"] : void 0;
|
|
2938
|
+
const parentTurn = _chunkQRHGVBKUjs.isObject.call(void 0, parent) ? parent["turn"] : void 0;
|
|
2939
|
+
const parentLineage = _chunkQRHGVBKUjs.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkQRHGVBKUjs.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
|
|
2927
2940
|
callId: parent["callId"],
|
|
2928
2941
|
sessionId: parent["sessionId"],
|
|
2929
2942
|
turnId: parentTurn["id"]
|
|
@@ -3030,10 +3043,10 @@ var EveBridge = (_class = class {
|
|
|
3030
3043
|
}
|
|
3031
3044
|
async flushInstrumentation() {
|
|
3032
3045
|
try {
|
|
3033
|
-
await
|
|
3046
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, );
|
|
3034
3047
|
return true;
|
|
3035
3048
|
} catch (error) {
|
|
3036
|
-
|
|
3049
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
3037
3050
|
return false;
|
|
3038
3051
|
}
|
|
3039
3052
|
}
|
|
@@ -3048,12 +3061,12 @@ function emptyEveTraceState() {
|
|
|
3048
3061
|
};
|
|
3049
3062
|
}
|
|
3050
3063
|
function normalizeEveTraceState(state) {
|
|
3051
|
-
if (!
|
|
3064
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, state)) {
|
|
3052
3065
|
return emptyEveTraceState();
|
|
3053
3066
|
}
|
|
3054
|
-
const metadata =
|
|
3067
|
+
const metadata = _chunkQRHGVBKUjs.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
3055
3068
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
3056
|
-
if (!
|
|
3069
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3057
3070
|
return [];
|
|
3058
3071
|
}
|
|
3059
3072
|
const exported = entry["exported"];
|
|
@@ -3062,11 +3075,11 @@ function normalizeEveTraceState(state) {
|
|
|
3062
3075
|
const rowId = entry["rowId"];
|
|
3063
3076
|
const spanId = entry["spanId"];
|
|
3064
3077
|
const startEvent = entry["startEvent"];
|
|
3065
|
-
const startEventCreated =
|
|
3066
|
-
const startEventMetrics =
|
|
3067
|
-
const startEventSpanAttributes =
|
|
3068
|
-
const startEventSpanParents =
|
|
3069
|
-
const normalizedStartEvent = typeof startEventCreated === "string" &&
|
|
3078
|
+
const startEventCreated = _chunkQRHGVBKUjs.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
|
|
3079
|
+
const startEventMetrics = _chunkQRHGVBKUjs.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
|
|
3080
|
+
const startEventSpanAttributes = _chunkQRHGVBKUjs.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
|
|
3081
|
+
const startEventSpanParents = _chunkQRHGVBKUjs.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
|
|
3082
|
+
const normalizedStartEvent = typeof startEventCreated === "string" && _chunkQRHGVBKUjs.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkQRHGVBKUjs.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
|
|
3070
3083
|
(parent) => typeof parent === "string"
|
|
3071
3084
|
) ? {
|
|
3072
3085
|
created: startEventCreated,
|
|
@@ -3086,7 +3099,7 @@ function normalizeEveTraceState(state) {
|
|
|
3086
3099
|
] : [];
|
|
3087
3100
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
3088
3101
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
3089
|
-
if (!
|
|
3102
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3090
3103
|
return [];
|
|
3091
3104
|
}
|
|
3092
3105
|
const key = entry["key"];
|
|
@@ -3094,7 +3107,7 @@ function normalizeEveTraceState(state) {
|
|
|
3094
3107
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
3095
3108
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
3096
3109
|
const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
|
|
3097
|
-
if (!
|
|
3110
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3098
3111
|
return [];
|
|
3099
3112
|
}
|
|
3100
3113
|
const content = entry["content"];
|
|
@@ -3109,7 +3122,7 @@ function normalizeEveTraceState(state) {
|
|
|
3109
3122
|
] : [];
|
|
3110
3123
|
}).slice(-MAX_STORED_REASONING_BLOCKS) : [];
|
|
3111
3124
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
3112
|
-
if (!
|
|
3125
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3113
3126
|
return [];
|
|
3114
3127
|
}
|
|
3115
3128
|
const ordinal = entry["ordinal"];
|
|
@@ -3186,14 +3199,14 @@ function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
|
3186
3199
|
});
|
|
3187
3200
|
}
|
|
3188
3201
|
function eveOutputMessage(output) {
|
|
3189
|
-
return Array.isArray(output) &&
|
|
3202
|
+
return Array.isArray(output) && _chunkQRHGVBKUjs.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
|
|
3190
3203
|
}
|
|
3191
3204
|
function mergeEveReasoning(output, reasoning) {
|
|
3192
3205
|
if (reasoning.length === 0) {
|
|
3193
3206
|
return output;
|
|
3194
3207
|
}
|
|
3195
|
-
const choice = Array.isArray(output) &&
|
|
3196
|
-
const message =
|
|
3208
|
+
const choice = Array.isArray(output) && _chunkQRHGVBKUjs.isObject.call(void 0, output[0]) ? output[0] : {};
|
|
3209
|
+
const message = _chunkQRHGVBKUjs.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
|
|
3197
3210
|
return [
|
|
3198
3211
|
{
|
|
3199
3212
|
...choice,
|
|
@@ -3247,7 +3260,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
3247
3260
|
});
|
|
3248
3261
|
return input;
|
|
3249
3262
|
} catch (error) {
|
|
3250
|
-
|
|
3263
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
3251
3264
|
return void 0;
|
|
3252
3265
|
}
|
|
3253
3266
|
}
|
|
@@ -3385,14 +3398,14 @@ function capturedEveModelContentPart(part) {
|
|
|
3385
3398
|
}
|
|
3386
3399
|
function isCapturedModelInput(input) {
|
|
3387
3400
|
return Array.isArray(input) && input.every(
|
|
3388
|
-
(message) =>
|
|
3401
|
+
(message) => _chunkQRHGVBKUjs.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(_chunkQRHGVBKUjs.isObject))
|
|
3389
3402
|
);
|
|
3390
3403
|
}
|
|
3391
3404
|
function llmInputKey(sessionId, turnId, stepIndex) {
|
|
3392
3405
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3393
3406
|
}
|
|
3394
3407
|
function modelMetadataFromRuntime(runtime) {
|
|
3395
|
-
if (!
|
|
3408
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, runtime)) {
|
|
3396
3409
|
return {};
|
|
3397
3410
|
}
|
|
3398
3411
|
const modelId = runtime["modelId"];
|
|
@@ -3415,11 +3428,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3415
3428
|
};
|
|
3416
3429
|
}
|
|
3417
3430
|
function sessionIdFromContext(ctx) {
|
|
3418
|
-
if (!
|
|
3431
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, ctx)) {
|
|
3419
3432
|
return void 0;
|
|
3420
3433
|
}
|
|
3421
3434
|
const session = ctx["session"];
|
|
3422
|
-
if (!
|
|
3435
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, session)) {
|
|
3423
3436
|
return void 0;
|
|
3424
3437
|
}
|
|
3425
3438
|
const id = session["id"];
|
|
@@ -3430,19 +3443,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3430
3443
|
return metadata;
|
|
3431
3444
|
}
|
|
3432
3445
|
function isToolCallAction(action) {
|
|
3433
|
-
return
|
|
3446
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkQRHGVBKUjs.isObject.call(void 0, action["input"]);
|
|
3434
3447
|
}
|
|
3435
3448
|
function isLocalSubagentCallAction(action) {
|
|
3436
|
-
return
|
|
3449
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkQRHGVBKUjs.isObject.call(void 0, action["input"]);
|
|
3437
3450
|
}
|
|
3438
3451
|
function isTraceableActionRequest(action) {
|
|
3439
3452
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3440
3453
|
}
|
|
3441
3454
|
function isToolResult(result) {
|
|
3442
|
-
return
|
|
3455
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3443
3456
|
}
|
|
3444
3457
|
function isSubagentResult(result) {
|
|
3445
|
-
return
|
|
3458
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3446
3459
|
}
|
|
3447
3460
|
function normalizedFinishReason(finishReason) {
|
|
3448
3461
|
switch (finishReason) {
|
|
@@ -3534,6 +3547,66 @@ function betaProxy(beta, anthropic) {
|
|
|
3534
3547
|
if (prop === "messages") {
|
|
3535
3548
|
return betaMessagesProxy(target.messages, anthropic);
|
|
3536
3549
|
}
|
|
3550
|
+
if (prop === "sessions") {
|
|
3551
|
+
return target.sessions ? betaSessionsProxy(target.sessions) : target.sessions;
|
|
3552
|
+
}
|
|
3553
|
+
return Reflect.get(target, prop, receiver);
|
|
3554
|
+
}
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
function betaSessionsProxy(sessions) {
|
|
3558
|
+
return new Proxy(sessions, {
|
|
3559
|
+
get(target, prop, receiver) {
|
|
3560
|
+
if (prop === "events") {
|
|
3561
|
+
return betaSessionEventsProxy(target.events);
|
|
3562
|
+
}
|
|
3563
|
+
if (prop === "threads") {
|
|
3564
|
+
return target.threads ? betaSessionThreadsProxy(target.threads) : target.threads;
|
|
3565
|
+
}
|
|
3566
|
+
return Reflect.get(target, prop, receiver);
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
function betaSessionEventsProxy(events) {
|
|
3571
|
+
return new Proxy(events, {
|
|
3572
|
+
get(target, prop, receiver) {
|
|
3573
|
+
if (prop === "stream") {
|
|
3574
|
+
return new TypedApplyProxy(target.stream, {
|
|
3575
|
+
apply(stream, thisArg, argArray) {
|
|
3576
|
+
return _chunkMF7NU6BTjs.anthropicChannels.betaSessionsEventsStream.tracePromise(
|
|
3577
|
+
() => Reflect.apply(stream, thisArg, argArray),
|
|
3578
|
+
{ arguments: argArray }
|
|
3579
|
+
);
|
|
3580
|
+
}
|
|
3581
|
+
});
|
|
3582
|
+
}
|
|
3583
|
+
return Reflect.get(target, prop, receiver);
|
|
3584
|
+
}
|
|
3585
|
+
});
|
|
3586
|
+
}
|
|
3587
|
+
function betaSessionThreadsProxy(threads) {
|
|
3588
|
+
return new Proxy(threads, {
|
|
3589
|
+
get(target, prop, receiver) {
|
|
3590
|
+
if (prop === "events") {
|
|
3591
|
+
return betaSessionThreadEventsProxy(target.events);
|
|
3592
|
+
}
|
|
3593
|
+
return Reflect.get(target, prop, receiver);
|
|
3594
|
+
}
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
function betaSessionThreadEventsProxy(events) {
|
|
3598
|
+
return new Proxy(events, {
|
|
3599
|
+
get(target, prop, receiver) {
|
|
3600
|
+
if (prop === "stream") {
|
|
3601
|
+
return new TypedApplyProxy(target.stream, {
|
|
3602
|
+
apply(stream, thisArg, argArray) {
|
|
3603
|
+
return _chunkMF7NU6BTjs.anthropicChannels.betaSessionsThreadsEventsStream.tracePromise(
|
|
3604
|
+
() => Reflect.apply(stream, thisArg, argArray),
|
|
3605
|
+
{ arguments: argArray }
|
|
3606
|
+
);
|
|
3607
|
+
}
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3537
3610
|
return Reflect.get(target, prop, receiver);
|
|
3538
3611
|
}
|
|
3539
3612
|
});
|
|
@@ -3542,7 +3615,7 @@ function messagesProxy(messages) {
|
|
|
3542
3615
|
return new Proxy(messages, {
|
|
3543
3616
|
get(target, prop, receiver) {
|
|
3544
3617
|
if (prop === "create") {
|
|
3545
|
-
return createProxy(target.create,
|
|
3618
|
+
return createProxy(target.create, _chunkMF7NU6BTjs.anthropicChannels.messagesCreate);
|
|
3546
3619
|
}
|
|
3547
3620
|
return Reflect.get(target, prop, receiver);
|
|
3548
3621
|
}
|
|
@@ -3552,7 +3625,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3552
3625
|
return new Proxy(messages, {
|
|
3553
3626
|
get(target, prop, receiver) {
|
|
3554
3627
|
if (prop === "create") {
|
|
3555
|
-
return createProxy(target.create,
|
|
3628
|
+
return createProxy(target.create, _chunkMF7NU6BTjs.anthropicChannels.betaMessagesCreate);
|
|
3556
3629
|
}
|
|
3557
3630
|
if (prop === "toolRunner") {
|
|
3558
3631
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -3561,7 +3634,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3561
3634
|
return toolRunnerProxy(
|
|
3562
3635
|
target.toolRunner,
|
|
3563
3636
|
anthropic,
|
|
3564
|
-
|
|
3637
|
+
_chunkMF7NU6BTjs.anthropicChannels.betaMessagesToolRunner
|
|
3565
3638
|
);
|
|
3566
3639
|
}
|
|
3567
3640
|
return Reflect.get(target, prop, receiver);
|
|
@@ -3618,11 +3691,11 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
3618
3691
|
...params,
|
|
3619
3692
|
options: {
|
|
3620
3693
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
3621
|
-
[
|
|
3694
|
+
[_chunkQRHGVBKUjs.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
3622
3695
|
}
|
|
3623
3696
|
};
|
|
3624
3697
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3625
|
-
return
|
|
3698
|
+
return _chunkMF7NU6BTjs.claudeAgentSDKChannels.query.traceSync(
|
|
3626
3699
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
3627
3700
|
// The channel carries no extra context fields, but the generated
|
|
3628
3701
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -3650,7 +3723,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
3650
3723
|
}
|
|
3651
3724
|
const localToolMetadata = { toolName };
|
|
3652
3725
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
3653
|
-
wrappedArgs[handlerIndex] =
|
|
3726
|
+
wrappedArgs[handlerIndex] = _chunkQRHGVBKUjs.wrapLocalClaudeToolHandler.call(void 0,
|
|
3654
3727
|
originalHandler,
|
|
3655
3728
|
() => localToolMetadata
|
|
3656
3729
|
);
|
|
@@ -3727,6 +3800,52 @@ function claudeAgentSDKProxy(sdk) {
|
|
|
3727
3800
|
});
|
|
3728
3801
|
}
|
|
3729
3802
|
|
|
3803
|
+
// src/wrappers/cloudflare-think.ts
|
|
3804
|
+
var WRAPPED_THINK = /* @__PURE__ */ Symbol.for("braintrust.cloudflare-think.wrapped");
|
|
3805
|
+
function wrapCloudflareThink(sdk) {
|
|
3806
|
+
if (!sdk || typeof sdk !== "object") {
|
|
3807
|
+
return sdk;
|
|
3808
|
+
}
|
|
3809
|
+
const thinkModule = sdk;
|
|
3810
|
+
if (typeof thinkModule.Think !== "function") {
|
|
3811
|
+
return sdk;
|
|
3812
|
+
}
|
|
3813
|
+
patchThinkClass(thinkModule.Think);
|
|
3814
|
+
return sdk;
|
|
3815
|
+
}
|
|
3816
|
+
function patchThinkClass(Think) {
|
|
3817
|
+
const prototype = Think.prototype;
|
|
3818
|
+
if (!prototype || prototype[WRAPPED_THINK]) {
|
|
3819
|
+
return;
|
|
3820
|
+
}
|
|
3821
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
3822
|
+
prototype,
|
|
3823
|
+
"_runInferenceLoop"
|
|
3824
|
+
);
|
|
3825
|
+
if (!descriptor || typeof descriptor.value !== "function") {
|
|
3826
|
+
return;
|
|
3827
|
+
}
|
|
3828
|
+
const original = descriptor.value;
|
|
3829
|
+
Object.defineProperty(prototype, "_runInferenceLoop", {
|
|
3830
|
+
...descriptor,
|
|
3831
|
+
value: function wrappedCloudflareThinkRunInferenceLoop(input) {
|
|
3832
|
+
const args = [input];
|
|
3833
|
+
return _chunkMF7NU6BTjs.cloudflareThinkChannels.runInferenceLoop.tracePromise(
|
|
3834
|
+
() => Reflect.apply(original, this, args),
|
|
3835
|
+
{
|
|
3836
|
+
arguments: args,
|
|
3837
|
+
self: this
|
|
3838
|
+
}
|
|
3839
|
+
);
|
|
3840
|
+
}
|
|
3841
|
+
});
|
|
3842
|
+
Object.defineProperty(prototype, WRAPPED_THINK, {
|
|
3843
|
+
configurable: false,
|
|
3844
|
+
enumerable: false,
|
|
3845
|
+
value: true
|
|
3846
|
+
});
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3730
3849
|
// src/wrappers/openai-codex.ts
|
|
3731
3850
|
var WRAPPED_CLIENT = /* @__PURE__ */ Symbol.for("braintrust.openai-codex.wrapped-client");
|
|
3732
3851
|
var WRAPPED_THREAD = /* @__PURE__ */ Symbol.for("braintrust.openai-codex.wrapped-thread");
|
|
@@ -3833,7 +3952,7 @@ function wrapCodexThread(thread) {
|
|
|
3833
3952
|
if (prop === "run" && typeof value === "function") {
|
|
3834
3953
|
return function(input, turnOptions) {
|
|
3835
3954
|
const args = [input, turnOptions];
|
|
3836
|
-
return
|
|
3955
|
+
return _chunkMF7NU6BTjs.openAICodexChannels.run.tracePromise(
|
|
3837
3956
|
() => Reflect.apply(value, target, args),
|
|
3838
3957
|
{
|
|
3839
3958
|
arguments: args,
|
|
@@ -3846,7 +3965,7 @@ function wrapCodexThread(thread) {
|
|
|
3846
3965
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
3847
3966
|
return function(input, turnOptions) {
|
|
3848
3967
|
const args = [input, turnOptions];
|
|
3849
|
-
return
|
|
3968
|
+
return _chunkMF7NU6BTjs.openAICodexChannels.runStreamed.tracePromise(
|
|
3850
3969
|
() => Reflect.apply(value, target, args),
|
|
3851
3970
|
{
|
|
3852
3971
|
arguments: args,
|
|
@@ -3914,7 +4033,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3914
4033
|
if (prop === "create" && typeof value === "function") {
|
|
3915
4034
|
const wrapped = async function(options) {
|
|
3916
4035
|
const args = [options];
|
|
3917
|
-
return
|
|
4036
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.create.tracePromise(
|
|
3918
4037
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3919
4038
|
{ arguments: args }
|
|
3920
4039
|
);
|
|
@@ -3925,7 +4044,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3925
4044
|
if (prop === "resume" && typeof value === "function") {
|
|
3926
4045
|
const wrapped = async function(agentId, options) {
|
|
3927
4046
|
const args = [agentId, options];
|
|
3928
|
-
return
|
|
4047
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.resume.tracePromise(
|
|
3929
4048
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3930
4049
|
{ arguments: args }
|
|
3931
4050
|
);
|
|
@@ -3936,7 +4055,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3936
4055
|
if (prop === "prompt" && typeof value === "function") {
|
|
3937
4056
|
const wrapped = async function(message, options) {
|
|
3938
4057
|
const args = [message, options];
|
|
3939
|
-
return
|
|
4058
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.prompt.tracePromise(
|
|
3940
4059
|
() => Reflect.apply(value, target, args),
|
|
3941
4060
|
{ arguments: args }
|
|
3942
4061
|
);
|
|
@@ -3969,7 +4088,7 @@ function wrapCursorAgent(agent) {
|
|
|
3969
4088
|
if (prop === "send" && typeof value === "function") {
|
|
3970
4089
|
return function(message, options) {
|
|
3971
4090
|
const args = [message, options];
|
|
3972
|
-
return
|
|
4091
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.send.tracePromise(
|
|
3973
4092
|
() => Reflect.apply(value, target, args),
|
|
3974
4093
|
{
|
|
3975
4094
|
agent: target,
|
|
@@ -4019,14 +4138,9 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
4019
4138
|
...descriptor,
|
|
4020
4139
|
value: function wrappedPiCodingAgentPrompt(text, options) {
|
|
4021
4140
|
const args = [text, options];
|
|
4022
|
-
return
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
arguments: args,
|
|
4026
|
-
self: this,
|
|
4027
|
-
session: this
|
|
4028
|
-
}
|
|
4029
|
-
);
|
|
4141
|
+
return _chunkMF7NU6BTjs.piCodingAgentChannels.prompt.invoke(originalPrompt, this, args, {
|
|
4142
|
+
session: this
|
|
4143
|
+
});
|
|
4030
4144
|
}
|
|
4031
4145
|
});
|
|
4032
4146
|
Object.defineProperty(prototype, WRAPPED_PROMPT, {
|
|
@@ -4036,6 +4150,67 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
4036
4150
|
});
|
|
4037
4151
|
}
|
|
4038
4152
|
|
|
4153
|
+
// src/wrappers/cloudflare-agent.ts
|
|
4154
|
+
var WRAPPED_RUN_AGENT_TOOL = /* @__PURE__ */ Symbol.for(
|
|
4155
|
+
"braintrust.cloudflare-agents.wrapped-run-agent-tool"
|
|
4156
|
+
);
|
|
4157
|
+
function wrapCloudflareAgent(Agent) {
|
|
4158
|
+
if (typeof Agent !== "function") {
|
|
4159
|
+
warnUnsupportedAgent();
|
|
4160
|
+
return Agent;
|
|
4161
|
+
}
|
|
4162
|
+
const prototypeDescriptor = Object.getOwnPropertyDescriptor(
|
|
4163
|
+
Agent,
|
|
4164
|
+
"prototype"
|
|
4165
|
+
);
|
|
4166
|
+
const prototype = prototypeDescriptor && "value" in prototypeDescriptor ? prototypeDescriptor.value : void 0;
|
|
4167
|
+
if (!isObjectLike(prototype)) {
|
|
4168
|
+
warnUnsupportedAgent();
|
|
4169
|
+
return Agent;
|
|
4170
|
+
}
|
|
4171
|
+
if (ownValue(prototype, WRAPPED_RUN_AGENT_TOOL) === true) {
|
|
4172
|
+
return Agent;
|
|
4173
|
+
}
|
|
4174
|
+
const descriptor = Object.getOwnPropertyDescriptor(prototype, "runAgentTool");
|
|
4175
|
+
if (!descriptor || typeof descriptor.value !== "function") {
|
|
4176
|
+
warnUnsupportedAgent();
|
|
4177
|
+
return Agent;
|
|
4178
|
+
}
|
|
4179
|
+
const originalRunAgentTool = descriptor.value;
|
|
4180
|
+
Object.defineProperty(prototype, "runAgentTool", {
|
|
4181
|
+
...descriptor,
|
|
4182
|
+
value: function wrappedRunAgentTool(...args) {
|
|
4183
|
+
const options = args[1];
|
|
4184
|
+
if (ownValue(options, "detached")) {
|
|
4185
|
+
return Reflect.apply(originalRunAgentTool, this, args);
|
|
4186
|
+
}
|
|
4187
|
+
return _chunkMF7NU6BTjs.cloudflareAgentsChannels.runAgentTool.tracePromise(
|
|
4188
|
+
() => Reflect.apply(originalRunAgentTool, this, args),
|
|
4189
|
+
{ arguments: args, self: this }
|
|
4190
|
+
);
|
|
4191
|
+
}
|
|
4192
|
+
});
|
|
4193
|
+
Object.defineProperty(prototype, WRAPPED_RUN_AGENT_TOOL, {
|
|
4194
|
+
configurable: false,
|
|
4195
|
+
enumerable: false,
|
|
4196
|
+
value: true
|
|
4197
|
+
});
|
|
4198
|
+
return Agent;
|
|
4199
|
+
}
|
|
4200
|
+
function ownValue(value, key) {
|
|
4201
|
+
if (!isObjectLike(value)) {
|
|
4202
|
+
return void 0;
|
|
4203
|
+
}
|
|
4204
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
4205
|
+
return descriptor && "value" in descriptor ? descriptor.value : void 0;
|
|
4206
|
+
}
|
|
4207
|
+
function isObjectLike(value) {
|
|
4208
|
+
return typeof value === "object" && value !== null || typeof value === "function";
|
|
4209
|
+
}
|
|
4210
|
+
function warnUnsupportedAgent() {
|
|
4211
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Unsupported Cloudflare Agents Agent class. Not wrapping.");
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4039
4214
|
// src/wrappers/strands-agent-sdk.ts
|
|
4040
4215
|
var WRAPPED_CLASS = /* @__PURE__ */ Symbol.for("braintrust.strands-agent-sdk.wrapped-class");
|
|
4041
4216
|
var WRAPPED_INSTANCE = /* @__PURE__ */ Symbol.for(
|
|
@@ -4139,7 +4314,7 @@ function wrapAgentInstance(agent) {
|
|
|
4139
4314
|
if (prop === "stream" && typeof value === "function") {
|
|
4140
4315
|
return function(args, options) {
|
|
4141
4316
|
const callArgs = [args, options];
|
|
4142
|
-
return
|
|
4317
|
+
return _chunkMF7NU6BTjs.strandsAgentSDKChannels.agentStream.traceSync(
|
|
4143
4318
|
() => Reflect.apply(value, target, callArgs),
|
|
4144
4319
|
{
|
|
4145
4320
|
agent: proxy,
|
|
@@ -4175,7 +4350,7 @@ function wrapMultiAgentInstance(orchestrator, kind) {
|
|
|
4175
4350
|
if (prop === "stream" && typeof value === "function") {
|
|
4176
4351
|
return function(input, options) {
|
|
4177
4352
|
const callArgs = [input, options];
|
|
4178
|
-
const channel = kind === "graph" ?
|
|
4353
|
+
const channel = kind === "graph" ? _chunkMF7NU6BTjs.strandsAgentSDKChannels.graphStream : _chunkMF7NU6BTjs.strandsAgentSDKChannels.swarmStream;
|
|
4179
4354
|
return channel.traceSync(
|
|
4180
4355
|
() => Reflect.apply(value, target, callArgs),
|
|
4181
4356
|
{
|
|
@@ -4204,6 +4379,81 @@ async function consumeAsyncGenerator(generator) {
|
|
|
4204
4379
|
return result.value;
|
|
4205
4380
|
}
|
|
4206
4381
|
|
|
4382
|
+
// src/wrappers/cloudflare-ai-chat.ts
|
|
4383
|
+
var wrappedClasses = /* @__PURE__ */ new WeakMap();
|
|
4384
|
+
function wrapCloudflareAIChat(module) {
|
|
4385
|
+
if (!module || typeof module !== "object") {
|
|
4386
|
+
return module;
|
|
4387
|
+
}
|
|
4388
|
+
const candidate = module;
|
|
4389
|
+
let AIChatAgent;
|
|
4390
|
+
try {
|
|
4391
|
+
AIChatAgent = Reflect.get(candidate, "AIChatAgent");
|
|
4392
|
+
} catch (error) {
|
|
4393
|
+
_chunkQRHGVBKUjs.debugLogger.debug("Failed to inspect @cloudflare/ai-chat module:", error);
|
|
4394
|
+
return module;
|
|
4395
|
+
}
|
|
4396
|
+
if (typeof AIChatAgent !== "function") {
|
|
4397
|
+
_chunkQRHGVBKUjs.debugLogger.warn(
|
|
4398
|
+
"Unsupported @cloudflare/ai-chat module. AIChatAgent was not found; not wrapping."
|
|
4399
|
+
);
|
|
4400
|
+
return module;
|
|
4401
|
+
}
|
|
4402
|
+
const target = isModuleNamespace5(module) ? Object.setPrototypeOf({}, module) : candidate;
|
|
4403
|
+
return new Proxy(target, {
|
|
4404
|
+
get(target2, property, receiver) {
|
|
4405
|
+
const value = Reflect.get(target2, property, receiver);
|
|
4406
|
+
if (property === "AIChatAgent" && typeof value === "function") {
|
|
4407
|
+
return wrapAIChatAgentClass(
|
|
4408
|
+
value
|
|
4409
|
+
);
|
|
4410
|
+
}
|
|
4411
|
+
return value;
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
}
|
|
4415
|
+
function wrapAIChatAgentClass(AgentClass) {
|
|
4416
|
+
const cached = wrappedClasses.get(AgentClass);
|
|
4417
|
+
if (cached) {
|
|
4418
|
+
return cached;
|
|
4419
|
+
}
|
|
4420
|
+
const wrapped = new Proxy(AgentClass, {
|
|
4421
|
+
get(target, property) {
|
|
4422
|
+
const value = Reflect.get(target, property, target);
|
|
4423
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
4424
|
+
},
|
|
4425
|
+
construct(target, args, newTarget) {
|
|
4426
|
+
const instance = Reflect.construct(
|
|
4427
|
+
target,
|
|
4428
|
+
args,
|
|
4429
|
+
newTarget
|
|
4430
|
+
);
|
|
4431
|
+
return _chunkQRHGVBKUjs.instrumentCloudflareAIChatAgent.call(void 0, instance);
|
|
4432
|
+
}
|
|
4433
|
+
});
|
|
4434
|
+
wrappedClasses.set(AgentClass, wrapped);
|
|
4435
|
+
wrappedClasses.set(wrapped, wrapped);
|
|
4436
|
+
return wrapped;
|
|
4437
|
+
}
|
|
4438
|
+
function isModuleNamespace5(value) {
|
|
4439
|
+
if (!value || typeof value !== "object") {
|
|
4440
|
+
return false;
|
|
4441
|
+
}
|
|
4442
|
+
try {
|
|
4443
|
+
if (Reflect.get(value, Symbol.toStringTag) === "Module") {
|
|
4444
|
+
return true;
|
|
4445
|
+
}
|
|
4446
|
+
const keys = Object.keys(value);
|
|
4447
|
+
if (keys.length === 0) {
|
|
4448
|
+
return false;
|
|
4449
|
+
}
|
|
4450
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, keys[0]);
|
|
4451
|
+
return descriptor ? !descriptor.configurable && !descriptor.writable : false;
|
|
4452
|
+
} catch (e6) {
|
|
4453
|
+
return false;
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4207
4457
|
// src/wrappers/google-genai.ts
|
|
4208
4458
|
function wrapGoogleGenAI(googleGenAI) {
|
|
4209
4459
|
if (!googleGenAI || typeof googleGenAI !== "object") {
|
|
@@ -4250,7 +4500,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
4250
4500
|
}
|
|
4251
4501
|
if (prop === "interactions") {
|
|
4252
4502
|
const interactions = Reflect.get(target, prop, receiver);
|
|
4253
|
-
if (!
|
|
4503
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
4254
4504
|
return interactions;
|
|
4255
4505
|
}
|
|
4256
4506
|
if (interactions !== originalInteractions) {
|
|
@@ -4264,7 +4514,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
4264
4514
|
});
|
|
4265
4515
|
}
|
|
4266
4516
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
4267
|
-
if (!
|
|
4517
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
4268
4518
|
return;
|
|
4269
4519
|
}
|
|
4270
4520
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -4297,7 +4547,7 @@ function wrapInteractions(interactions) {
|
|
|
4297
4547
|
}
|
|
4298
4548
|
function wrapGenerateContent(original) {
|
|
4299
4549
|
return function(params) {
|
|
4300
|
-
return
|
|
4550
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.generateContent.tracePromise(
|
|
4301
4551
|
() => original(params),
|
|
4302
4552
|
{ arguments: [params] }
|
|
4303
4553
|
);
|
|
@@ -4305,7 +4555,7 @@ function wrapGenerateContent(original) {
|
|
|
4305
4555
|
}
|
|
4306
4556
|
function wrapGenerateContentStream(original) {
|
|
4307
4557
|
return function(params) {
|
|
4308
|
-
return
|
|
4558
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.generateContentStream.tracePromise(
|
|
4309
4559
|
() => original(params),
|
|
4310
4560
|
{ arguments: [params] }
|
|
4311
4561
|
);
|
|
@@ -4313,7 +4563,7 @@ function wrapGenerateContentStream(original) {
|
|
|
4313
4563
|
}
|
|
4314
4564
|
function wrapEmbedContent(original) {
|
|
4315
4565
|
return function(params) {
|
|
4316
|
-
return
|
|
4566
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.embedContent.tracePromise(
|
|
4317
4567
|
() => original(params),
|
|
4318
4568
|
{ arguments: [params] }
|
|
4319
4569
|
);
|
|
@@ -4325,7 +4575,7 @@ function wrapInteractionCreate(original) {
|
|
|
4325
4575
|
return options === void 0 ? original(params) : original(params, options);
|
|
4326
4576
|
}
|
|
4327
4577
|
const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
|
|
4328
|
-
return
|
|
4578
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.interactionsCreate.tracePromise(
|
|
4329
4579
|
() => options === void 0 ? original(params) : original(params, options),
|
|
4330
4580
|
traceContext
|
|
4331
4581
|
);
|
|
@@ -4386,7 +4636,7 @@ function wrapRunnerInstance(runner) {
|
|
|
4386
4636
|
function wrapRunnerRunAsync(runner) {
|
|
4387
4637
|
const original = runner.runAsync.bind(runner);
|
|
4388
4638
|
return function(params) {
|
|
4389
|
-
return
|
|
4639
|
+
return _chunkMF7NU6BTjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
4390
4640
|
arguments: [params],
|
|
4391
4641
|
self: runner
|
|
4392
4642
|
});
|
|
@@ -4413,7 +4663,7 @@ function wrapAgentInstance2(agent) {
|
|
|
4413
4663
|
function wrapAgentRunAsync(agent) {
|
|
4414
4664
|
const original = agent.runAsync.bind(agent);
|
|
4415
4665
|
return function(parentContext) {
|
|
4416
|
-
return
|
|
4666
|
+
return _chunkMF7NU6BTjs.googleADKChannels.agentRunAsync.traceSync(
|
|
4417
4667
|
() => original(parentContext),
|
|
4418
4668
|
{ arguments: [parentContext], self: agent }
|
|
4419
4669
|
);
|
|
@@ -4440,7 +4690,7 @@ function wrapToolInstance(tool) {
|
|
|
4440
4690
|
function wrapToolRunAsync(tool) {
|
|
4441
4691
|
const original = tool.runAsync.bind(tool);
|
|
4442
4692
|
return function(req) {
|
|
4443
|
-
return
|
|
4693
|
+
return _chunkMF7NU6BTjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
4444
4694
|
arguments: [req],
|
|
4445
4695
|
self: tool
|
|
4446
4696
|
});
|
|
@@ -4552,7 +4802,7 @@ function patchGenkitRegistryLookup(registry) {
|
|
|
4552
4802
|
Object.defineProperty(registry, PATCHED_GENKIT_REGISTRY, {
|
|
4553
4803
|
value: true
|
|
4554
4804
|
});
|
|
4555
|
-
} catch (
|
|
4805
|
+
} catch (e7) {
|
|
4556
4806
|
}
|
|
4557
4807
|
}
|
|
4558
4808
|
function patchGenkitRegistryConstructor(registry) {
|
|
@@ -4583,31 +4833,31 @@ function patchGenkitRegistryConstructor(registry) {
|
|
|
4583
4833
|
Object.defineProperty(constructor, PATCHED_GENKIT_REGISTRY_CONSTRUCTOR, {
|
|
4584
4834
|
value: true
|
|
4585
4835
|
});
|
|
4586
|
-
} catch (
|
|
4836
|
+
} catch (e8) {
|
|
4587
4837
|
}
|
|
4588
4838
|
}
|
|
4589
4839
|
function wrapGenerate(generate) {
|
|
4590
|
-
return (input) =>
|
|
4840
|
+
return (input) => _chunkMF7NU6BTjs.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
4591
4841
|
arguments: [input]
|
|
4592
4842
|
});
|
|
4593
4843
|
}
|
|
4594
4844
|
function wrapGenerateStream(generateStream) {
|
|
4595
|
-
return (input) =>
|
|
4845
|
+
return (input) => _chunkMF7NU6BTjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
4596
4846
|
arguments: [input]
|
|
4597
4847
|
});
|
|
4598
4848
|
}
|
|
4599
4849
|
function wrapEmbed2(embed) {
|
|
4600
|
-
return (params) =>
|
|
4850
|
+
return (params) => _chunkMF7NU6BTjs.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
4601
4851
|
arguments: [params]
|
|
4602
4852
|
});
|
|
4603
4853
|
}
|
|
4604
4854
|
function wrapEmbedMany2(embedMany) {
|
|
4605
|
-
return (params) =>
|
|
4855
|
+
return (params) => _chunkMF7NU6BTjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
4606
4856
|
arguments: [params]
|
|
4607
4857
|
});
|
|
4608
4858
|
}
|
|
4609
4859
|
function wrapRun(run) {
|
|
4610
|
-
return (name, inputOrFn, maybeFn) =>
|
|
4860
|
+
return (name, inputOrFn, maybeFn) => _chunkMF7NU6BTjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
4611
4861
|
arguments: [name, inputOrFn, maybeFn]
|
|
4612
4862
|
});
|
|
4613
4863
|
}
|
|
@@ -4646,13 +4896,13 @@ function isGenkitAction(value) {
|
|
|
4646
4896
|
return typeof value === "function" && "__action" in value;
|
|
4647
4897
|
}
|
|
4648
4898
|
function traceActionRun(action, run) {
|
|
4649
|
-
return (input, options) =>
|
|
4899
|
+
return (input, options) => _chunkMF7NU6BTjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
4650
4900
|
arguments: [input, options],
|
|
4651
4901
|
self: action
|
|
4652
4902
|
});
|
|
4653
4903
|
}
|
|
4654
4904
|
function traceActionStream(action, stream) {
|
|
4655
|
-
return (input, options) =>
|
|
4905
|
+
return (input, options) => _chunkMF7NU6BTjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
4656
4906
|
arguments: [input, options],
|
|
4657
4907
|
self: action
|
|
4658
4908
|
});
|
|
@@ -4698,10 +4948,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
4698
4948
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
4699
4949
|
}
|
|
4700
4950
|
function hasFunction2(value, methodName) {
|
|
4701
|
-
return
|
|
4951
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
4702
4952
|
}
|
|
4703
4953
|
function isSupportedHuggingFaceModule(value) {
|
|
4704
|
-
if (!
|
|
4954
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, value)) {
|
|
4705
4955
|
return false;
|
|
4706
4956
|
}
|
|
4707
4957
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -4809,14 +5059,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
4809
5059
|
const context = {
|
|
4810
5060
|
arguments: [traceParams]
|
|
4811
5061
|
};
|
|
4812
|
-
return
|
|
5062
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.chatCompletion.tracePromise(
|
|
4813
5063
|
() => original(params, options),
|
|
4814
5064
|
context
|
|
4815
5065
|
);
|
|
4816
5066
|
};
|
|
4817
5067
|
}
|
|
4818
5068
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
4819
|
-
return (params, options) =>
|
|
5069
|
+
return (params, options) => _chunkMF7NU6BTjs.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
4820
5070
|
() => original(params, options),
|
|
4821
5071
|
{
|
|
4822
5072
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4829,14 +5079,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
4829
5079
|
const context = {
|
|
4830
5080
|
arguments: [traceParams]
|
|
4831
5081
|
};
|
|
4832
|
-
return
|
|
5082
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.textGeneration.tracePromise(
|
|
4833
5083
|
() => original(params, options),
|
|
4834
5084
|
context
|
|
4835
5085
|
);
|
|
4836
5086
|
};
|
|
4837
5087
|
}
|
|
4838
5088
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
4839
|
-
return (params, options) =>
|
|
5089
|
+
return (params, options) => _chunkMF7NU6BTjs.huggingFaceChannels.textGenerationStream.traceSync(
|
|
4840
5090
|
() => original(params, options),
|
|
4841
5091
|
{
|
|
4842
5092
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4849,13 +5099,127 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
4849
5099
|
const context = {
|
|
4850
5100
|
arguments: [traceParams]
|
|
4851
5101
|
};
|
|
4852
|
-
return
|
|
5102
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.featureExtraction.tracePromise(
|
|
4853
5103
|
() => original(params, options),
|
|
4854
5104
|
context
|
|
4855
5105
|
);
|
|
4856
5106
|
};
|
|
4857
5107
|
}
|
|
4858
5108
|
|
|
5109
|
+
// src/wrappers/huggingface-transformers.ts
|
|
5110
|
+
var PIPELINE_CONSTRUCTOR_KEYS = /* @__PURE__ */ new Set([
|
|
5111
|
+
"TextGenerationPipeline",
|
|
5112
|
+
"Text2TextGenerationPipeline",
|
|
5113
|
+
"SummarizationPipeline",
|
|
5114
|
+
"FeatureExtractionPipeline",
|
|
5115
|
+
"QuestionAnsweringPipeline"
|
|
5116
|
+
]);
|
|
5117
|
+
var wrappedValues = /* @__PURE__ */ new WeakMap();
|
|
5118
|
+
function wrapHuggingFaceTransformers(transformers) {
|
|
5119
|
+
const pipelineTask = _optionalChain([transformers, 'optionalAccess', _124 => _124.task]);
|
|
5120
|
+
if (typeof transformers === "function" && _chunkMF7NU6BTjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipelineTask)) {
|
|
5121
|
+
return wrapPipeline(transformers);
|
|
5122
|
+
}
|
|
5123
|
+
if (!isSupportedModule(transformers)) {
|
|
5124
|
+
return transformers;
|
|
5125
|
+
}
|
|
5126
|
+
const existing = wrappedValues.get(transformers);
|
|
5127
|
+
if (existing) {
|
|
5128
|
+
return existing;
|
|
5129
|
+
}
|
|
5130
|
+
const proxy = new Proxy(Object.create(transformers), {
|
|
5131
|
+
get(_target, property, receiver) {
|
|
5132
|
+
const value = Reflect.get(transformers, property, receiver);
|
|
5133
|
+
if (property === "pipeline" && typeof value === "function") {
|
|
5134
|
+
return wrapPipelineFactory(value);
|
|
5135
|
+
}
|
|
5136
|
+
if (typeof property === "string" && PIPELINE_CONSTRUCTOR_KEYS.has(property) && typeof value === "function") {
|
|
5137
|
+
return wrapPipelineConstructor(
|
|
5138
|
+
value
|
|
5139
|
+
);
|
|
5140
|
+
}
|
|
5141
|
+
return value;
|
|
5142
|
+
}
|
|
5143
|
+
});
|
|
5144
|
+
wrappedValues.set(transformers, proxy);
|
|
5145
|
+
wrappedValues.set(proxy, proxy);
|
|
5146
|
+
return proxy;
|
|
5147
|
+
}
|
|
5148
|
+
function isSupportedModule(value) {
|
|
5149
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
5150
|
+
return false;
|
|
5151
|
+
}
|
|
5152
|
+
if (typeof Reflect.get(value, "pipeline") === "function") {
|
|
5153
|
+
return true;
|
|
5154
|
+
}
|
|
5155
|
+
for (const key of PIPELINE_CONSTRUCTOR_KEYS) {
|
|
5156
|
+
if (typeof Reflect.get(value, key) === "function") {
|
|
5157
|
+
return true;
|
|
5158
|
+
}
|
|
5159
|
+
}
|
|
5160
|
+
return false;
|
|
5161
|
+
}
|
|
5162
|
+
function wrapPipelineFactory(factory) {
|
|
5163
|
+
const existing = wrappedValues.get(factory);
|
|
5164
|
+
if (existing) {
|
|
5165
|
+
return existing;
|
|
5166
|
+
}
|
|
5167
|
+
const wrapped = function(...args) {
|
|
5168
|
+
const [task] = args;
|
|
5169
|
+
const context = {
|
|
5170
|
+
arguments: args
|
|
5171
|
+
};
|
|
5172
|
+
return _chunkMF7NU6BTjs.huggingFaceTransformersChannels.pipeline.tracePromise(() => Reflect.apply(factory, this, args), context).then((pipeline) => {
|
|
5173
|
+
if (_chunkMF7NU6BTjs.isSupportedHuggingFaceTransformersTask.call(void 0, _nullishCoalesce(pipeline.task, () => ( task)))) {
|
|
5174
|
+
return wrapPipeline(pipeline);
|
|
5175
|
+
}
|
|
5176
|
+
return pipeline;
|
|
5177
|
+
});
|
|
5178
|
+
};
|
|
5179
|
+
wrappedValues.set(factory, wrapped);
|
|
5180
|
+
wrappedValues.set(wrapped, wrapped);
|
|
5181
|
+
return wrapped;
|
|
5182
|
+
}
|
|
5183
|
+
function wrapPipelineConstructor(constructor) {
|
|
5184
|
+
const existing = wrappedValues.get(constructor);
|
|
5185
|
+
if (existing) {
|
|
5186
|
+
return existing;
|
|
5187
|
+
}
|
|
5188
|
+
const proxy = new Proxy(constructor, {
|
|
5189
|
+
construct(target, args, newTarget) {
|
|
5190
|
+
const pipeline = Reflect.construct(target, args, newTarget);
|
|
5191
|
+
if (_chunkMF7NU6BTjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipeline.task)) {
|
|
5192
|
+
return wrapPipeline(pipeline);
|
|
5193
|
+
}
|
|
5194
|
+
return pipeline;
|
|
5195
|
+
}
|
|
5196
|
+
});
|
|
5197
|
+
wrappedValues.set(constructor, proxy);
|
|
5198
|
+
wrappedValues.set(proxy, proxy);
|
|
5199
|
+
return proxy;
|
|
5200
|
+
}
|
|
5201
|
+
function wrapPipeline(pipeline) {
|
|
5202
|
+
const existing = wrappedValues.get(pipeline);
|
|
5203
|
+
if (existing) {
|
|
5204
|
+
return existing;
|
|
5205
|
+
}
|
|
5206
|
+
const proxy = new Proxy(pipeline, {
|
|
5207
|
+
apply(target, thisArg, args) {
|
|
5208
|
+
const context = {
|
|
5209
|
+
arguments: args,
|
|
5210
|
+
self: target
|
|
5211
|
+
};
|
|
5212
|
+
return _chunkMF7NU6BTjs.huggingFaceTransformersChannels.pipelineCall.tracePromise(
|
|
5213
|
+
() => Reflect.apply(target, thisArg, args),
|
|
5214
|
+
context
|
|
5215
|
+
);
|
|
5216
|
+
}
|
|
5217
|
+
});
|
|
5218
|
+
wrappedValues.set(pipeline, proxy);
|
|
5219
|
+
wrappedValues.set(proxy, proxy);
|
|
5220
|
+
return proxy;
|
|
5221
|
+
}
|
|
5222
|
+
|
|
4859
5223
|
// src/wrappers/openrouter-agent.ts
|
|
4860
5224
|
function wrapOpenRouterAgent(agent) {
|
|
4861
5225
|
const candidate = agent;
|
|
@@ -4896,7 +5260,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
4896
5260
|
const request = cloneCallModelRequest(argArray[0]);
|
|
4897
5261
|
const options = argArray[1];
|
|
4898
5262
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
4899
|
-
return
|
|
5263
|
+
return _chunkMF7NU6BTjs.openRouterAgentChannels.callModel.traceSync(
|
|
4900
5264
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
4901
5265
|
{
|
|
4902
5266
|
arguments: [request]
|
|
@@ -4992,24 +5356,24 @@ function rerankProxy(rerank) {
|
|
|
4992
5356
|
});
|
|
4993
5357
|
}
|
|
4994
5358
|
function wrapChatSend(send) {
|
|
4995
|
-
return (request, options) =>
|
|
5359
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
4996
5360
|
arguments: [request]
|
|
4997
5361
|
});
|
|
4998
5362
|
}
|
|
4999
5363
|
function wrapEmbeddingsGenerate(generate) {
|
|
5000
|
-
return (request, options) =>
|
|
5364
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
5001
5365
|
() => generate(request, options),
|
|
5002
5366
|
{ arguments: [request] }
|
|
5003
5367
|
);
|
|
5004
5368
|
}
|
|
5005
5369
|
function wrapResponsesSend(send) {
|
|
5006
|
-
return (request, options) =>
|
|
5370
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.betaResponsesSend.tracePromise(
|
|
5007
5371
|
() => send(request, options),
|
|
5008
5372
|
{ arguments: [request] }
|
|
5009
5373
|
);
|
|
5010
5374
|
}
|
|
5011
5375
|
function wrapRerank2(rerank) {
|
|
5012
|
-
return (request, options) =>
|
|
5376
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.rerankRerank.tracePromise(
|
|
5013
5377
|
() => rerank(request, options),
|
|
5014
5378
|
{ arguments: [request] }
|
|
5015
5379
|
);
|
|
@@ -5017,7 +5381,7 @@ function wrapRerank2(rerank) {
|
|
|
5017
5381
|
function wrapCallModel2(callModel) {
|
|
5018
5382
|
return (request, options) => {
|
|
5019
5383
|
const tracedRequest = { ...request };
|
|
5020
|
-
return
|
|
5384
|
+
return _chunkMF7NU6BTjs.openRouterChannels.callModel.traceSync(
|
|
5021
5385
|
() => callModel(tracedRequest, options),
|
|
5022
5386
|
{
|
|
5023
5387
|
arguments: [tracedRequest]
|
|
@@ -5150,7 +5514,7 @@ function classifiersProxy(classifiers) {
|
|
|
5150
5514
|
});
|
|
5151
5515
|
}
|
|
5152
5516
|
function wrapChatComplete(complete) {
|
|
5153
|
-
return (request, options) =>
|
|
5517
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.chatComplete.tracePromise(
|
|
5154
5518
|
() => complete(request, options),
|
|
5155
5519
|
{
|
|
5156
5520
|
arguments: [request]
|
|
@@ -5158,52 +5522,52 @@ function wrapChatComplete(complete) {
|
|
|
5158
5522
|
);
|
|
5159
5523
|
}
|
|
5160
5524
|
function wrapChatStream(stream) {
|
|
5161
|
-
return (request, options) =>
|
|
5525
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
5162
5526
|
arguments: [request]
|
|
5163
5527
|
});
|
|
5164
5528
|
}
|
|
5165
5529
|
function wrapEmbeddingsCreate(create) {
|
|
5166
|
-
return (request, options) =>
|
|
5530
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.embeddingsCreate.tracePromise(
|
|
5167
5531
|
() => create(request, options),
|
|
5168
5532
|
{ arguments: [request] }
|
|
5169
5533
|
);
|
|
5170
5534
|
}
|
|
5171
5535
|
function wrapClassifiersModerate(moderate) {
|
|
5172
|
-
return (request, options) =>
|
|
5536
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersModerate.tracePromise(
|
|
5173
5537
|
() => moderate(request, options),
|
|
5174
5538
|
{ arguments: [request] }
|
|
5175
5539
|
);
|
|
5176
5540
|
}
|
|
5177
5541
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
5178
|
-
return (request, options) =>
|
|
5542
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersModerateChat.tracePromise(
|
|
5179
5543
|
() => moderateChat(request, options),
|
|
5180
5544
|
{ arguments: [request] }
|
|
5181
5545
|
);
|
|
5182
5546
|
}
|
|
5183
5547
|
function wrapClassifiersClassify(classify) {
|
|
5184
|
-
return (request, options) =>
|
|
5548
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersClassify.tracePromise(
|
|
5185
5549
|
() => classify(request, options),
|
|
5186
5550
|
{ arguments: [request] }
|
|
5187
5551
|
);
|
|
5188
5552
|
}
|
|
5189
5553
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
5190
|
-
return (request, options) =>
|
|
5554
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
5191
5555
|
() => classifyChat(request, options),
|
|
5192
5556
|
{ arguments: [request] }
|
|
5193
5557
|
);
|
|
5194
5558
|
}
|
|
5195
5559
|
function wrapFimComplete(complete) {
|
|
5196
|
-
return (request, options) =>
|
|
5560
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
5197
5561
|
arguments: [request]
|
|
5198
5562
|
});
|
|
5199
5563
|
}
|
|
5200
5564
|
function wrapFimStream(stream) {
|
|
5201
|
-
return (request, options) =>
|
|
5565
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
5202
5566
|
arguments: [request]
|
|
5203
5567
|
});
|
|
5204
5568
|
}
|
|
5205
5569
|
function wrapAgentsComplete(complete) {
|
|
5206
|
-
return (request, options) =>
|
|
5570
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.agentsComplete.tracePromise(
|
|
5207
5571
|
() => complete(request, options),
|
|
5208
5572
|
{
|
|
5209
5573
|
arguments: [request]
|
|
@@ -5211,7 +5575,84 @@ function wrapAgentsComplete(complete) {
|
|
|
5211
5575
|
);
|
|
5212
5576
|
}
|
|
5213
5577
|
function wrapAgentsStream(stream) {
|
|
5214
|
-
return (request, options) =>
|
|
5578
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
5579
|
+
arguments: [request]
|
|
5580
|
+
});
|
|
5581
|
+
}
|
|
5582
|
+
|
|
5583
|
+
// src/wrappers/ollama.ts
|
|
5584
|
+
function wrapOllama(ollama) {
|
|
5585
|
+
if (isSupportedOllamaClient(ollama)) {
|
|
5586
|
+
return ollamaProxy(ollama);
|
|
5587
|
+
}
|
|
5588
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Unsupported Ollama library. Not wrapping.");
|
|
5589
|
+
return ollama;
|
|
5590
|
+
}
|
|
5591
|
+
var ollamaProxyCache = /* @__PURE__ */ new WeakMap();
|
|
5592
|
+
function isSupportedOllamaClient(value) {
|
|
5593
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, value) && ["chat", "generate", "embed"].some(
|
|
5594
|
+
(name) => typeof value[name] === "function"
|
|
5595
|
+
);
|
|
5596
|
+
}
|
|
5597
|
+
function ollamaProxy(ollama) {
|
|
5598
|
+
const cached = ollamaProxyCache.get(ollama);
|
|
5599
|
+
if (cached) {
|
|
5600
|
+
return cached;
|
|
5601
|
+
}
|
|
5602
|
+
let chatSource;
|
|
5603
|
+
let wrappedChat;
|
|
5604
|
+
let generateSource;
|
|
5605
|
+
let wrappedGenerate;
|
|
5606
|
+
let embedSource;
|
|
5607
|
+
let wrappedEmbed;
|
|
5608
|
+
const proxy = new Proxy(ollama, {
|
|
5609
|
+
get(target, prop, receiver) {
|
|
5610
|
+
switch (prop) {
|
|
5611
|
+
case "chat": {
|
|
5612
|
+
const source = target.chat;
|
|
5613
|
+
if (source !== chatSource) {
|
|
5614
|
+
chatSource = source;
|
|
5615
|
+
wrappedChat = typeof source === "function" ? wrapChat(source.bind(target)) : source;
|
|
5616
|
+
}
|
|
5617
|
+
return wrappedChat;
|
|
5618
|
+
}
|
|
5619
|
+
case "generate": {
|
|
5620
|
+
const source = target.generate;
|
|
5621
|
+
if (source !== generateSource) {
|
|
5622
|
+
generateSource = source;
|
|
5623
|
+
wrappedGenerate = typeof source === "function" ? wrapGenerate2(source.bind(target)) : source;
|
|
5624
|
+
}
|
|
5625
|
+
return wrappedGenerate;
|
|
5626
|
+
}
|
|
5627
|
+
case "embed": {
|
|
5628
|
+
const source = target.embed;
|
|
5629
|
+
if (source !== embedSource) {
|
|
5630
|
+
embedSource = source;
|
|
5631
|
+
wrappedEmbed = typeof source === "function" ? wrapEmbed3(source.bind(target)) : source;
|
|
5632
|
+
}
|
|
5633
|
+
return wrappedEmbed;
|
|
5634
|
+
}
|
|
5635
|
+
default:
|
|
5636
|
+
return Reflect.get(target, prop, receiver);
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
});
|
|
5640
|
+
ollamaProxyCache.set(ollama, proxy);
|
|
5641
|
+
ollamaProxyCache.set(proxy, proxy);
|
|
5642
|
+
return proxy;
|
|
5643
|
+
}
|
|
5644
|
+
function wrapChat(chat) {
|
|
5645
|
+
return (request) => _chunkMF7NU6BTjs.ollamaChannels.chat.tracePromise(() => chat(request), {
|
|
5646
|
+
arguments: [request]
|
|
5647
|
+
});
|
|
5648
|
+
}
|
|
5649
|
+
function wrapGenerate2(generate) {
|
|
5650
|
+
return (request) => _chunkMF7NU6BTjs.ollamaChannels.generate.tracePromise(() => generate(request), {
|
|
5651
|
+
arguments: [request]
|
|
5652
|
+
});
|
|
5653
|
+
}
|
|
5654
|
+
function wrapEmbed3(embed) {
|
|
5655
|
+
return (request) => _chunkMF7NU6BTjs.ollamaChannels.embed.tracePromise(() => embed(request), {
|
|
5215
5656
|
arguments: [request]
|
|
5216
5657
|
});
|
|
5217
5658
|
}
|
|
@@ -5246,11 +5687,11 @@ function cohereProxy(cohere) {
|
|
|
5246
5687
|
get(target, prop, receiver) {
|
|
5247
5688
|
switch (prop) {
|
|
5248
5689
|
case "chat":
|
|
5249
|
-
return typeof target.chat === "function" ?
|
|
5690
|
+
return typeof target.chat === "function" ? wrapChat2(target.chat.bind(target)) : target.chat;
|
|
5250
5691
|
case "chatStream":
|
|
5251
5692
|
return typeof target.chatStream === "function" ? wrapChatStream2(target.chatStream.bind(target)) : target.chatStream;
|
|
5252
5693
|
case "embed":
|
|
5253
|
-
return typeof target.embed === "function" ?
|
|
5694
|
+
return typeof target.embed === "function" ? wrapEmbed4(target.embed.bind(target)) : target.embed;
|
|
5254
5695
|
case "rerank":
|
|
5255
5696
|
return typeof target.rerank === "function" ? wrapRerank3(target.rerank.bind(target)) : target.rerank;
|
|
5256
5697
|
default: {
|
|
@@ -5263,23 +5704,23 @@ function cohereProxy(cohere) {
|
|
|
5263
5704
|
cohereProxyCache.set(cohere, proxy);
|
|
5264
5705
|
return proxy;
|
|
5265
5706
|
}
|
|
5266
|
-
function
|
|
5267
|
-
return (request, options) =>
|
|
5707
|
+
function wrapChat2(chat) {
|
|
5708
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
5268
5709
|
arguments: [request]
|
|
5269
5710
|
});
|
|
5270
5711
|
}
|
|
5271
5712
|
function wrapChatStream2(chatStream) {
|
|
5272
|
-
return (request, options) =>
|
|
5713
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
5273
5714
|
arguments: [request]
|
|
5274
5715
|
});
|
|
5275
5716
|
}
|
|
5276
|
-
function
|
|
5277
|
-
return (request, options) =>
|
|
5717
|
+
function wrapEmbed4(embed) {
|
|
5718
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
5278
5719
|
arguments: [request]
|
|
5279
5720
|
});
|
|
5280
5721
|
}
|
|
5281
5722
|
function wrapRerank3(rerank) {
|
|
5282
|
-
return (request, options) =>
|
|
5723
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
5283
5724
|
arguments: [request]
|
|
5284
5725
|
});
|
|
5285
5726
|
}
|
|
@@ -5309,7 +5750,7 @@ function isSupportedGroqClient(value) {
|
|
|
5309
5750
|
}
|
|
5310
5751
|
function groqProxy(groq) {
|
|
5311
5752
|
const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
|
|
5312
|
-
const completionProxy = _optionalChain([groq, 'access',
|
|
5753
|
+
const completionProxy = _optionalChain([groq, 'access', _125 => _125.chat, 'optionalAccess', _126 => _126.completions]) ? new Proxy(groq.chat.completions, {
|
|
5313
5754
|
get(target, prop, receiver) {
|
|
5314
5755
|
if (prop === "create") {
|
|
5315
5756
|
return wrapChatCompletionsCreate(target.create.bind(target));
|
|
@@ -5361,13 +5802,13 @@ function groqProxy(groq) {
|
|
|
5361
5802
|
return topLevelProxy;
|
|
5362
5803
|
}
|
|
5363
5804
|
function wrapChatCompletionsCreate(create) {
|
|
5364
|
-
return (request, options) =>
|
|
5805
|
+
return (request, options) => _chunkMF7NU6BTjs.groqChannels.chatCompletionsCreate.tracePromise(
|
|
5365
5806
|
() => create(request, options),
|
|
5366
5807
|
{ arguments: [request] }
|
|
5367
5808
|
);
|
|
5368
5809
|
}
|
|
5369
5810
|
function wrapEmbeddingsCreate2(create) {
|
|
5370
|
-
return (request, options) =>
|
|
5811
|
+
return (request, options) => _chunkMF7NU6BTjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
5371
5812
|
arguments: [request]
|
|
5372
5813
|
});
|
|
5373
5814
|
}
|
|
@@ -5441,16 +5882,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
5441
5882
|
}
|
|
5442
5883
|
function wrapSend(send) {
|
|
5443
5884
|
return (command, optionsOrCb, cb) => {
|
|
5444
|
-
if (
|
|
5885
|
+
if (_chunkQRHGVBKUjs.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
5445
5886
|
return send(command, optionsOrCb, cb);
|
|
5446
5887
|
}
|
|
5447
|
-
return
|
|
5448
|
-
() =>
|
|
5888
|
+
return _chunkMF7NU6BTjs.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
5889
|
+
() => _chunkQRHGVBKUjs.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
5449
5890
|
() => send(command, optionsOrCb)
|
|
5450
5891
|
),
|
|
5451
5892
|
{
|
|
5452
5893
|
arguments: [command, optionsOrCb],
|
|
5453
|
-
span_info:
|
|
5894
|
+
span_info: _chunkQRHGVBKUjs.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
5454
5895
|
}
|
|
5455
5896
|
);
|
|
5456
5897
|
};
|
|
@@ -5499,13 +5940,13 @@ function copilotClientProxy(client) {
|
|
|
5499
5940
|
return proxy;
|
|
5500
5941
|
}
|
|
5501
5942
|
function wrappedCreateSession(client) {
|
|
5502
|
-
return (config) =>
|
|
5943
|
+
return (config) => _chunkMF7NU6BTjs.gitHubCopilotChannels.createSession.tracePromise(
|
|
5503
5944
|
() => client.createSession(config),
|
|
5504
5945
|
{ arguments: [config] }
|
|
5505
5946
|
);
|
|
5506
5947
|
}
|
|
5507
5948
|
function wrappedResumeSession(client) {
|
|
5508
|
-
return (sessionId, config) =>
|
|
5949
|
+
return (sessionId, config) => _chunkMF7NU6BTjs.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
5509
5950
|
() => client.resumeSession(sessionId, config),
|
|
5510
5951
|
{ arguments: [sessionId, config] }
|
|
5511
5952
|
);
|
|
@@ -5572,7 +6013,7 @@ function wrapNamespaceExport(namespace, exportName, marker, wrap2) {
|
|
|
5572
6013
|
);
|
|
5573
6014
|
return namespace;
|
|
5574
6015
|
}
|
|
5575
|
-
const target =
|
|
6016
|
+
const target = isModuleNamespace6(namespace) ? Object.setPrototypeOf({}, namespace) : candidate;
|
|
5576
6017
|
const moduleNamespace = target !== candidate;
|
|
5577
6018
|
let wrappedExport;
|
|
5578
6019
|
return new Proxy(target, {
|
|
@@ -5606,11 +6047,11 @@ function wrapNamespaceExport(namespace, exportName, marker, wrap2) {
|
|
|
5606
6047
|
}
|
|
5607
6048
|
});
|
|
5608
6049
|
}
|
|
5609
|
-
function
|
|
6050
|
+
function isModuleNamespace6(value) {
|
|
5610
6051
|
if (!value || typeof value !== "object") {
|
|
5611
6052
|
return false;
|
|
5612
6053
|
}
|
|
5613
|
-
if (_optionalChain([value, 'access',
|
|
6054
|
+
if (_optionalChain([value, 'access', _127 => _127.constructor, 'optionalAccess', _128 => _128.name]) === "Module") {
|
|
5614
6055
|
return true;
|
|
5615
6056
|
}
|
|
5616
6057
|
const firstKey = Object.keys(value)[0];
|
|
@@ -5634,7 +6075,7 @@ function wrapTraceable(traceable2) {
|
|
|
5634
6075
|
apply(target, thisArg, argArray) {
|
|
5635
6076
|
const [fn, rawConfig] = argArray;
|
|
5636
6077
|
const config = rawConfig && typeof rawConfig === "object" ? rawConfig : void 0;
|
|
5637
|
-
const originalOnEnd = _optionalChain([config, 'optionalAccess',
|
|
6078
|
+
const originalOnEnd = _optionalChain([config, 'optionalAccess', _129 => _129.on_end]);
|
|
5638
6079
|
const wrappedConfig = {
|
|
5639
6080
|
...config,
|
|
5640
6081
|
on_end(runTree) {
|
|
@@ -5683,13 +6124,13 @@ function wrapRunTreeInstance(runTree) {
|
|
|
5683
6124
|
wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
|
|
5684
6125
|
} else if (prop === "postRun") {
|
|
5685
6126
|
const method = value;
|
|
5686
|
-
wrapped = (...args) =>
|
|
6127
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.createRun.tracePromise(
|
|
5687
6128
|
() => Reflect.apply(method, target, args),
|
|
5688
6129
|
{ arguments: [target] }
|
|
5689
6130
|
);
|
|
5690
6131
|
} else if (prop === "patchRun") {
|
|
5691
6132
|
const method = value;
|
|
5692
|
-
wrapped = (...args) =>
|
|
6133
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(
|
|
5693
6134
|
() => Reflect.apply(method, target, args),
|
|
5694
6135
|
{
|
|
5695
6136
|
arguments: [
|
|
@@ -5738,19 +6179,19 @@ function wrapClientInstance(client) {
|
|
|
5738
6179
|
let wrapped;
|
|
5739
6180
|
if (prop === "createRun") {
|
|
5740
6181
|
const method = value;
|
|
5741
|
-
wrapped = (...args) =>
|
|
6182
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.createRun.tracePromise(
|
|
5742
6183
|
() => Reflect.apply(method, target, args),
|
|
5743
6184
|
{ arguments: args }
|
|
5744
6185
|
);
|
|
5745
6186
|
} else if (prop === "updateRun") {
|
|
5746
6187
|
const method = value;
|
|
5747
|
-
wrapped = (...args) =>
|
|
6188
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(
|
|
5748
6189
|
() => Reflect.apply(method, target, args),
|
|
5749
6190
|
{ arguments: args }
|
|
5750
6191
|
);
|
|
5751
6192
|
} else if (prop === "batchIngestRuns") {
|
|
5752
6193
|
const method = value;
|
|
5753
|
-
wrapped = (...args) =>
|
|
6194
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.batchIngestRuns.tracePromise(
|
|
5754
6195
|
() => Reflect.apply(method, target, args),
|
|
5755
6196
|
{ arguments: args }
|
|
5756
6197
|
);
|
|
@@ -5766,13 +6207,13 @@ function publishRunUpdate(runTree) {
|
|
|
5766
6207
|
return;
|
|
5767
6208
|
}
|
|
5768
6209
|
try {
|
|
5769
|
-
void
|
|
6210
|
+
void _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
5770
6211
|
arguments: [runTree.id, runTree]
|
|
5771
6212
|
}).catch((error) => {
|
|
5772
|
-
|
|
6213
|
+
_chunkQRHGVBKUjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5773
6214
|
});
|
|
5774
6215
|
} catch (error) {
|
|
5775
|
-
|
|
6216
|
+
_chunkQRHGVBKUjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5776
6217
|
}
|
|
5777
6218
|
}
|
|
5778
6219
|
|
|
@@ -5784,7 +6225,7 @@ var VitestContextManager = class {
|
|
|
5784
6225
|
*/
|
|
5785
6226
|
|
|
5786
6227
|
constructor() {
|
|
5787
|
-
this.contextStorage =
|
|
6228
|
+
this.contextStorage = _chunkMF7NU6BTjs.isomorph_default.newAsyncLocalStorage();
|
|
5788
6229
|
}
|
|
5789
6230
|
getCurrentContext() {
|
|
5790
6231
|
return this.contextStorage.getStore();
|
|
@@ -5825,7 +6266,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
|
|
|
5825
6266
|
if (this.activeFlushes.has(experimentId)) {
|
|
5826
6267
|
return this.activeFlushes.get(experimentId);
|
|
5827
6268
|
}
|
|
5828
|
-
const flushPromise =
|
|
6269
|
+
const flushPromise = _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, context.experiment, {
|
|
5829
6270
|
displaySummary: config.displaySummary
|
|
5830
6271
|
});
|
|
5831
6272
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -5923,7 +6364,7 @@ async function runTracedEval(args) {
|
|
|
5923
6364
|
}
|
|
5924
6365
|
if (testError) {
|
|
5925
6366
|
span.log({ scores: { pass: 0 } });
|
|
5926
|
-
|
|
6367
|
+
_chunkQRHGVBKUjs.logError.call(void 0, span, testError);
|
|
5927
6368
|
throw testError;
|
|
5928
6369
|
}
|
|
5929
6370
|
span.log({
|
|
@@ -5956,7 +6397,7 @@ function wrapTest(originalTest, config) {
|
|
|
5956
6397
|
const wrapped = function(name, configOrFn, maybeFn) {
|
|
5957
6398
|
const isEnhanced = typeof configOrFn !== "function";
|
|
5958
6399
|
const testConfig = isEnhanced ? configOrFn : void 0;
|
|
5959
|
-
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess',
|
|
6400
|
+
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _130 => _130.data]) && Array.isArray(testConfig.data)) {
|
|
5960
6401
|
const dataRecords = testConfig.data;
|
|
5961
6402
|
const testFn2 = maybeFn;
|
|
5962
6403
|
if (!testFn2) {
|
|
@@ -5994,7 +6435,7 @@ function wrapTest(originalTest, config) {
|
|
|
5994
6435
|
const registrationContext = getExperimentContext();
|
|
5995
6436
|
const testImplementation = async (vitestContext) => {
|
|
5996
6437
|
const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
|
|
5997
|
-
const experiment = _optionalChain([experimentContext, 'optionalAccess',
|
|
6438
|
+
const experiment = _optionalChain([experimentContext, 'optionalAccess', _131 => _131.experiment]);
|
|
5998
6439
|
if (config.onProgress) {
|
|
5999
6440
|
config.onProgress({ type: "test_start", testName: name });
|
|
6000
6441
|
}
|
|
@@ -6026,11 +6467,11 @@ function wrapTest(originalTest, config) {
|
|
|
6026
6467
|
const result = await runTracedEval({
|
|
6027
6468
|
experiment,
|
|
6028
6469
|
spanName: name,
|
|
6029
|
-
input: _optionalChain([testConfig, 'optionalAccess',
|
|
6030
|
-
expected: _optionalChain([testConfig, 'optionalAccess',
|
|
6031
|
-
metadata: _optionalChain([testConfig, 'optionalAccess',
|
|
6032
|
-
tags: _optionalChain([testConfig, 'optionalAccess',
|
|
6033
|
-
scorers: _optionalChain([testConfig, 'optionalAccess',
|
|
6470
|
+
input: _optionalChain([testConfig, 'optionalAccess', _132 => _132.input]),
|
|
6471
|
+
expected: _optionalChain([testConfig, 'optionalAccess', _133 => _133.expected]),
|
|
6472
|
+
metadata: _optionalChain([testConfig, 'optionalAccess', _134 => _134.metadata]),
|
|
6473
|
+
tags: _optionalChain([testConfig, 'optionalAccess', _135 => _135.tags]),
|
|
6474
|
+
scorers: _optionalChain([testConfig, 'optionalAccess', _136 => _136.scorers]),
|
|
6034
6475
|
fn: async () => {
|
|
6035
6476
|
if (testConfig && maybeFn) {
|
|
6036
6477
|
const params = {
|
|
@@ -6097,10 +6538,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
6097
6538
|
const getOrCreateContext = () => {
|
|
6098
6539
|
if (!context) {
|
|
6099
6540
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
6100
|
-
const experiment = config.projectId ?
|
|
6541
|
+
const experiment = config.projectId ? _chunkQRHGVBKUjs.initExperiment.call(void 0, {
|
|
6101
6542
|
projectId: config.projectId,
|
|
6102
6543
|
experiment: experimentName
|
|
6103
|
-
}) :
|
|
6544
|
+
}) : _chunkQRHGVBKUjs.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
6104
6545
|
experiment: experimentName
|
|
6105
6546
|
});
|
|
6106
6547
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -6145,8 +6586,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
6145
6586
|
config.onProgress({
|
|
6146
6587
|
type: "suite_complete",
|
|
6147
6588
|
suiteName,
|
|
6148
|
-
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
6149
|
-
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
6589
|
+
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _137 => _137.passed]), () => ( 0)),
|
|
6590
|
+
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _138 => _138.failed]), () => ( 0))
|
|
6150
6591
|
});
|
|
6151
6592
|
}
|
|
6152
6593
|
});
|
|
@@ -6208,7 +6649,7 @@ function wrapExpect(originalExpect) {
|
|
|
6208
6649
|
return originalExpect(value);
|
|
6209
6650
|
}
|
|
6210
6651
|
const assertion = originalExpect(value, message);
|
|
6211
|
-
const span =
|
|
6652
|
+
const span = _chunkQRHGVBKUjs.currentSpan.call(void 0, );
|
|
6212
6653
|
if (!span) {
|
|
6213
6654
|
return assertion;
|
|
6214
6655
|
}
|
|
@@ -6220,16 +6661,16 @@ function wrapExpect(originalExpect) {
|
|
|
6220
6661
|
|
|
6221
6662
|
// src/wrappers/shared/logging.ts
|
|
6222
6663
|
function logOutputs(outputs) {
|
|
6223
|
-
|
|
6664
|
+
_chunkQRHGVBKUjs.currentSpan.call(void 0, ).log({ output: outputs });
|
|
6224
6665
|
}
|
|
6225
6666
|
function logFeedback(feedback) {
|
|
6226
|
-
|
|
6667
|
+
_chunkQRHGVBKUjs.currentSpan.call(void 0, ).log({
|
|
6227
6668
|
scores: { [feedback.name]: feedback.score },
|
|
6228
6669
|
metadata: feedback.metadata
|
|
6229
6670
|
});
|
|
6230
6671
|
}
|
|
6231
6672
|
function getCurrentSpan() {
|
|
6232
|
-
return
|
|
6673
|
+
return _chunkQRHGVBKUjs.currentSpan.call(void 0, );
|
|
6233
6674
|
}
|
|
6234
6675
|
|
|
6235
6676
|
// src/wrappers/vitest/index.ts
|
|
@@ -6277,8 +6718,8 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
6277
6718
|
);
|
|
6278
6719
|
return;
|
|
6279
6720
|
}
|
|
6280
|
-
await
|
|
6281
|
-
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6721
|
+
await _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
6722
|
+
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _139 => _139.displaySummary]), () => ( config.displaySummary))
|
|
6282
6723
|
});
|
|
6283
6724
|
}
|
|
6284
6725
|
};
|
|
@@ -6292,7 +6733,7 @@ function initNodeTestSuite(config) {
|
|
|
6292
6733
|
return experiment;
|
|
6293
6734
|
}
|
|
6294
6735
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
6295
|
-
experiment =
|
|
6736
|
+
experiment = _chunkQRHGVBKUjs.initExperiment.call(void 0, config.projectName, {
|
|
6296
6737
|
experiment: experimentName
|
|
6297
6738
|
});
|
|
6298
6739
|
return experiment;
|
|
@@ -6341,7 +6782,7 @@ function initNodeTestSuite(config) {
|
|
|
6341
6782
|
if (!experiment) {
|
|
6342
6783
|
return;
|
|
6343
6784
|
}
|
|
6344
|
-
await
|
|
6785
|
+
await _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, experiment, {
|
|
6345
6786
|
displaySummary: config.displaySummary
|
|
6346
6787
|
});
|
|
6347
6788
|
experiment = void 0;
|
|
@@ -6358,7 +6799,7 @@ function initNodeTestSuite(config) {
|
|
|
6358
6799
|
|
|
6359
6800
|
// src/graph-framework.ts
|
|
6360
6801
|
var graph_framework_exports = {};
|
|
6361
|
-
|
|
6802
|
+
_chunkMF7NU6BTjs.__export.call(void 0, graph_framework_exports, {
|
|
6362
6803
|
AggregatorNode: () => AggregatorNode,
|
|
6363
6804
|
GateNode: () => GateNode,
|
|
6364
6805
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -6432,7 +6873,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6432
6873
|
};
|
|
6433
6874
|
}
|
|
6434
6875
|
resolveNode(node) {
|
|
6435
|
-
if (node instanceof
|
|
6876
|
+
if (node instanceof _chunkQRHGVBKUjs.Prompt) {
|
|
6436
6877
|
const cached = this.nodeLikeNodes.get(node);
|
|
6437
6878
|
if (cached) {
|
|
6438
6879
|
return [cached, []];
|
|
@@ -6482,7 +6923,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6482
6923
|
// }
|
|
6483
6924
|
// Helper to generate node IDs
|
|
6484
6925
|
generateId(name) {
|
|
6485
|
-
const uuid =
|
|
6926
|
+
const uuid = _chunkQRHGVBKUjs.newId.call(void 0, );
|
|
6486
6927
|
if (name) {
|
|
6487
6928
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
6488
6929
|
} else {
|
|
@@ -7682,7 +8123,7 @@ function waterfall(tasks, callback) {
|
|
|
7682
8123
|
var waterfall$1 = awaitify(waterfall);
|
|
7683
8124
|
|
|
7684
8125
|
// src/trace.ts
|
|
7685
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
8126
|
+
var SpanFetcher = class _SpanFetcher extends _chunkQRHGVBKUjs.ObjectFetcher {
|
|
7686
8127
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
7687
8128
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
7688
8129
|
rootSpanId,
|
|
@@ -7819,7 +8260,7 @@ var CachedSpanFetcher = (_class5 = class {
|
|
|
7819
8260
|
async fetchSpans(spanType) {
|
|
7820
8261
|
const spans = await this.fetchFn(spanType, false);
|
|
7821
8262
|
for (const span of spans) {
|
|
7822
|
-
const type = _nullishCoalesce(_optionalChain([span, 'access',
|
|
8263
|
+
const type = _nullishCoalesce(_optionalChain([span, 'access', _140 => _140.span_attributes, 'optionalAccess', _141 => _141.type]), () => ( ""));
|
|
7823
8264
|
const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
|
|
7824
8265
|
existing.push(span);
|
|
7825
8266
|
this.spanCache.set(type, existing);
|
|
@@ -7902,11 +8343,11 @@ var LocalTrace = (_class6 = class {
|
|
|
7902
8343
|
const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
|
|
7903
8344
|
if (cachedSpans && cachedSpans.length > 0) {
|
|
7904
8345
|
let spans = includeScorers ? cachedSpans : cachedSpans.filter(
|
|
7905
|
-
(span) => _optionalChain([span, 'access',
|
|
8346
|
+
(span) => _optionalChain([span, 'access', _142 => _142.span_attributes, 'optionalAccess', _143 => _143.purpose]) !== "scorer"
|
|
7906
8347
|
);
|
|
7907
8348
|
if (spanType && spanType.length > 0) {
|
|
7908
8349
|
spans = spans.filter(
|
|
7909
|
-
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access',
|
|
8350
|
+
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _144 => _144.span_attributes, 'optionalAccess', _145 => _145.type]), () => ( "")))
|
|
7910
8351
|
);
|
|
7911
8352
|
}
|
|
7912
8353
|
return spans.map((span) => ({
|
|
@@ -7931,7 +8372,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7931
8372
|
* Calls the API with the project_default preprocessor (which falls back to "thread").
|
|
7932
8373
|
*/
|
|
7933
8374
|
async getThread(options) {
|
|
7934
|
-
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8375
|
+
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.preprocessor]), () => ( "project_default"));
|
|
7935
8376
|
if (!this.threadCache.has(cacheKey)) {
|
|
7936
8377
|
const promise = this.fetchThread(options);
|
|
7937
8378
|
this.threadCache.set(cacheKey, promise);
|
|
@@ -7942,7 +8383,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7942
8383
|
await this.ensureSpansReady();
|
|
7943
8384
|
await this.state.login({});
|
|
7944
8385
|
const result = await invoke({
|
|
7945
|
-
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8386
|
+
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _147 => _147.preprocessor]), () => ( "project_default")),
|
|
7946
8387
|
functionType: "preprocessor",
|
|
7947
8388
|
input: {
|
|
7948
8389
|
trace_ref: {
|
|
@@ -7999,20 +8440,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
7999
8440
|
prompt: _v3.z.string()
|
|
8000
8441
|
}),
|
|
8001
8442
|
_v3.z.object({
|
|
8002
|
-
messages: _v3.z.array(
|
|
8443
|
+
messages: _v3.z.array(_chunkQRHGVBKUjs.ChatCompletionMessageParam)
|
|
8003
8444
|
})
|
|
8004
8445
|
]);
|
|
8005
8446
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
8006
8447
|
_v3.z.object({
|
|
8007
8448
|
model: _v3.z.string(),
|
|
8008
|
-
params:
|
|
8449
|
+
params: _chunkQRHGVBKUjs.ModelParams.optional(),
|
|
8009
8450
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
8010
8451
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
8011
8452
|
})
|
|
8012
8453
|
);
|
|
8013
8454
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
8014
8455
|
_v3.z.object({
|
|
8015
|
-
tools: _v3.z.array(
|
|
8456
|
+
tools: _v3.z.array(_chunkQRHGVBKUjs.ToolFunctionDefinition).optional()
|
|
8016
8457
|
})
|
|
8017
8458
|
);
|
|
8018
8459
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -8060,7 +8501,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
8060
8501
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
8061
8502
|
return parameters;
|
|
8062
8503
|
}
|
|
8063
|
-
if (
|
|
8504
|
+
if (_chunkQRHGVBKUjs.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
8064
8505
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
8065
8506
|
...resolvedSchema.data,
|
|
8066
8507
|
...parameters
|
|
@@ -8082,14 +8523,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
8082
8523
|
const value = parameters[name];
|
|
8083
8524
|
try {
|
|
8084
8525
|
if ("type" in schema && schema.type === "prompt") {
|
|
8085
|
-
const promptData = value ?
|
|
8526
|
+
const promptData = value ? _chunkQRHGVBKUjs.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
8086
8527
|
schema.default,
|
|
8087
8528
|
schema.default.tools
|
|
8088
8529
|
) : void 0;
|
|
8089
8530
|
if (!promptData) {
|
|
8090
8531
|
throw new Error(`Parameter '${name}' is required`);
|
|
8091
8532
|
}
|
|
8092
|
-
return [name,
|
|
8533
|
+
return [name, _chunkQRHGVBKUjs.Prompt.fromPromptData(name, promptData)];
|
|
8093
8534
|
} else if ("type" in schema && schema.type === "model") {
|
|
8094
8535
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
8095
8536
|
if (model === void 0) {
|
|
@@ -8118,10 +8559,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
|
|
|
8118
8559
|
const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
|
|
8119
8560
|
const validate = ajv.compile(schema);
|
|
8120
8561
|
if (!validate(parameters)) {
|
|
8121
|
-
const errorMessages = _optionalChain([validate, 'access',
|
|
8562
|
+
const errorMessages = _optionalChain([validate, 'access', _148 => _148.errors, 'optionalAccess', _149 => _149.map, 'call', _150 => _150((err) => {
|
|
8122
8563
|
const path = err.instancePath || "root";
|
|
8123
8564
|
return `${path}: ${err.message}`;
|
|
8124
|
-
}), 'access',
|
|
8565
|
+
}), 'access', _151 => _151.join, 'call', _152 => _152(", ")]);
|
|
8125
8566
|
throw Error(`Invalid parameters: ${errorMessages}`);
|
|
8126
8567
|
}
|
|
8127
8568
|
return rehydrateRemoteParameters(parameters, schema);
|
|
@@ -8140,7 +8581,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
8140
8581
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
8141
8582
|
return [
|
|
8142
8583
|
name,
|
|
8143
|
-
|
|
8584
|
+
_chunkQRHGVBKUjs.Prompt.fromPromptData(name, _chunkQRHGVBKUjs.PromptData.parse(value))
|
|
8144
8585
|
];
|
|
8145
8586
|
}
|
|
8146
8587
|
return [name, value];
|
|
@@ -8178,7 +8619,7 @@ var EvalResultWithSummary = class {
|
|
|
8178
8619
|
async function getPersistedBaseExperimentId(experiment) {
|
|
8179
8620
|
try {
|
|
8180
8621
|
return await experiment._getBaseExperimentId();
|
|
8181
|
-
} catch (
|
|
8622
|
+
} catch (e9) {
|
|
8182
8623
|
return void 0;
|
|
8183
8624
|
}
|
|
8184
8625
|
}
|
|
@@ -8190,7 +8631,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
8190
8631
|
return out;
|
|
8191
8632
|
}
|
|
8192
8633
|
function initExperiment2(state, options = {}) {
|
|
8193
|
-
return
|
|
8634
|
+
return _chunkQRHGVBKUjs.init.call(void 0, {
|
|
8194
8635
|
state,
|
|
8195
8636
|
...options,
|
|
8196
8637
|
setCurrent: false
|
|
@@ -8201,7 +8642,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
8201
8642
|
return void 0;
|
|
8202
8643
|
}
|
|
8203
8644
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
8204
|
-
if (!
|
|
8645
|
+
if (!_chunkQRHGVBKUjs.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
8205
8646
|
return void 0;
|
|
8206
8647
|
}
|
|
8207
8648
|
if (resolvedParameters.id === void 0) {
|
|
@@ -8237,10 +8678,10 @@ globalThis._evals = {
|
|
|
8237
8678
|
reporters: {}
|
|
8238
8679
|
};
|
|
8239
8680
|
function _initializeSpanContext() {
|
|
8240
|
-
globalThis._spanContext = { currentSpan:
|
|
8681
|
+
globalThis._spanContext = { currentSpan: _chunkQRHGVBKUjs.currentSpan, withCurrent: _chunkQRHGVBKUjs.withCurrent, startSpan: _chunkQRHGVBKUjs.startSpan, NOOP_SPAN: _chunkQRHGVBKUjs.NOOP_SPAN };
|
|
8241
8682
|
}
|
|
8242
8683
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
8243
|
-
const options =
|
|
8684
|
+
const options = _chunkQRHGVBKUjs.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
8244
8685
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
8245
8686
|
if (globalThis._evals.evaluators[evalName]) {
|
|
8246
8687
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -8291,7 +8732,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8291
8732
|
baseExperimentId: evaluator.baseExperimentId,
|
|
8292
8733
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
8293
8734
|
repoInfo: evaluator.repoInfo,
|
|
8294
|
-
dataset:
|
|
8735
|
+
dataset: _chunkQRHGVBKUjs.Dataset.isDataset(data) ? data : void 0,
|
|
8295
8736
|
parameters
|
|
8296
8737
|
});
|
|
8297
8738
|
if (experiment && typeof process !== "undefined" && globalThis.BRAINTRUST_CONTEXT_MANAGER !== void 0) {
|
|
@@ -8311,7 +8752,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8311
8752
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
8312
8753
|
let ret;
|
|
8313
8754
|
if (options.parent) {
|
|
8314
|
-
ret = await
|
|
8755
|
+
ret = await _chunkQRHGVBKUjs.withParent.call(void 0,
|
|
8315
8756
|
options.parent,
|
|
8316
8757
|
() => runEvaluator(
|
|
8317
8758
|
null,
|
|
@@ -8347,7 +8788,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8347
8788
|
if (experiment) {
|
|
8348
8789
|
await experiment.flush().catch(console.error);
|
|
8349
8790
|
} else if (options.parent) {
|
|
8350
|
-
await
|
|
8791
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
8351
8792
|
}
|
|
8352
8793
|
}
|
|
8353
8794
|
} finally {
|
|
@@ -8393,13 +8834,13 @@ function classifierName(classifier, classifier_idx) {
|
|
|
8393
8834
|
}
|
|
8394
8835
|
function buildSpanMetadata(results) {
|
|
8395
8836
|
return results.length === 1 ? results[0].metadata : results.reduce(
|
|
8396
|
-
(prev, s) =>
|
|
8837
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, { [s.name]: s.metadata }),
|
|
8397
8838
|
{}
|
|
8398
8839
|
);
|
|
8399
8840
|
}
|
|
8400
8841
|
function buildSpanScores(results) {
|
|
8401
8842
|
const scoresRecord = results.reduce(
|
|
8402
|
-
(prev, s) =>
|
|
8843
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, { [s.name]: s.score }),
|
|
8403
8844
|
{}
|
|
8404
8845
|
);
|
|
8405
8846
|
return { resultMetadata: buildSpanMetadata(results), scoresRecord };
|
|
@@ -8429,7 +8870,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
8429
8870
|
return failing;
|
|
8430
8871
|
}
|
|
8431
8872
|
function validateClassificationResult(value, scorerName2) {
|
|
8432
|
-
if (!(typeof value === "object" && value !== null && !
|
|
8873
|
+
if (!(typeof value === "object" && value !== null && !_chunkQRHGVBKUjs.isEmpty.call(void 0, value))) {
|
|
8433
8874
|
throw new Error(
|
|
8434
8875
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
8435
8876
|
);
|
|
@@ -8458,7 +8899,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
8458
8899
|
);
|
|
8459
8900
|
metadata[`${kind}_errors`] = errorMap;
|
|
8460
8901
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
8461
|
-
|
|
8902
|
+
_chunkQRHGVBKUjs.debugLogger.forState(state).warn(
|
|
8462
8903
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
8463
8904
|
failures.map((f) => f.error)
|
|
8464
8905
|
);
|
|
@@ -8492,7 +8933,7 @@ var defaultErrorScoreHandler = ({
|
|
|
8492
8933
|
};
|
|
8493
8934
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
8494
8935
|
if (enableCache) {
|
|
8495
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8936
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _153 => _153.spanCache, 'optionalAccess', _154 => _154.start, 'call', _155 => _155()]);
|
|
8496
8937
|
}
|
|
8497
8938
|
try {
|
|
8498
8939
|
if (typeof evaluator.data === "string") {
|
|
@@ -8513,7 +8954,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8513
8954
|
);
|
|
8514
8955
|
}
|
|
8515
8956
|
let name = dataResult.name;
|
|
8516
|
-
if (
|
|
8957
|
+
if (_chunkQRHGVBKUjs.isEmpty.call(void 0, name)) {
|
|
8517
8958
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
8518
8959
|
if (!baseExperiment) {
|
|
8519
8960
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -8547,7 +8988,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8547
8988
|
const experimentIdPromise = experiment ? (async () => {
|
|
8548
8989
|
try {
|
|
8549
8990
|
return await experiment.id;
|
|
8550
|
-
} catch (
|
|
8991
|
+
} catch (e10) {
|
|
8551
8992
|
return void 0;
|
|
8552
8993
|
}
|
|
8553
8994
|
})() : void 0;
|
|
@@ -8563,7 +9004,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8563
9004
|
if (cancelled) {
|
|
8564
9005
|
return;
|
|
8565
9006
|
}
|
|
8566
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
9007
|
+
const eventDataset = experiment ? experiment.dataset : _chunkQRHGVBKUjs.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
8567
9008
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
8568
9009
|
object_type: "dataset",
|
|
8569
9010
|
object_id: await eventDataset.id,
|
|
@@ -8571,8 +9012,8 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8571
9012
|
created: datum.created,
|
|
8572
9013
|
_xact_id: datum._xact_id
|
|
8573
9014
|
} : void 0;
|
|
8574
|
-
const parsedDatumOrigin =
|
|
8575
|
-
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess',
|
|
9015
|
+
const parsedDatumOrigin = _chunkQRHGVBKUjs.ObjectReference.safeParse(datum.origin);
|
|
9016
|
+
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _156 => _156.success]) ? parsedDatumOrigin.data : void 0)));
|
|
8576
9017
|
const baseEvent = {
|
|
8577
9018
|
name: "eval",
|
|
8578
9019
|
spanAttributes: {
|
|
@@ -8587,26 +9028,26 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8587
9028
|
}
|
|
8588
9029
|
};
|
|
8589
9030
|
const callback = async (rootSpan) => {
|
|
8590
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
9031
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
8591
9032
|
const ensureSpansFlushed = async () => {
|
|
8592
9033
|
if (experiment) {
|
|
8593
|
-
await
|
|
9034
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state: experiment.loggingState });
|
|
8594
9035
|
} else if (state) {
|
|
8595
|
-
await
|
|
9036
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state });
|
|
8596
9037
|
} else {
|
|
8597
|
-
await
|
|
9038
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, );
|
|
8598
9039
|
}
|
|
8599
9040
|
if (state) {
|
|
8600
9041
|
await state.flushOtel();
|
|
8601
9042
|
}
|
|
8602
9043
|
};
|
|
8603
9044
|
const parentStr = state.currentParent.getStore();
|
|
8604
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
9045
|
+
const parentComponents = typeof parentStr === "string" ? _chunkQRHGVBKUjs.SpanComponentsV4.fromStr(parentStr) : null;
|
|
8605
9046
|
const trace = state ? new LocalTrace({
|
|
8606
|
-
objectType: parentComponents ?
|
|
9047
|
+
objectType: parentComponents ? _chunkQRHGVBKUjs.spanObjectTypeV3ToTypedString.call(void 0,
|
|
8607
9048
|
parentComponents.data.object_type
|
|
8608
9049
|
) : "experiment",
|
|
8609
|
-
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async
|
|
9050
|
+
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _157 => _157.data, 'access', async _158 => _158.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
8610
9051
|
rootSpanId: rootSpan.rootSpanId,
|
|
8611
9052
|
ensureSpansFlushed,
|
|
8612
9053
|
state
|
|
@@ -8636,10 +9077,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8636
9077
|
span,
|
|
8637
9078
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
8638
9079
|
reportProgress: (event) => {
|
|
8639
|
-
_optionalChain([stream, 'optionalCall',
|
|
9080
|
+
_optionalChain([stream, 'optionalCall', _159 => _159({
|
|
8640
9081
|
...event,
|
|
8641
9082
|
id: rootSpan.id,
|
|
8642
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
9083
|
+
origin: _optionalChain([baseEvent, 'access', _160 => _160.event, 'optionalAccess', _161 => _161.origin]),
|
|
8643
9084
|
name: evaluator.evalName,
|
|
8644
9085
|
object_type: "task"
|
|
8645
9086
|
})]);
|
|
@@ -8678,7 +9119,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8678
9119
|
trace
|
|
8679
9120
|
};
|
|
8680
9121
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
8681
|
-
const propagatedEvent =
|
|
9122
|
+
const propagatedEvent = _chunkQRHGVBKUjs.makeScorerPropagatedEvent.call(void 0,
|
|
8682
9123
|
await rootSpan.export()
|
|
8683
9124
|
);
|
|
8684
9125
|
const getOtherFields = (s) => {
|
|
@@ -8701,14 +9142,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8701
9142
|
if (scoreValue === null) return null;
|
|
8702
9143
|
if (Array.isArray(scoreValue)) {
|
|
8703
9144
|
for (const s of scoreValue) {
|
|
8704
|
-
if (!(typeof s === "object" && !
|
|
9145
|
+
if (!(typeof s === "object" && !_chunkQRHGVBKUjs.isEmpty.call(void 0, s))) {
|
|
8705
9146
|
throw new Error(
|
|
8706
9147
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(s)}`
|
|
8707
9148
|
);
|
|
8708
9149
|
}
|
|
8709
9150
|
}
|
|
8710
9151
|
}
|
|
8711
|
-
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !
|
|
9152
|
+
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !_chunkQRHGVBKUjs.isEmpty.call(void 0, scoreValue) ? [scoreValue] : [
|
|
8712
9153
|
{
|
|
8713
9154
|
name: scorerNames[score_idx],
|
|
8714
9155
|
score: scoreValue
|
|
@@ -8716,7 +9157,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8716
9157
|
];
|
|
8717
9158
|
const { resultMetadata, scoresRecord } = buildSpanScores(results);
|
|
8718
9159
|
const resultOutput = results.length === 1 ? getOtherFields(results[0]) : results.reduce(
|
|
8719
|
-
(prev, s) =>
|
|
9160
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, {
|
|
8720
9161
|
[s.name]: getOtherFields(s)
|
|
8721
9162
|
}),
|
|
8722
9163
|
{}
|
|
@@ -8751,7 +9192,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8751
9192
|
)
|
|
8752
9193
|
);
|
|
8753
9194
|
const resultOutput = rawResults.length === 1 ? toClassificationItem(rawResults[0]) : rawResults.reduce(
|
|
8754
|
-
(prev, r) =>
|
|
9195
|
+
(prev, r) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, {
|
|
8755
9196
|
[r.name]: toClassificationItem(r)
|
|
8756
9197
|
}),
|
|
8757
9198
|
{}
|
|
@@ -8803,7 +9244,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8803
9244
|
evaluator.state
|
|
8804
9245
|
);
|
|
8805
9246
|
} catch (e) {
|
|
8806
|
-
|
|
9247
|
+
_chunkQRHGVBKUjs.logError.call(void 0, rootSpan, e);
|
|
8807
9248
|
error = e;
|
|
8808
9249
|
} finally {
|
|
8809
9250
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -8827,7 +9268,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8827
9268
|
tags: tags.length ? tags : void 0,
|
|
8828
9269
|
metadata,
|
|
8829
9270
|
error,
|
|
8830
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
9271
|
+
origin: _optionalChain([baseEvent, 'access', _162 => _162.event, 'optionalAccess', _163 => _163.origin])
|
|
8831
9272
|
};
|
|
8832
9273
|
collectedResults.push({
|
|
8833
9274
|
...baseResult,
|
|
@@ -8837,7 +9278,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8837
9278
|
}
|
|
8838
9279
|
};
|
|
8839
9280
|
if (!experiment) {
|
|
8840
|
-
return await
|
|
9281
|
+
return await _chunkQRHGVBKUjs.traced.call(void 0, callback, {
|
|
8841
9282
|
...baseEvent,
|
|
8842
9283
|
state: evaluator.state
|
|
8843
9284
|
});
|
|
@@ -8867,7 +9308,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8867
9308
|
break;
|
|
8868
9309
|
}
|
|
8869
9310
|
scheduledTrials++;
|
|
8870
|
-
_optionalChain([progressReporter, 'access',
|
|
9311
|
+
_optionalChain([progressReporter, 'access', _164 => _164.setTotal, 'optionalCall', _165 => _165(evaluator.evalName, scheduledTrials)]);
|
|
8871
9312
|
q.pushAsync({ datum, trialIndex }).catch((e) => {
|
|
8872
9313
|
if (queueErrors.length < 5) {
|
|
8873
9314
|
queueErrors.push(e);
|
|
@@ -8891,7 +9332,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8891
9332
|
const cancel = async () => {
|
|
8892
9333
|
await new Promise((_, reject2) => {
|
|
8893
9334
|
if (cancelled) {
|
|
8894
|
-
reject2(new (0,
|
|
9335
|
+
reject2(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator already cancelled"));
|
|
8895
9336
|
return;
|
|
8896
9337
|
}
|
|
8897
9338
|
const rejectOnce = (error) => {
|
|
@@ -8904,12 +9345,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8904
9345
|
};
|
|
8905
9346
|
if (evaluator.timeout) {
|
|
8906
9347
|
timeoutId = setTimeout(() => {
|
|
8907
|
-
rejectOnce(new (0,
|
|
9348
|
+
rejectOnce(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator timed out"));
|
|
8908
9349
|
}, evaluator.timeout);
|
|
8909
9350
|
}
|
|
8910
9351
|
if (evaluator.signal) {
|
|
8911
9352
|
abortHandler = () => {
|
|
8912
|
-
rejectOnce(new (0,
|
|
9353
|
+
rejectOnce(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator aborted"));
|
|
8913
9354
|
};
|
|
8914
9355
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
8915
9356
|
}
|
|
@@ -8932,9 +9373,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8932
9373
|
}
|
|
8933
9374
|
} catch (e) {
|
|
8934
9375
|
q.kill();
|
|
8935
|
-
if (e instanceof
|
|
8936
|
-
if (
|
|
8937
|
-
|
|
9376
|
+
if (e instanceof _chunkQRHGVBKUjs.InternalAbortError) {
|
|
9377
|
+
if (_chunkMF7NU6BTjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
9378
|
+
_chunkQRHGVBKUjs.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
8938
9379
|
}
|
|
8939
9380
|
}
|
|
8940
9381
|
throw e;
|
|
@@ -8959,9 +9400,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8959
9400
|
);
|
|
8960
9401
|
} finally {
|
|
8961
9402
|
if (enableCache) {
|
|
8962
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8963
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
8964
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
9403
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _166 => _166.spanCache]);
|
|
9404
|
+
_optionalChain([spanCache, 'optionalAccess', _167 => _167.dispose, 'call', _168 => _168()]);
|
|
9405
|
+
_optionalChain([spanCache, 'optionalAccess', _169 => _169.stop, 'call', _170 => _170()]);
|
|
8965
9406
|
}
|
|
8966
9407
|
}
|
|
8967
9408
|
}
|
|
@@ -9054,25 +9495,25 @@ var defaultReporter = {
|
|
|
9054
9495
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
9055
9496
|
}
|
|
9056
9497
|
if (jsonl) {
|
|
9057
|
-
|
|
9498
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(JSON.stringify(summary));
|
|
9058
9499
|
} else {
|
|
9059
|
-
|
|
9060
|
-
|
|
9500
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("Experiment summary");
|
|
9501
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("==================");
|
|
9061
9502
|
if (summary.comparisonExperimentName) {
|
|
9062
|
-
|
|
9503
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9063
9504
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
9064
9505
|
);
|
|
9065
|
-
|
|
9506
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("");
|
|
9066
9507
|
}
|
|
9067
9508
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
9068
9509
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
9069
9510
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
9070
9511
|
if (hasScores || hasMetrics) {
|
|
9071
9512
|
if (hasComparison) {
|
|
9072
|
-
|
|
9513
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9073
9514
|
"Name Value Change Improvements Regressions"
|
|
9074
9515
|
);
|
|
9075
|
-
|
|
9516
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9076
9517
|
"----------------------------------------------------------------"
|
|
9077
9518
|
);
|
|
9078
9519
|
}
|
|
@@ -9081,18 +9522,18 @@ var defaultReporter = {
|
|
|
9081
9522
|
const scoreValue = `${scorePercent}%`;
|
|
9082
9523
|
if (hasComparison) {
|
|
9083
9524
|
let diffString = "-";
|
|
9084
|
-
if (!
|
|
9525
|
+
if (!_chunkQRHGVBKUjs.isEmpty.call(void 0, score.diff)) {
|
|
9085
9526
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
9086
9527
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
9087
9528
|
diffString = `${diffSign}${diffPercent}%`;
|
|
9088
9529
|
}
|
|
9089
9530
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
9090
9531
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
9091
|
-
|
|
9532
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9092
9533
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
9093
9534
|
);
|
|
9094
9535
|
} else {
|
|
9095
|
-
|
|
9536
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
9096
9537
|
}
|
|
9097
9538
|
}
|
|
9098
9539
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -9101,30 +9542,30 @@ var defaultReporter = {
|
|
|
9101
9542
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
9102
9543
|
if (hasComparison) {
|
|
9103
9544
|
let diffString = "-";
|
|
9104
|
-
if (!
|
|
9545
|
+
if (!_chunkQRHGVBKUjs.isEmpty.call(void 0, metric.diff)) {
|
|
9105
9546
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
9106
9547
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
9107
9548
|
diffString = `${diffSign}${diffPercent}%`;
|
|
9108
9549
|
}
|
|
9109
9550
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
9110
9551
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
9111
|
-
|
|
9552
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9112
9553
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
9113
9554
|
);
|
|
9114
9555
|
} else {
|
|
9115
|
-
|
|
9556
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9116
9557
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
9117
9558
|
);
|
|
9118
9559
|
}
|
|
9119
9560
|
}
|
|
9120
9561
|
}
|
|
9121
9562
|
if (summary.experimentUrl) {
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9563
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("");
|
|
9564
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
9565
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
9125
9566
|
}
|
|
9126
9567
|
}
|
|
9127
|
-
|
|
9568
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("");
|
|
9128
9569
|
return failingResults.length === 0;
|
|
9129
9570
|
},
|
|
9130
9571
|
async reportRun(evalReports) {
|
|
@@ -9144,7 +9585,7 @@ function agentAssertionScorer(callback, options = {}) {
|
|
|
9144
9585
|
});
|
|
9145
9586
|
const resources = {};
|
|
9146
9587
|
if (assertions.some((assertion) => assertion.requiresTrace)) {
|
|
9147
|
-
resources.spans = await _optionalChain([args, 'access',
|
|
9588
|
+
resources.spans = await _optionalChain([args, 'access', _171 => _171.trace, 'optionalAccess', _172 => _172.getSpans, 'call', _173 => _173({ spanType: ["tool"] })]);
|
|
9148
9589
|
}
|
|
9149
9590
|
const results = await Promise.all(
|
|
9150
9591
|
assertions.map(async (assertion) => {
|
|
@@ -9302,7 +9743,7 @@ async function validateSchema(schema, value) {
|
|
|
9302
9743
|
}
|
|
9303
9744
|
}
|
|
9304
9745
|
function toolCalls(spans) {
|
|
9305
|
-
return spans.filter((span) => _optionalChain([span, 'access',
|
|
9746
|
+
return spans.filter((span) => _optionalChain([span, 'access', _174 => _174.span_attributes, 'optionalAccess', _175 => _175.type]) === "tool");
|
|
9306
9747
|
}
|
|
9307
9748
|
function matchingToolCalls(spans, toolName, options) {
|
|
9308
9749
|
return toolCalls(spans).filter((span) => {
|
|
@@ -9320,17 +9761,17 @@ function matchingToolCalls(spans, toolName, options) {
|
|
|
9320
9761
|
});
|
|
9321
9762
|
}
|
|
9322
9763
|
function getToolName(span) {
|
|
9323
|
-
const spanName = [_optionalChain([span, 'access',
|
|
9324
|
-
if (_optionalChain([spanName, 'optionalAccess',
|
|
9764
|
+
const spanName = [_optionalChain([span, 'access', _176 => _176.span_attributes, 'optionalAccess', _177 => _177.name]), span.name].map(normalizeToolName).find((value) => value !== void 0);
|
|
9765
|
+
if (_optionalChain([spanName, 'optionalAccess', _178 => _178.includes, 'call', _179 => _179("/")])) {
|
|
9325
9766
|
return spanName;
|
|
9326
9767
|
}
|
|
9327
9768
|
const metadataName = [
|
|
9328
|
-
_optionalChain([span, 'access',
|
|
9329
|
-
_optionalChain([span, 'access',
|
|
9769
|
+
_optionalChain([span, 'access', _180 => _180.metadata, 'optionalAccess', _181 => _181.tool_name]),
|
|
9770
|
+
_optionalChain([span, 'access', _182 => _182.metadata, 'optionalAccess', _183 => _183["gen_ai.tool.name"]])
|
|
9330
9771
|
].map(normalizeToolName).find((value) => value !== void 0);
|
|
9331
9772
|
const mcpServer = [
|
|
9332
|
-
_optionalChain([span, 'access',
|
|
9333
|
-
_optionalChain([span, 'access',
|
|
9773
|
+
_optionalChain([span, 'access', _184 => _184.metadata, 'optionalAccess', _185 => _185["mcp.server"]]),
|
|
9774
|
+
_optionalChain([span, 'access', _186 => _186.metadata, 'optionalAccess', _187 => _187["openai_codex.mcp.server"]])
|
|
9334
9775
|
].find((value) => typeof value === "string" && value !== "");
|
|
9335
9776
|
if (metadataName && mcpServer) {
|
|
9336
9777
|
return `${mcpServer}/${metadataName}`;
|
|
@@ -9400,7 +9841,7 @@ function formatValue(value) {
|
|
|
9400
9841
|
return serialized;
|
|
9401
9842
|
}
|
|
9402
9843
|
return formatValueWithUndefined(value, /* @__PURE__ */ new Set());
|
|
9403
|
-
} catch (
|
|
9844
|
+
} catch (e11) {
|
|
9404
9845
|
return String(value);
|
|
9405
9846
|
}
|
|
9406
9847
|
}
|
|
@@ -9559,7 +10000,7 @@ var Project2 = (_class7 = class {
|
|
|
9559
10000
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
9560
10001
|
return;
|
|
9561
10002
|
}
|
|
9562
|
-
await
|
|
10003
|
+
await _chunkQRHGVBKUjs.login.call(void 0, );
|
|
9563
10004
|
const projectMap = new ProjectNameIdMap();
|
|
9564
10005
|
const functionDefinitions = [];
|
|
9565
10006
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -9573,7 +10014,7 @@ var Project2 = (_class7 = class {
|
|
|
9573
10014
|
functionDefinitions.push(functionDefinition);
|
|
9574
10015
|
}
|
|
9575
10016
|
}
|
|
9576
|
-
await
|
|
10017
|
+
await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
9577
10018
|
functions: functionDefinitions
|
|
9578
10019
|
});
|
|
9579
10020
|
}
|
|
@@ -9592,12 +10033,12 @@ var ToolBuilder = (_class8 = class {
|
|
|
9592
10033
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
9593
10034
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
9594
10035
|
if (resolvedName.trim().length === 0) {
|
|
9595
|
-
resolvedName = `Tool ${
|
|
10036
|
+
resolvedName = `Tool ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9596
10037
|
}
|
|
9597
10038
|
const tool = new CodeFunction(this.project, {
|
|
9598
10039
|
handler,
|
|
9599
10040
|
name: resolvedName,
|
|
9600
|
-
slug: _nullishCoalesce(slug, () => (
|
|
10041
|
+
slug: _nullishCoalesce(slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
9601
10042
|
type: "tool",
|
|
9602
10043
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
9603
10044
|
parameters,
|
|
@@ -9622,9 +10063,9 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9622
10063
|
resolvedName = opts.handler.name;
|
|
9623
10064
|
}
|
|
9624
10065
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9625
|
-
resolvedName = `Scorer ${
|
|
10066
|
+
resolvedName = `Scorer ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9626
10067
|
}
|
|
9627
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10068
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9628
10069
|
if ("handler" in opts) {
|
|
9629
10070
|
const scorer = new CodeFunction(this.project, {
|
|
9630
10071
|
...opts,
|
|
@@ -9679,9 +10120,9 @@ var ClassifierBuilder = (_class10 = class {
|
|
|
9679
10120
|
this.taskCounter++;
|
|
9680
10121
|
let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
|
|
9681
10122
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9682
|
-
resolvedName = `Classifier ${
|
|
10123
|
+
resolvedName = `Classifier ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9683
10124
|
}
|
|
9684
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10125
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9685
10126
|
const classifier = new CodeFunction(this.project, {
|
|
9686
10127
|
...opts,
|
|
9687
10128
|
name: resolvedName,
|
|
@@ -9810,18 +10251,18 @@ var PromptBuilder = class {
|
|
|
9810
10251
|
rawTools.push(tool);
|
|
9811
10252
|
}
|
|
9812
10253
|
}
|
|
9813
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10254
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9814
10255
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
9815
10256
|
const promptRow = {
|
|
9816
10257
|
id: opts.id,
|
|
9817
|
-
_xact_id: opts.version ?
|
|
10258
|
+
_xact_id: opts.version ? _chunkQRHGVBKUjs.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
9818
10259
|
name: opts.name,
|
|
9819
10260
|
slug,
|
|
9820
10261
|
prompt_data: promptData,
|
|
9821
10262
|
tags: opts.tags,
|
|
9822
10263
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
9823
10264
|
};
|
|
9824
|
-
const prompt = new (0,
|
|
10265
|
+
const prompt = new (0, _chunkQRHGVBKUjs.Prompt)(
|
|
9825
10266
|
promptRow,
|
|
9826
10267
|
{},
|
|
9827
10268
|
// It doesn't make sense to specify defaults here.
|
|
@@ -9876,7 +10317,7 @@ var ParametersBuilder = class {
|
|
|
9876
10317
|
}
|
|
9877
10318
|
|
|
9878
10319
|
create(opts) {
|
|
9879
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10320
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9880
10321
|
const codeParameters = new CodeParameters(this.project, {
|
|
9881
10322
|
name: opts.name,
|
|
9882
10323
|
slug,
|
|
@@ -9915,7 +10356,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
9915
10356
|
required.push(name);
|
|
9916
10357
|
}
|
|
9917
10358
|
} else {
|
|
9918
|
-
const schemaObj =
|
|
10359
|
+
const schemaObj = _chunkQRHGVBKUjs.zodToJsonSchema.call(void 0, value);
|
|
9919
10360
|
properties[name] = schemaObj;
|
|
9920
10361
|
if (!("default" in schemaObj)) {
|
|
9921
10362
|
required.push(name);
|
|
@@ -9944,11 +10385,11 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9944
10385
|
__init23() {this.idToName = {}}
|
|
9945
10386
|
async getId(projectName) {
|
|
9946
10387
|
if (!(projectName in this.nameToId)) {
|
|
9947
|
-
const response = await
|
|
10388
|
+
const response = await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
9948
10389
|
project_name: projectName
|
|
9949
10390
|
});
|
|
9950
10391
|
const result = _v3.z.object({
|
|
9951
|
-
project:
|
|
10392
|
+
project: _chunkQRHGVBKUjs.Project
|
|
9952
10393
|
}).parse(response);
|
|
9953
10394
|
const projectId = result.project.id;
|
|
9954
10395
|
this.nameToId[projectName] = projectId;
|
|
@@ -9958,10 +10399,10 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9958
10399
|
}
|
|
9959
10400
|
async getName(projectId) {
|
|
9960
10401
|
if (!(projectId in this.idToName)) {
|
|
9961
|
-
const response = await
|
|
10402
|
+
const response = await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
9962
10403
|
id: projectId
|
|
9963
10404
|
});
|
|
9964
|
-
const result = _v3.z.array(
|
|
10405
|
+
const result = _v3.z.array(_chunkQRHGVBKUjs.Project).nonempty().parse(response);
|
|
9965
10406
|
const projectName = result[0].name;
|
|
9966
10407
|
this.idToName[projectId] = projectName;
|
|
9967
10408
|
this.nameToId[projectName] = projectId;
|
|
@@ -9981,16 +10422,16 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9981
10422
|
var evalBodySchema = _v3.z.object({
|
|
9982
10423
|
name: _v3.z.string(),
|
|
9983
10424
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
9984
|
-
data:
|
|
10425
|
+
data: _chunkQRHGVBKUjs.RunEval.shape.data,
|
|
9985
10426
|
scores: _v3.z.array(
|
|
9986
10427
|
_v3.z.object({
|
|
9987
|
-
function_id:
|
|
10428
|
+
function_id: _chunkQRHGVBKUjs.FunctionId,
|
|
9988
10429
|
name: _v3.z.string()
|
|
9989
10430
|
})
|
|
9990
10431
|
).nullish(),
|
|
9991
10432
|
experiment_name: _v3.z.string().nullish(),
|
|
9992
10433
|
project_id: _v3.z.string().nullish(),
|
|
9993
|
-
parent:
|
|
10434
|
+
parent: _chunkQRHGVBKUjs.InvokeParent.optional(),
|
|
9994
10435
|
stream: _v3.z.boolean().optional()
|
|
9995
10436
|
});
|
|
9996
10437
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -9998,7 +10439,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
9998
10439
|
_v3.z.union([
|
|
9999
10440
|
_v3.z.object({
|
|
10000
10441
|
type: _v3.z.literal("prompt"),
|
|
10001
|
-
default:
|
|
10442
|
+
default: _chunkQRHGVBKUjs.PromptData.optional(),
|
|
10002
10443
|
description: _v3.z.string().optional()
|
|
10003
10444
|
}),
|
|
10004
10445
|
_v3.z.object({
|
|
@@ -10054,7 +10495,13 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
10054
10495
|
);
|
|
10055
10496
|
|
|
10056
10497
|
// src/node/index.ts
|
|
10057
|
-
|
|
10498
|
+
_chunkQRHGVBKUjs.configureNode.call(void 0, );
|
|
10499
|
+
|
|
10500
|
+
|
|
10501
|
+
|
|
10502
|
+
|
|
10503
|
+
|
|
10504
|
+
|
|
10058
10505
|
|
|
10059
10506
|
|
|
10060
10507
|
|
|
@@ -10225,4 +10672,4 @@ _chunkGSIDVFE6js.configureNode.call(void 0, );
|
|
|
10225
10672
|
|
|
10226
10673
|
|
|
10227
10674
|
|
|
10228
|
-
exports.Attachment =
|
|
10675
|
+
exports.Attachment = _chunkQRHGVBKUjs.Attachment; exports.AttachmentReference = _chunkQRHGVBKUjs.AttachmentReference; exports.BAGGAGE_HEADER = _chunkQRHGVBKUjs.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkQRHGVBKUjs.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkQRHGVBKUjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkQRHGVBKUjs.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkQRHGVBKUjs.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = _chunkQRHGVBKUjs.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkQRHGVBKUjs.BraintrustObservabilityExporter; exports.BraintrustState = _chunkQRHGVBKUjs.BraintrustState; exports.BraintrustStream = _chunkQRHGVBKUjs.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkQRHGVBKUjs.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkQRHGVBKUjs.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkQRHGVBKUjs.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkQRHGVBKUjs.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = _chunkQRHGVBKUjs.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkQRHGVBKUjs.Experiment; exports.ExternalAttachment = _chunkQRHGVBKUjs.ExternalAttachment; exports.FailedHTTPResponse = _chunkQRHGVBKUjs.FailedHTTPResponse; exports.IDGenerator = _chunkQRHGVBKUjs.IDGenerator; exports.JSONAttachment = _chunkQRHGVBKUjs.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkQRHGVBKUjs.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkQRHGVBKUjs.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkQRHGVBKUjs.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkQRHGVBKUjs.Logger; exports.LoginInvalidOrgError = _chunkQRHGVBKUjs.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkQRHGVBKUjs.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkQRHGVBKUjs.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkQRHGVBKUjs.NoopSpan; exports.OTELIDGenerator = _chunkQRHGVBKUjs.OTELIDGenerator; exports.ObjectFetcher = _chunkQRHGVBKUjs.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkQRHGVBKUjs.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkQRHGVBKUjs.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkQRHGVBKUjs.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkQRHGVBKUjs.SpanImpl; exports.TRACEPARENT_HEADER = _chunkQRHGVBKUjs.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkQRHGVBKUjs.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkQRHGVBKUjs.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkQRHGVBKUjs.UUIDGenerator; exports.X_CACHED_HEADER = _chunkQRHGVBKUjs.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkQRHGVBKUjs._exportsForTestingOnly; exports._internalGetGlobalState = _chunkQRHGVBKUjs._internalGetGlobalState; exports._internalIso = _chunkMF7NU6BTjs.isomorph_default; exports._internalSetInitialState = _chunkQRHGVBKUjs._internalSetInitialState; exports.addAzureBlobHeaders = _chunkQRHGVBKUjs.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkQRHGVBKUjs.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkQRHGVBKUjs.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkQRHGVBKUjs.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkQRHGVBKUjs.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.collectAnthropicSession = _chunkQRHGVBKUjs.collectAnthropicSession; exports.configureInstrumentation = _chunkQRHGVBKUjs.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkQRHGVBKUjs.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkQRHGVBKUjs.createFinalValuePassThroughStream; exports.currentExperiment = _chunkQRHGVBKUjs.currentExperiment; exports.currentLogger = _chunkQRHGVBKUjs.currentLogger; exports.currentSpan = _chunkQRHGVBKUjs.currentSpan; exports.deepCopyEvent = _chunkQRHGVBKUjs.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = _chunkQRHGVBKUjs.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkQRHGVBKUjs.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkQRHGVBKUjs.extractTraceContextFromHeaders; exports.flush = _chunkQRHGVBKUjs.flush; exports.getContextManager = _chunkQRHGVBKUjs.getContextManager; exports.getIdGenerator = _chunkQRHGVBKUjs.getIdGenerator; exports.getPromptVersions = _chunkQRHGVBKUjs.getPromptVersions; exports.getSpanParentObject = _chunkQRHGVBKUjs.getSpanParentObject; exports.getTemplateRenderer = _chunkQRHGVBKUjs.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkQRHGVBKUjs.init; exports.initDataset = _chunkQRHGVBKUjs.initDataset; exports.initExperiment = _chunkQRHGVBKUjs.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkQRHGVBKUjs.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkQRHGVBKUjs.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkQRHGVBKUjs.isTemplateFormat; exports.loadParameters = _chunkQRHGVBKUjs.loadParameters; exports.loadPrompt = _chunkQRHGVBKUjs.loadPrompt; exports.log = _chunkQRHGVBKUjs.log; exports.logError = _chunkQRHGVBKUjs.logError; exports.login = _chunkQRHGVBKUjs.login; exports.loginToState = _chunkQRHGVBKUjs.loginToState; exports.logs3OverflowUploadSchema = _chunkQRHGVBKUjs.logs3OverflowUploadSchema; exports.newId = _chunkQRHGVBKUjs.newId; exports.parseCachedHeader = _chunkQRHGVBKUjs.parseCachedHeader; exports.parseTemplateFormat = _chunkQRHGVBKUjs.parseTemplateFormat; exports.permalink = _chunkQRHGVBKUjs.permalink; exports.pickLogs3OverflowObjectIds = _chunkQRHGVBKUjs.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkQRHGVBKUjs.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkQRHGVBKUjs.registerTemplatePlugin; exports.renderMessage = _chunkQRHGVBKUjs.renderMessage; exports.renderPromptParams = _chunkQRHGVBKUjs.renderPromptParams; exports.renderTemplateContent = _chunkQRHGVBKUjs.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkQRHGVBKUjs.setFetch; exports.setMaskingFunction = _chunkQRHGVBKUjs.setMaskingFunction; exports.spanComponentsToObjectId = _chunkQRHGVBKUjs.spanComponentsToObjectId; exports.startSpan = _chunkQRHGVBKUjs.startSpan; exports.summarize = _chunkQRHGVBKUjs.summarize; exports.templateRegistry = _chunkQRHGVBKUjs.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkQRHGVBKUjs.ToolFunctionDefinition; exports.traceable = _chunkQRHGVBKUjs.traceable; exports.traced = _chunkQRHGVBKUjs.traced; exports.updateSpan = _chunkQRHGVBKUjs.updateSpan; exports.uploadLogs3OverflowPayload = _chunkQRHGVBKUjs.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkQRHGVBKUjs.utf8ByteLength; exports.withCurrent = _chunkQRHGVBKUjs.withCurrent; exports.withDataset = _chunkQRHGVBKUjs.withDataset; exports.withExperiment = _chunkQRHGVBKUjs.withExperiment; exports.withLogger = _chunkQRHGVBKUjs.withLogger; exports.withParent = _chunkQRHGVBKUjs.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 = _chunkQRHGVBKUjs.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 = _chunkQRHGVBKUjs.wrapTraced; exports.wrapVitest = wrapVitest;
|