braintrust 3.26.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/dev/dist/index.js +2440 -1067
- package/dev/dist/index.mjs +1644 -271
- package/dist/apply-auto-instrumentation.js +320 -261
- package/dist/apply-auto-instrumentation.mjs +118 -59
- package/dist/auto-instrumentations/bundler/esbuild.cjs +377 -59
- package/dist/auto-instrumentations/bundler/esbuild.mjs +5 -4
- package/dist/auto-instrumentations/bundler/next.cjs +379 -61
- package/dist/auto-instrumentations/bundler/next.mjs +6 -5
- package/dist/auto-instrumentations/bundler/rollup.cjs +377 -59
- package/dist/auto-instrumentations/bundler/rollup.mjs +5 -4
- package/dist/auto-instrumentations/bundler/vite.cjs +406 -60
- package/dist/auto-instrumentations/bundler/vite.mjs +34 -5
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +363 -59
- package/dist/auto-instrumentations/bundler/webpack.cjs +377 -59
- package/dist/auto-instrumentations/bundler/webpack.mjs +6 -5
- package/dist/auto-instrumentations/{chunk-AKKPLXTP.mjs → chunk-2AMDGD65.mjs} +160 -57
- package/dist/auto-instrumentations/{chunk-V5LEODRX.mjs → chunk-BW33ULMW.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-XYN63IG5.mjs → chunk-I55G56ZL.mjs} +21 -58
- package/dist/auto-instrumentations/{chunk-NRE4QUQR.mjs → chunk-JPUFNW7X.mjs} +140 -0
- package/dist/auto-instrumentations/{chunk-6E22MYSW.mjs → chunk-XEYKUBLY.mjs} +30 -4
- package/dist/auto-instrumentations/{chunk-XZHHE4Y3.mjs → chunk-ZNHTSSGI.mjs} +155 -2
- package/dist/auto-instrumentations/hook.mjs +161 -3
- package/dist/auto-instrumentations/index.cjs +296 -1
- package/dist/auto-instrumentations/index.d.mts +5 -1
- package/dist/auto-instrumentations/index.d.ts +5 -1
- package/dist/auto-instrumentations/index.mjs +6 -2
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +105 -57
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +2 -2
- package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
- package/dist/browser.d.mts +57 -5
- package/dist/browser.d.ts +57 -5
- package/dist/browser.js +1855 -285
- package/dist/browser.mjs +1855 -285
- package/dist/{chunk-PN7EWK66.mjs → chunk-CZM5JIQL.mjs} +209 -1
- package/dist/{chunk-VYNNEKSA.js → chunk-MF7NU6BT.js} +216 -8
- package/dist/{chunk-VRZZQPAA.js → chunk-QRHGVBKU.js} +2403 -1220
- package/dist/{chunk-XIZOM2HO.mjs → chunk-YKD22IMR.mjs} +1454 -271
- package/dist/cli.js +1645 -272
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +1855 -285
- package/dist/edge-light.mjs +1855 -285
- package/dist/index.d.mts +57 -5
- package/dist/index.d.ts +57 -5
- package/dist/index.js +600 -413
- package/dist/index.mjs +201 -14
- package/dist/instrumentation/index.d.mts +8 -0
- package/dist/instrumentation/index.d.ts +8 -0
- package/dist/instrumentation/index.js +1839 -466
- package/dist/instrumentation/index.mjs +1839 -466
- 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 +1855 -285
- package/dist/workerd.mjs +1855 -285
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
var _chunkVRZZQPAAjs = require('./chunk-VRZZQPAA.js');
|
|
144
143
|
|
|
144
|
+
var _chunkQRHGVBKUjs = require('./chunk-QRHGVBKU.js');
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
|
|
@@ -170,151 +170,155 @@ var _chunkVRZZQPAAjs = require('./chunk-VRZZQPAA.js');
|
|
|
170
170
|
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
var _chunkMF7NU6BTjs = require('./chunk-MF7NU6BT.js');
|
|
174
177
|
|
|
175
178
|
// src/exports.ts
|
|
176
179
|
var exports_exports = {};
|
|
177
|
-
|
|
178
|
-
Attachment: () =>
|
|
179
|
-
AttachmentReference: () =>
|
|
180
|
-
BAGGAGE_HEADER: () =>
|
|
181
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
182
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
183
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
184
|
-
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,
|
|
185
188
|
BaseExperiment: () => BaseExperiment,
|
|
186
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
189
|
+
BraintrustLangChainCallbackHandler: () => _chunkQRHGVBKUjs.BraintrustLangChainCallbackHandler,
|
|
187
190
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
188
|
-
BraintrustObservabilityExporter: () =>
|
|
189
|
-
BraintrustState: () =>
|
|
190
|
-
BraintrustStream: () =>
|
|
191
|
+
BraintrustObservabilityExporter: () => _chunkQRHGVBKUjs.BraintrustObservabilityExporter,
|
|
192
|
+
BraintrustState: () => _chunkQRHGVBKUjs.BraintrustState,
|
|
193
|
+
BraintrustStream: () => _chunkQRHGVBKUjs.BraintrustStream,
|
|
191
194
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
192
195
|
CodeFunction: () => CodeFunction,
|
|
193
196
|
CodePrompt: () => CodePrompt,
|
|
194
|
-
ContextManager: () =>
|
|
195
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
196
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
197
|
-
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,
|
|
198
201
|
DatasetPipeline: () => DatasetPipeline,
|
|
199
|
-
ERR_PERMALINK: () =>
|
|
202
|
+
ERR_PERMALINK: () => _chunkQRHGVBKUjs.ERR_PERMALINK,
|
|
200
203
|
Eval: () => Eval,
|
|
201
204
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
202
|
-
Experiment: () =>
|
|
203
|
-
ExternalAttachment: () =>
|
|
204
|
-
FailedHTTPResponse: () =>
|
|
205
|
-
IDGenerator: () =>
|
|
206
|
-
JSONAttachment: () =>
|
|
207
|
-
LEGACY_CACHED_HEADER: () =>
|
|
208
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
209
|
-
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,
|
|
210
213
|
LocalTrace: () => LocalTrace,
|
|
211
|
-
Logger: () =>
|
|
212
|
-
LoginInvalidOrgError: () =>
|
|
213
|
-
NOOP_SPAN: () =>
|
|
214
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
215
|
-
NoopSpan: () =>
|
|
216
|
-
OTELIDGenerator: () =>
|
|
217
|
-
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,
|
|
218
221
|
Project: () => Project2,
|
|
219
222
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
220
|
-
Prompt: () =>
|
|
223
|
+
Prompt: () => _chunkQRHGVBKUjs.Prompt,
|
|
221
224
|
PromptBuilder: () => PromptBuilder,
|
|
222
|
-
ReadonlyAttachment: () =>
|
|
223
|
-
ReadonlyExperiment: () =>
|
|
225
|
+
ReadonlyAttachment: () => _chunkQRHGVBKUjs.ReadonlyAttachment,
|
|
226
|
+
ReadonlyExperiment: () => _chunkQRHGVBKUjs.ReadonlyExperiment,
|
|
224
227
|
Reporter: () => Reporter,
|
|
225
228
|
ScorerBuilder: () => ScorerBuilder,
|
|
226
229
|
SpanFetcher: () => SpanFetcher,
|
|
227
|
-
SpanImpl: () =>
|
|
228
|
-
TRACEPARENT_HEADER: () =>
|
|
229
|
-
TRACESTATE_HEADER: () =>
|
|
230
|
-
TestBackgroundLogger: () =>
|
|
230
|
+
SpanImpl: () => _chunkQRHGVBKUjs.SpanImpl,
|
|
231
|
+
TRACEPARENT_HEADER: () => _chunkQRHGVBKUjs.TRACEPARENT_HEADER,
|
|
232
|
+
TRACESTATE_HEADER: () => _chunkQRHGVBKUjs.TRACESTATE_HEADER,
|
|
233
|
+
TestBackgroundLogger: () => _chunkQRHGVBKUjs.TestBackgroundLogger,
|
|
231
234
|
ToolBuilder: () => ToolBuilder,
|
|
232
|
-
UUIDGenerator: () =>
|
|
233
|
-
X_CACHED_HEADER: () =>
|
|
234
|
-
_exportsForTestingOnly: () =>
|
|
235
|
-
_internalGetGlobalState: () =>
|
|
236
|
-
_internalIso: () =>
|
|
237
|
-
_internalSetInitialState: () =>
|
|
238
|
-
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,
|
|
239
242
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
240
|
-
braintrustAISDKTelemetry: () =>
|
|
243
|
+
braintrustAISDKTelemetry: () => _chunkQRHGVBKUjs.braintrustAISDKTelemetry,
|
|
241
244
|
braintrustEveHook: () => braintrustEveHook,
|
|
242
245
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
243
|
-
braintrustFlueInstrumentation: () =>
|
|
244
|
-
braintrustFlueObserver: () =>
|
|
245
|
-
braintrustStreamChunkSchema: () =>
|
|
246
|
+
braintrustFlueInstrumentation: () => _chunkQRHGVBKUjs.braintrustFlueInstrumentation,
|
|
247
|
+
braintrustFlueObserver: () => _chunkQRHGVBKUjs.braintrustFlueObserver,
|
|
248
|
+
braintrustStreamChunkSchema: () => _chunkQRHGVBKUjs.braintrustStreamChunkSchema,
|
|
246
249
|
buildLocalSummary: () => buildLocalSummary,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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,
|
|
254
258
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
255
|
-
deserializePlainStringAsJSON: () =>
|
|
256
|
-
devNullWritableStream: () =>
|
|
259
|
+
deserializePlainStringAsJSON: () => _chunkQRHGVBKUjs.deserializePlainStringAsJSON,
|
|
260
|
+
devNullWritableStream: () => _chunkQRHGVBKUjs.devNullWritableStream,
|
|
257
261
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
258
262
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
259
|
-
extractTraceContextFromHeaders: () =>
|
|
260
|
-
flush: () =>
|
|
261
|
-
getContextManager: () =>
|
|
262
|
-
getIdGenerator: () =>
|
|
263
|
-
getPromptVersions: () =>
|
|
264
|
-
getSpanParentObject: () =>
|
|
265
|
-
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,
|
|
266
270
|
graph: () => graph_framework_exports,
|
|
267
|
-
init: () =>
|
|
268
|
-
initDataset: () =>
|
|
269
|
-
initExperiment: () =>
|
|
271
|
+
init: () => _chunkQRHGVBKUjs.init,
|
|
272
|
+
initDataset: () => _chunkQRHGVBKUjs.initDataset,
|
|
273
|
+
initExperiment: () => _chunkQRHGVBKUjs.initExperiment,
|
|
270
274
|
initFunction: () => initFunction,
|
|
271
|
-
initLogger: () =>
|
|
275
|
+
initLogger: () => _chunkQRHGVBKUjs.initLogger,
|
|
272
276
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
273
|
-
injectTraceContext: () =>
|
|
277
|
+
injectTraceContext: () => _chunkQRHGVBKUjs.injectTraceContext,
|
|
274
278
|
invoke: () => invoke,
|
|
275
|
-
isTemplateFormat: () =>
|
|
276
|
-
loadParameters: () =>
|
|
277
|
-
loadPrompt: () =>
|
|
278
|
-
log: () =>
|
|
279
|
-
logError: () =>
|
|
280
|
-
login: () =>
|
|
281
|
-
loginToState: () =>
|
|
282
|
-
logs3OverflowUploadSchema: () =>
|
|
283
|
-
newId: () =>
|
|
284
|
-
parseCachedHeader: () =>
|
|
285
|
-
parseTemplateFormat: () =>
|
|
286
|
-
permalink: () =>
|
|
287
|
-
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,
|
|
288
292
|
projects: () => projects,
|
|
289
293
|
promptContentsSchema: () => promptContentsSchema,
|
|
290
294
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
291
295
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
292
296
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
293
|
-
registerOtelFlush: () =>
|
|
297
|
+
registerOtelFlush: () => _chunkQRHGVBKUjs.registerOtelFlush,
|
|
294
298
|
registerSandbox: () => registerSandbox,
|
|
295
|
-
registerTemplatePlugin: () =>
|
|
296
|
-
renderMessage: () =>
|
|
297
|
-
renderPromptParams: () =>
|
|
298
|
-
renderTemplateContent: () =>
|
|
299
|
+
registerTemplatePlugin: () => _chunkQRHGVBKUjs.registerTemplatePlugin,
|
|
300
|
+
renderMessage: () => _chunkQRHGVBKUjs.renderMessage,
|
|
301
|
+
renderPromptParams: () => _chunkQRHGVBKUjs.renderPromptParams,
|
|
302
|
+
renderTemplateContent: () => _chunkQRHGVBKUjs.renderTemplateContent,
|
|
299
303
|
reportFailures: () => reportFailures,
|
|
300
304
|
runEvaluator: () => runEvaluator,
|
|
301
|
-
setFetch: () =>
|
|
302
|
-
setMaskingFunction: () =>
|
|
303
|
-
spanComponentsToObjectId: () =>
|
|
304
|
-
startSpan: () =>
|
|
305
|
-
summarize: () =>
|
|
306
|
-
templateRegistry: () =>
|
|
307
|
-
toolFunctionDefinitionSchema: () =>
|
|
308
|
-
traceable: () =>
|
|
309
|
-
traced: () =>
|
|
310
|
-
updateSpan: () =>
|
|
311
|
-
uploadLogs3OverflowPayload: () =>
|
|
312
|
-
utf8ByteLength: () =>
|
|
313
|
-
withCurrent: () =>
|
|
314
|
-
withDataset: () =>
|
|
315
|
-
withExperiment: () =>
|
|
316
|
-
withLogger: () =>
|
|
317
|
-
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,
|
|
318
322
|
wrapAISDK: () => wrapAISDK,
|
|
319
323
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
320
324
|
wrapAgentClass: () => wrapAgentClass,
|
|
@@ -323,6 +327,7 @@ _chunkVYNNEKSAjs.__export.call(void 0, exports_exports, {
|
|
|
323
327
|
wrapClaudeAgentSDK: () => wrapClaudeAgentSDK,
|
|
324
328
|
wrapCloudflareAIChat: () => wrapCloudflareAIChat,
|
|
325
329
|
wrapCloudflareAgent: () => wrapCloudflareAgent,
|
|
330
|
+
wrapCloudflareThink: () => wrapCloudflareThink,
|
|
326
331
|
wrapCohere: () => wrapCohere,
|
|
327
332
|
wrapCopilotClient: () => wrapCopilotClient,
|
|
328
333
|
wrapCursorSDK: () => wrapCursorSDK,
|
|
@@ -335,8 +340,9 @@ _chunkVYNNEKSAjs.__export.call(void 0, exports_exports, {
|
|
|
335
340
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
336
341
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
337
342
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
338
|
-
wrapMastraAgent: () =>
|
|
343
|
+
wrapMastraAgent: () => _chunkQRHGVBKUjs.wrapMastraAgent,
|
|
339
344
|
wrapMistral: () => wrapMistral,
|
|
345
|
+
wrapOllama: () => wrapOllama,
|
|
340
346
|
wrapOpenAI: () => wrapOpenAI,
|
|
341
347
|
wrapOpenAICodexSDK: () => wrapOpenAICodexSDK,
|
|
342
348
|
wrapOpenAIv4: () => wrapOpenAIv4,
|
|
@@ -344,7 +350,7 @@ _chunkVYNNEKSAjs.__export.call(void 0, exports_exports, {
|
|
|
344
350
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
345
351
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
346
352
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
347
|
-
wrapTraced: () =>
|
|
353
|
+
wrapTraced: () => _chunkQRHGVBKUjs.wrapTraced,
|
|
348
354
|
wrapVitest: () => wrapVitest
|
|
349
355
|
});
|
|
350
356
|
|
|
@@ -352,7 +358,7 @@ _chunkVYNNEKSAjs.__export.call(void 0, exports_exports, {
|
|
|
352
358
|
var _v3 = require('zod/v3');
|
|
353
359
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
354
360
|
async function registerSandbox(options) {
|
|
355
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
361
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
356
362
|
await state.login({
|
|
357
363
|
apiKey: options.apiKey,
|
|
358
364
|
appUrl: options.appUrl,
|
|
@@ -393,7 +399,7 @@ async function registerSandbox(options) {
|
|
|
393
399
|
evaluatorDefinitions
|
|
394
400
|
)) {
|
|
395
401
|
const functionName = evalName;
|
|
396
|
-
const functionSlug =
|
|
402
|
+
const functionSlug = _chunkQRHGVBKUjs.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
397
403
|
const functionDef = {
|
|
398
404
|
project_id: projectId,
|
|
399
405
|
org_name: state.orgName,
|
|
@@ -464,7 +470,7 @@ async function invoke(args) {
|
|
|
464
470
|
projectId,
|
|
465
471
|
...functionIdArgs
|
|
466
472
|
} = args;
|
|
467
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
473
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
468
474
|
await state.login({
|
|
469
475
|
orgName,
|
|
470
476
|
apiKey,
|
|
@@ -472,8 +478,8 @@ async function invoke(args) {
|
|
|
472
478
|
forceLogin,
|
|
473
479
|
fetch
|
|
474
480
|
});
|
|
475
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
476
|
-
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({
|
|
477
483
|
function_id: functionIdArgs.function_id,
|
|
478
484
|
project_name: functionIdArgs.projectName,
|
|
479
485
|
slug: functionIdArgs.slug,
|
|
@@ -516,7 +522,7 @@ async function invoke(args) {
|
|
|
516
522
|
if (!resp.body) {
|
|
517
523
|
throw new Error("Received empty stream body");
|
|
518
524
|
}
|
|
519
|
-
return new (0,
|
|
525
|
+
return new (0, _chunkQRHGVBKUjs.BraintrustStream)(resp.body);
|
|
520
526
|
} else {
|
|
521
527
|
const data = await resp.json();
|
|
522
528
|
return schema ? schema.parse(data) : data;
|
|
@@ -528,7 +534,7 @@ function initFunction({
|
|
|
528
534
|
version,
|
|
529
535
|
state
|
|
530
536
|
}) {
|
|
531
|
-
const s = _nullishCoalesce(state, () => (
|
|
537
|
+
const s = _nullishCoalesce(state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
532
538
|
_optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
|
|
533
539
|
const f = async (input) => {
|
|
534
540
|
return await invoke({
|
|
@@ -606,22 +612,22 @@ function responsesProxy(openai) {
|
|
|
606
612
|
if (name === "create" && typeof target.create === "function") {
|
|
607
613
|
return wrapResponsesAsync(
|
|
608
614
|
target.create.bind(target),
|
|
609
|
-
|
|
615
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesCreate
|
|
610
616
|
);
|
|
611
617
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
612
618
|
return wrapResponsesSyncStream(
|
|
613
619
|
target.stream.bind(target),
|
|
614
|
-
|
|
620
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesStream
|
|
615
621
|
);
|
|
616
622
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
617
623
|
return wrapResponsesAsync(
|
|
618
624
|
target.parse.bind(target),
|
|
619
|
-
|
|
625
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesParse
|
|
620
626
|
);
|
|
621
627
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
622
628
|
return wrapResponsesAsync(
|
|
623
629
|
target.compact.bind(target),
|
|
624
|
-
|
|
630
|
+
_chunkMF7NU6BTjs.openAIChannels.responsesCompact
|
|
625
631
|
);
|
|
626
632
|
}
|
|
627
633
|
return Reflect.get(target, name, receiver);
|
|
@@ -765,7 +771,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
765
771
|
const { span_info, params } = splitSpanInfo(
|
|
766
772
|
allParams
|
|
767
773
|
);
|
|
768
|
-
return
|
|
774
|
+
return _chunkMF7NU6BTjs.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
769
775
|
async () => await completion(params),
|
|
770
776
|
{ arguments: [params], span_info }
|
|
771
777
|
);
|
|
@@ -776,7 +782,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
776
782
|
const { span_info, params } = splitSpanInfo(
|
|
777
783
|
allParams
|
|
778
784
|
);
|
|
779
|
-
return
|
|
785
|
+
return _chunkMF7NU6BTjs.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
780
786
|
() => completion(params),
|
|
781
787
|
{ arguments: [params], span_info }
|
|
782
788
|
);
|
|
@@ -792,7 +798,7 @@ function wrapChatCompletion(completion) {
|
|
|
792
798
|
if (!executionPromise) {
|
|
793
799
|
executionPromise = (async () => {
|
|
794
800
|
const traceContext = createChannelContext(
|
|
795
|
-
|
|
801
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
796
802
|
params,
|
|
797
803
|
span_info
|
|
798
804
|
);
|
|
@@ -802,7 +808,7 @@ function wrapChatCompletion(completion) {
|
|
|
802
808
|
options
|
|
803
809
|
);
|
|
804
810
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
805
|
-
|
|
811
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
806
812
|
traceContext,
|
|
807
813
|
completionPromise
|
|
808
814
|
);
|
|
@@ -813,7 +819,7 @@ function wrapChatCompletion(completion) {
|
|
|
813
819
|
options
|
|
814
820
|
);
|
|
815
821
|
const { data, response } = await tracePromiseWithResponse(
|
|
816
|
-
|
|
822
|
+
_chunkMF7NU6BTjs.openAIChannels.chatCompletionsCreate,
|
|
817
823
|
traceContext,
|
|
818
824
|
completionResponse
|
|
819
825
|
);
|
|
@@ -856,8 +862,8 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
856
862
|
return createLazyAPIPromise(ensureExecuted);
|
|
857
863
|
};
|
|
858
864
|
}
|
|
859
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
860
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
865
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkMF7NU6BTjs.openAIChannels.embeddingsCreate);
|
|
866
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkMF7NU6BTjs.openAIChannels.moderationsCreate);
|
|
861
867
|
|
|
862
868
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
863
869
|
function isModuleNamespace(obj) {
|
|
@@ -960,7 +966,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
960
966
|
return wrapHarnessAgentGenerate(
|
|
961
967
|
original,
|
|
962
968
|
harnessAgent,
|
|
963
|
-
|
|
969
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.generate,
|
|
964
970
|
"HarnessAgent.generate",
|
|
965
971
|
options
|
|
966
972
|
);
|
|
@@ -968,7 +974,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
968
974
|
return wrapHarnessAgentStream(
|
|
969
975
|
original,
|
|
970
976
|
harnessAgent,
|
|
971
|
-
|
|
977
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.stream,
|
|
972
978
|
"HarnessAgent.stream",
|
|
973
979
|
options
|
|
974
980
|
);
|
|
@@ -976,7 +982,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
976
982
|
return wrapHarnessAgentGenerate(
|
|
977
983
|
original,
|
|
978
984
|
harnessAgent,
|
|
979
|
-
|
|
985
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.continueGenerate,
|
|
980
986
|
"HarnessAgent.continueGenerate",
|
|
981
987
|
options
|
|
982
988
|
);
|
|
@@ -984,7 +990,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
984
990
|
return wrapHarnessAgentStream(
|
|
985
991
|
original,
|
|
986
992
|
harnessAgent,
|
|
987
|
-
|
|
993
|
+
_chunkMF7NU6BTjs.harnessAgentChannels.continueStream,
|
|
988
994
|
"HarnessAgent.continueStream",
|
|
989
995
|
options
|
|
990
996
|
);
|
|
@@ -1007,7 +1013,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
1007
1013
|
};
|
|
1008
1014
|
var wrapHarnessAgentCreateSession = (createSession, instance) => {
|
|
1009
1015
|
const wrapper = function(params) {
|
|
1010
|
-
return
|
|
1016
|
+
return _chunkMF7NU6BTjs.harnessAgentChannels.createSession.tracePromise(
|
|
1011
1017
|
() => params === void 0 ? createSession.call(instance) : createSession.call(instance, params),
|
|
1012
1018
|
createAISDKChannelContext(_nullishCoalesce(params, () => ( {})), { self: instance })
|
|
1013
1019
|
);
|
|
@@ -1053,15 +1059,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
1053
1059
|
};
|
|
1054
1060
|
function generateChannelForAgent(agentName) {
|
|
1055
1061
|
if (agentName === "ToolLoopAgent") {
|
|
1056
|
-
return
|
|
1062
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.toolLoopAgentGenerate;
|
|
1057
1063
|
}
|
|
1058
|
-
return
|
|
1064
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.agentGenerate;
|
|
1059
1065
|
}
|
|
1060
1066
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
1061
1067
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
1062
1068
|
return (params) => {
|
|
1063
1069
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
1064
|
-
if (workflowAgent &&
|
|
1070
|
+
if (workflowAgent && _chunkQRHGVBKUjs.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
1065
1071
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
1066
1072
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
1067
1073
|
}
|
|
@@ -1080,12 +1086,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
1080
1086
|
};
|
|
1081
1087
|
function streamChannelForAgent(agentName) {
|
|
1082
1088
|
if (agentName === "ToolLoopAgent") {
|
|
1083
|
-
return
|
|
1089
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.toolLoopAgentStream;
|
|
1084
1090
|
}
|
|
1085
1091
|
if (agentName === "WorkflowAgent") {
|
|
1086
|
-
return
|
|
1092
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.workflowAgentStream;
|
|
1087
1093
|
}
|
|
1088
|
-
return
|
|
1094
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.agentStream;
|
|
1089
1095
|
}
|
|
1090
1096
|
var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
|
|
1091
1097
|
const wrapper = async function(allParams) {
|
|
@@ -1109,7 +1115,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
1109
1115
|
};
|
|
1110
1116
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
1111
1117
|
return makeGenerateTextWrapper(
|
|
1112
|
-
|
|
1118
|
+
_chunkMF7NU6BTjs.aiSDKChannels.generateText,
|
|
1113
1119
|
"generateText",
|
|
1114
1120
|
generateText,
|
|
1115
1121
|
{ aiSDK },
|
|
@@ -1118,7 +1124,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
1118
1124
|
};
|
|
1119
1125
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
1120
1126
|
return makeGenerateTextWrapper(
|
|
1121
|
-
|
|
1127
|
+
_chunkMF7NU6BTjs.aiSDKChannels.generateObject,
|
|
1122
1128
|
"generateObject",
|
|
1123
1129
|
generateObject,
|
|
1124
1130
|
{ aiSDK },
|
|
@@ -1147,7 +1153,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
1147
1153
|
};
|
|
1148
1154
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
1149
1155
|
return makeEmbedWrapper(
|
|
1150
|
-
|
|
1156
|
+
_chunkMF7NU6BTjs.aiSDKChannels.embed,
|
|
1151
1157
|
"embed",
|
|
1152
1158
|
embed,
|
|
1153
1159
|
{ aiSDK },
|
|
@@ -1156,7 +1162,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
1156
1162
|
};
|
|
1157
1163
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
1158
1164
|
return makeEmbedWrapper(
|
|
1159
|
-
|
|
1165
|
+
_chunkMF7NU6BTjs.aiSDKChannels.embedMany,
|
|
1160
1166
|
"embedMany",
|
|
1161
1167
|
embedMany,
|
|
1162
1168
|
{ aiSDK },
|
|
@@ -1167,7 +1173,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
1167
1173
|
const wrapper = async function(allParams) {
|
|
1168
1174
|
const { span_info, ...params } = allParams;
|
|
1169
1175
|
const tracedParams = { ...params };
|
|
1170
|
-
return
|
|
1176
|
+
return _chunkMF7NU6BTjs.aiSDKChannels.rerank.tracePromise(
|
|
1171
1177
|
() => rerank(tracedParams),
|
|
1172
1178
|
createAISDKChannelContext(tracedParams, {
|
|
1173
1179
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1206,7 +1212,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
1206
1212
|
};
|
|
1207
1213
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
1208
1214
|
return makeStreamWrapper(
|
|
1209
|
-
|
|
1215
|
+
_chunkMF7NU6BTjs.aiSDKChannels.streamText,
|
|
1210
1216
|
"streamText",
|
|
1211
1217
|
streamText,
|
|
1212
1218
|
{ aiSDK },
|
|
@@ -1215,7 +1221,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
1215
1221
|
};
|
|
1216
1222
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
1217
1223
|
return makeStreamWrapper(
|
|
1218
|
-
|
|
1224
|
+
_chunkMF7NU6BTjs.aiSDKChannels.streamObject,
|
|
1219
1225
|
"streamObject",
|
|
1220
1226
|
streamObject,
|
|
1221
1227
|
{ aiSDK },
|
|
@@ -1287,19 +1293,19 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1287
1293
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1288
1294
|
// propagate those via async local storage
|
|
1289
1295
|
async doGenerate(options) {
|
|
1290
|
-
const span =
|
|
1291
|
-
|
|
1296
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1297
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1292
1298
|
{
|
|
1293
1299
|
name: "Chat Completion",
|
|
1294
1300
|
spanAttributes: {
|
|
1295
1301
|
type: "llm"
|
|
1296
1302
|
}
|
|
1297
1303
|
},
|
|
1298
|
-
|
|
1304
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK
|
|
1299
1305
|
)
|
|
1300
1306
|
);
|
|
1301
1307
|
const { prompt, mode, ...rest } = options;
|
|
1302
|
-
const startTime =
|
|
1308
|
+
const startTime = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1303
1309
|
try {
|
|
1304
1310
|
const ret = await this.model.doGenerate(options);
|
|
1305
1311
|
span.log({
|
|
@@ -1311,12 +1317,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1311
1317
|
},
|
|
1312
1318
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1313
1319
|
metrics: {
|
|
1314
|
-
time_to_first_token:
|
|
1315
|
-
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,
|
|
1316
1322
|
prompt_tokens: _optionalChain([ret, 'access', _26 => _26.usage, 'optionalAccess', _27 => _27.promptTokens]),
|
|
1317
1323
|
completion_tokens: _optionalChain([ret, 'access', _28 => _28.usage, 'optionalAccess', _29 => _29.completionTokens]),
|
|
1318
|
-
cached:
|
|
1319
|
-
_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]])))
|
|
1320
1326
|
)
|
|
1321
1327
|
}
|
|
1322
1328
|
});
|
|
@@ -1327,16 +1333,16 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1327
1333
|
}
|
|
1328
1334
|
async doStream(options) {
|
|
1329
1335
|
const { prompt, mode, ...rest } = options;
|
|
1330
|
-
const startTime =
|
|
1331
|
-
const span =
|
|
1332
|
-
|
|
1336
|
+
const startTime = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1337
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1338
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1333
1339
|
{
|
|
1334
1340
|
name: "Chat Completion",
|
|
1335
1341
|
spanAttributes: {
|
|
1336
1342
|
type: "llm"
|
|
1337
1343
|
}
|
|
1338
1344
|
},
|
|
1339
|
-
|
|
1345
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK
|
|
1340
1346
|
)
|
|
1341
1347
|
);
|
|
1342
1348
|
span.log({
|
|
@@ -1367,7 +1373,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1367
1373
|
new TransformStream({
|
|
1368
1374
|
transform(chunk, controller) {
|
|
1369
1375
|
if (time_to_first_token === void 0) {
|
|
1370
|
-
time_to_first_token =
|
|
1376
|
+
time_to_first_token = _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1371
1377
|
span.log({ metrics: { time_to_first_token } });
|
|
1372
1378
|
}
|
|
1373
1379
|
switch (chunk.type) {
|
|
@@ -1412,11 +1418,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1412
1418
|
),
|
|
1413
1419
|
metrics: {
|
|
1414
1420
|
time_to_first_token,
|
|
1415
|
-
tokens: !
|
|
1421
|
+
tokens: !_chunkQRHGVBKUjs.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1416
1422
|
prompt_tokens: _optionalChain([usage, 'optionalAccess', _36 => _36.promptTokens]),
|
|
1417
1423
|
completion_tokens: _optionalChain([usage, 'optionalAccess', _37 => _37.completionTokens]),
|
|
1418
|
-
cached:
|
|
1419
|
-
_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]])))
|
|
1420
1426
|
)
|
|
1421
1427
|
}
|
|
1422
1428
|
});
|
|
@@ -1601,12 +1607,12 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1601
1607
|
anthropicMetadata.usage,
|
|
1602
1608
|
"cache_creation_input_tokens"
|
|
1603
1609
|
) || 0;
|
|
1604
|
-
const cacheTokens =
|
|
1610
|
+
const cacheTokens = _chunkQRHGVBKUjs.extractAnthropicCacheTokens.call(void 0,
|
|
1605
1611
|
cacheReadTokens,
|
|
1606
1612
|
cacheCreationTokens
|
|
1607
1613
|
);
|
|
1608
1614
|
Object.assign(metrics, cacheTokens);
|
|
1609
|
-
Object.assign(metrics,
|
|
1615
|
+
Object.assign(metrics, _chunkQRHGVBKUjs.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1610
1616
|
}
|
|
1611
1617
|
}
|
|
1612
1618
|
return metrics;
|
|
@@ -1678,7 +1684,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1678
1684
|
model: modelFromWrapGenerate
|
|
1679
1685
|
}) => {
|
|
1680
1686
|
const rawInput = extractInput(params);
|
|
1681
|
-
const processedInput =
|
|
1687
|
+
const processedInput = _chunkQRHGVBKUjs.processInputAttachments.call(void 0, rawInput);
|
|
1682
1688
|
const spanArgs = {
|
|
1683
1689
|
name: _optionalChain([config, 'access', _60 => _60.spanInfo, 'optionalAccess', _61 => _61.name]) || "ai-sdk.doGenerate",
|
|
1684
1690
|
spanAttributes: {
|
|
@@ -1693,8 +1699,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1693
1699
|
}
|
|
1694
1700
|
}
|
|
1695
1701
|
};
|
|
1696
|
-
const span =
|
|
1697
|
-
|
|
1702
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1703
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1698
1704
|
);
|
|
1699
1705
|
try {
|
|
1700
1706
|
const result = await doGenerate();
|
|
@@ -1742,7 +1748,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1742
1748
|
},
|
|
1743
1749
|
wrapStream: async ({ doStream, params }) => {
|
|
1744
1750
|
const rawInput = extractInput(params);
|
|
1745
|
-
const processedInput =
|
|
1751
|
+
const processedInput = _chunkQRHGVBKUjs.processInputAttachments.call(void 0, rawInput);
|
|
1746
1752
|
const spanArgs = {
|
|
1747
1753
|
name: _optionalChain([config, 'access', _69 => _69.spanInfo, 'optionalAccess', _70 => _70.name]) || "ai-sdk.doStream",
|
|
1748
1754
|
spanAttributes: {
|
|
@@ -1757,8 +1763,8 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1757
1763
|
}
|
|
1758
1764
|
}
|
|
1759
1765
|
};
|
|
1760
|
-
const span =
|
|
1761
|
-
|
|
1766
|
+
const span = _chunkQRHGVBKUjs.startSpan.call(void 0,
|
|
1767
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1762
1768
|
);
|
|
1763
1769
|
try {
|
|
1764
1770
|
const { stream, ...rest } = await doStream();
|
|
@@ -1883,7 +1889,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1883
1889
|
try {
|
|
1884
1890
|
captureEveModelInput(state, input);
|
|
1885
1891
|
} catch (error) {
|
|
1886
|
-
|
|
1892
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
1887
1893
|
}
|
|
1888
1894
|
}
|
|
1889
1895
|
},
|
|
@@ -1893,7 +1899,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1893
1899
|
};
|
|
1894
1900
|
}
|
|
1895
1901
|
function isEveHandleMessageStreamEvent(event) {
|
|
1896
|
-
return
|
|
1902
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
1897
1903
|
}
|
|
1898
1904
|
var ResumedEveSpan = class {
|
|
1899
1905
|
constructor(reference) {
|
|
@@ -1914,7 +1920,7 @@ var ResumedEveSpan = class {
|
|
|
1914
1920
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
1915
1921
|
...event.metrics
|
|
1916
1922
|
};
|
|
1917
|
-
|
|
1923
|
+
_chunkQRHGVBKUjs.updateSpan.call(void 0, {
|
|
1918
1924
|
exported: this.reference.exported,
|
|
1919
1925
|
...this.reference.startEvent,
|
|
1920
1926
|
...event,
|
|
@@ -1923,7 +1929,7 @@ var ResumedEveSpan = class {
|
|
|
1923
1929
|
}
|
|
1924
1930
|
end(args) {
|
|
1925
1931
|
if (this.endTime === void 0) {
|
|
1926
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => (
|
|
1932
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => ( _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1927
1933
|
this.log({ metrics: { end: this.endTime } });
|
|
1928
1934
|
}
|
|
1929
1935
|
return this.endTime;
|
|
@@ -1935,13 +1941,13 @@ var EveBridge = (_class = class {
|
|
|
1935
1941
|
}
|
|
1936
1942
|
|
|
1937
1943
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
1938
|
-
__init2() {this.completedToolKeys = new (0,
|
|
1944
|
+
__init2() {this.completedToolKeys = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1939
1945
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1940
1946
|
})}
|
|
1941
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
1947
|
+
__init3() {this.toolsByCallKey = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1942
1948
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1943
1949
|
})}
|
|
1944
|
-
__init4() {this.turnsByKey = new (0,
|
|
1950
|
+
__init4() {this.turnsByKey = new (0, _chunkQRHGVBKUjs.LRUCache)({
|
|
1945
1951
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1946
1952
|
})}
|
|
1947
1953
|
async startEveSpan(args) {
|
|
@@ -1952,7 +1958,7 @@ var EveBridge = (_class = class {
|
|
|
1952
1958
|
if (reference) {
|
|
1953
1959
|
return new ResumedEveSpan(reference);
|
|
1954
1960
|
}
|
|
1955
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => (
|
|
1961
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => ( _chunkQRHGVBKUjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1956
1962
|
const parentSpanIds = _optionalChain([args, 'optionalAccess', _82 => _82.parentSpanIds]);
|
|
1957
1963
|
const startEvent = {
|
|
1958
1964
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1964,12 +1970,12 @@ var EveBridge = (_class = class {
|
|
|
1964
1970
|
},
|
|
1965
1971
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
1966
1972
|
};
|
|
1967
|
-
const span =
|
|
1968
|
-
|
|
1969
|
-
() =>
|
|
1970
|
-
|
|
1973
|
+
const span = _chunkQRHGVBKUjs.withCurrent.call(void 0,
|
|
1974
|
+
_chunkQRHGVBKUjs.NOOP_SPAN,
|
|
1975
|
+
() => _chunkQRHGVBKUjs._internalStartSpanWithInitialMerge.call(void 0,
|
|
1976
|
+
_chunkMF7NU6BTjs.withSpanInstrumentationName.call(void 0,
|
|
1971
1977
|
{ ...args, startTime },
|
|
1972
|
-
|
|
1978
|
+
_chunkMF7NU6BTjs.INSTRUMENTATION_NAMES.EVE
|
|
1973
1979
|
)
|
|
1974
1980
|
)
|
|
1975
1981
|
);
|
|
@@ -1997,7 +2003,7 @@ var EveBridge = (_class = class {
|
|
|
1997
2003
|
};
|
|
1998
2004
|
});
|
|
1999
2005
|
} catch (error) {
|
|
2000
|
-
|
|
2006
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
2001
2007
|
}
|
|
2002
2008
|
return span;
|
|
2003
2009
|
}
|
|
@@ -2084,7 +2090,7 @@ var EveBridge = (_class = class {
|
|
|
2084
2090
|
}
|
|
2085
2091
|
}
|
|
2086
2092
|
} catch (error) {
|
|
2087
|
-
|
|
2093
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
2088
2094
|
}
|
|
2089
2095
|
};
|
|
2090
2096
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -2312,7 +2318,7 @@ var EveBridge = (_class = class {
|
|
|
2312
2318
|
return;
|
|
2313
2319
|
}
|
|
2314
2320
|
const existingMessage = eveOutputMessage(step.output);
|
|
2315
|
-
const existingToolCalls =
|
|
2321
|
+
const existingToolCalls = _chunkQRHGVBKUjs.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2316
2322
|
step.output = mergeEveReasoning(
|
|
2317
2323
|
[
|
|
2318
2324
|
{
|
|
@@ -2376,11 +2382,11 @@ var EveBridge = (_class = class {
|
|
|
2376
2382
|
return;
|
|
2377
2383
|
}
|
|
2378
2384
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2379
|
-
if (Array.isArray(step.output) &&
|
|
2385
|
+
if (Array.isArray(step.output) && _chunkQRHGVBKUjs.isObject.call(void 0, step.output[0])) {
|
|
2380
2386
|
const message = step.output[0]["message"];
|
|
2381
|
-
if (
|
|
2387
|
+
if (_chunkQRHGVBKUjs.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2382
2388
|
for (const toolCall of message["tool_calls"]) {
|
|
2383
|
-
if (
|
|
2389
|
+
if (_chunkQRHGVBKUjs.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2384
2390
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2385
2391
|
}
|
|
2386
2392
|
}
|
|
@@ -2589,7 +2595,7 @@ var EveBridge = (_class = class {
|
|
|
2589
2595
|
};
|
|
2590
2596
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2591
2597
|
const sessionId = sessionIdFromContext(ctx);
|
|
2592
|
-
if (Array.isArray(step.output) &&
|
|
2598
|
+
if (Array.isArray(step.output) && _chunkQRHGVBKUjs.isObject.call(void 0, step.output[0])) {
|
|
2593
2599
|
const finishReason = step.output[0].finish_reason;
|
|
2594
2600
|
if (typeof finishReason !== "string") {
|
|
2595
2601
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -2927,10 +2933,10 @@ var EveBridge = (_class = class {
|
|
|
2927
2933
|
return state;
|
|
2928
2934
|
}
|
|
2929
2935
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
2930
|
-
const session =
|
|
2931
|
-
const parent =
|
|
2932
|
-
const parentTurn =
|
|
2933
|
-
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" ? {
|
|
2934
2940
|
callId: parent["callId"],
|
|
2935
2941
|
sessionId: parent["sessionId"],
|
|
2936
2942
|
turnId: parentTurn["id"]
|
|
@@ -3037,10 +3043,10 @@ var EveBridge = (_class = class {
|
|
|
3037
3043
|
}
|
|
3038
3044
|
async flushInstrumentation() {
|
|
3039
3045
|
try {
|
|
3040
|
-
await
|
|
3046
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, );
|
|
3041
3047
|
return true;
|
|
3042
3048
|
} catch (error) {
|
|
3043
|
-
|
|
3049
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
3044
3050
|
return false;
|
|
3045
3051
|
}
|
|
3046
3052
|
}
|
|
@@ -3055,12 +3061,12 @@ function emptyEveTraceState() {
|
|
|
3055
3061
|
};
|
|
3056
3062
|
}
|
|
3057
3063
|
function normalizeEveTraceState(state) {
|
|
3058
|
-
if (!
|
|
3064
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, state)) {
|
|
3059
3065
|
return emptyEveTraceState();
|
|
3060
3066
|
}
|
|
3061
|
-
const metadata =
|
|
3067
|
+
const metadata = _chunkQRHGVBKUjs.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
3062
3068
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
3063
|
-
if (!
|
|
3069
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3064
3070
|
return [];
|
|
3065
3071
|
}
|
|
3066
3072
|
const exported = entry["exported"];
|
|
@@ -3069,11 +3075,11 @@ function normalizeEveTraceState(state) {
|
|
|
3069
3075
|
const rowId = entry["rowId"];
|
|
3070
3076
|
const spanId = entry["spanId"];
|
|
3071
3077
|
const startEvent = entry["startEvent"];
|
|
3072
|
-
const startEventCreated =
|
|
3073
|
-
const startEventMetrics =
|
|
3074
|
-
const startEventSpanAttributes =
|
|
3075
|
-
const startEventSpanParents =
|
|
3076
|
-
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(
|
|
3077
3083
|
(parent) => typeof parent === "string"
|
|
3078
3084
|
) ? {
|
|
3079
3085
|
created: startEventCreated,
|
|
@@ -3093,7 +3099,7 @@ function normalizeEveTraceState(state) {
|
|
|
3093
3099
|
] : [];
|
|
3094
3100
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
3095
3101
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
3096
|
-
if (!
|
|
3102
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3097
3103
|
return [];
|
|
3098
3104
|
}
|
|
3099
3105
|
const key = entry["key"];
|
|
@@ -3101,7 +3107,7 @@ function normalizeEveTraceState(state) {
|
|
|
3101
3107
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
3102
3108
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
3103
3109
|
const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
|
|
3104
|
-
if (!
|
|
3110
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3105
3111
|
return [];
|
|
3106
3112
|
}
|
|
3107
3113
|
const content = entry["content"];
|
|
@@ -3116,7 +3122,7 @@ function normalizeEveTraceState(state) {
|
|
|
3116
3122
|
] : [];
|
|
3117
3123
|
}).slice(-MAX_STORED_REASONING_BLOCKS) : [];
|
|
3118
3124
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
3119
|
-
if (!
|
|
3125
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, entry)) {
|
|
3120
3126
|
return [];
|
|
3121
3127
|
}
|
|
3122
3128
|
const ordinal = entry["ordinal"];
|
|
@@ -3193,14 +3199,14 @@ function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
|
3193
3199
|
});
|
|
3194
3200
|
}
|
|
3195
3201
|
function eveOutputMessage(output) {
|
|
3196
|
-
return Array.isArray(output) &&
|
|
3202
|
+
return Array.isArray(output) && _chunkQRHGVBKUjs.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
|
|
3197
3203
|
}
|
|
3198
3204
|
function mergeEveReasoning(output, reasoning) {
|
|
3199
3205
|
if (reasoning.length === 0) {
|
|
3200
3206
|
return output;
|
|
3201
3207
|
}
|
|
3202
|
-
const choice = Array.isArray(output) &&
|
|
3203
|
-
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"] : {};
|
|
3204
3210
|
return [
|
|
3205
3211
|
{
|
|
3206
3212
|
...choice,
|
|
@@ -3254,7 +3260,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
3254
3260
|
});
|
|
3255
3261
|
return input;
|
|
3256
3262
|
} catch (error) {
|
|
3257
|
-
|
|
3263
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
3258
3264
|
return void 0;
|
|
3259
3265
|
}
|
|
3260
3266
|
}
|
|
@@ -3392,14 +3398,14 @@ function capturedEveModelContentPart(part) {
|
|
|
3392
3398
|
}
|
|
3393
3399
|
function isCapturedModelInput(input) {
|
|
3394
3400
|
return Array.isArray(input) && input.every(
|
|
3395
|
-
(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))
|
|
3396
3402
|
);
|
|
3397
3403
|
}
|
|
3398
3404
|
function llmInputKey(sessionId, turnId, stepIndex) {
|
|
3399
3405
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3400
3406
|
}
|
|
3401
3407
|
function modelMetadataFromRuntime(runtime) {
|
|
3402
|
-
if (!
|
|
3408
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, runtime)) {
|
|
3403
3409
|
return {};
|
|
3404
3410
|
}
|
|
3405
3411
|
const modelId = runtime["modelId"];
|
|
@@ -3422,11 +3428,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3422
3428
|
};
|
|
3423
3429
|
}
|
|
3424
3430
|
function sessionIdFromContext(ctx) {
|
|
3425
|
-
if (!
|
|
3431
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, ctx)) {
|
|
3426
3432
|
return void 0;
|
|
3427
3433
|
}
|
|
3428
3434
|
const session = ctx["session"];
|
|
3429
|
-
if (!
|
|
3435
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, session)) {
|
|
3430
3436
|
return void 0;
|
|
3431
3437
|
}
|
|
3432
3438
|
const id = session["id"];
|
|
@@ -3437,19 +3443,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3437
3443
|
return metadata;
|
|
3438
3444
|
}
|
|
3439
3445
|
function isToolCallAction(action) {
|
|
3440
|
-
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"]);
|
|
3441
3447
|
}
|
|
3442
3448
|
function isLocalSubagentCallAction(action) {
|
|
3443
|
-
return
|
|
3449
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkQRHGVBKUjs.isObject.call(void 0, action["input"]);
|
|
3444
3450
|
}
|
|
3445
3451
|
function isTraceableActionRequest(action) {
|
|
3446
3452
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3447
3453
|
}
|
|
3448
3454
|
function isToolResult(result) {
|
|
3449
|
-
return
|
|
3455
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3450
3456
|
}
|
|
3451
3457
|
function isSubagentResult(result) {
|
|
3452
|
-
return
|
|
3458
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3453
3459
|
}
|
|
3454
3460
|
function normalizedFinishReason(finishReason) {
|
|
3455
3461
|
switch (finishReason) {
|
|
@@ -3541,6 +3547,66 @@ function betaProxy(beta, anthropic) {
|
|
|
3541
3547
|
if (prop === "messages") {
|
|
3542
3548
|
return betaMessagesProxy(target.messages, anthropic);
|
|
3543
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
|
+
}
|
|
3544
3610
|
return Reflect.get(target, prop, receiver);
|
|
3545
3611
|
}
|
|
3546
3612
|
});
|
|
@@ -3549,7 +3615,7 @@ function messagesProxy(messages) {
|
|
|
3549
3615
|
return new Proxy(messages, {
|
|
3550
3616
|
get(target, prop, receiver) {
|
|
3551
3617
|
if (prop === "create") {
|
|
3552
|
-
return createProxy(target.create,
|
|
3618
|
+
return createProxy(target.create, _chunkMF7NU6BTjs.anthropicChannels.messagesCreate);
|
|
3553
3619
|
}
|
|
3554
3620
|
return Reflect.get(target, prop, receiver);
|
|
3555
3621
|
}
|
|
@@ -3559,7 +3625,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3559
3625
|
return new Proxy(messages, {
|
|
3560
3626
|
get(target, prop, receiver) {
|
|
3561
3627
|
if (prop === "create") {
|
|
3562
|
-
return createProxy(target.create,
|
|
3628
|
+
return createProxy(target.create, _chunkMF7NU6BTjs.anthropicChannels.betaMessagesCreate);
|
|
3563
3629
|
}
|
|
3564
3630
|
if (prop === "toolRunner") {
|
|
3565
3631
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -3568,7 +3634,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3568
3634
|
return toolRunnerProxy(
|
|
3569
3635
|
target.toolRunner,
|
|
3570
3636
|
anthropic,
|
|
3571
|
-
|
|
3637
|
+
_chunkMF7NU6BTjs.anthropicChannels.betaMessagesToolRunner
|
|
3572
3638
|
);
|
|
3573
3639
|
}
|
|
3574
3640
|
return Reflect.get(target, prop, receiver);
|
|
@@ -3625,11 +3691,11 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
3625
3691
|
...params,
|
|
3626
3692
|
options: {
|
|
3627
3693
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
3628
|
-
[
|
|
3694
|
+
[_chunkQRHGVBKUjs.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
3629
3695
|
}
|
|
3630
3696
|
};
|
|
3631
3697
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3632
|
-
return
|
|
3698
|
+
return _chunkMF7NU6BTjs.claudeAgentSDKChannels.query.traceSync(
|
|
3633
3699
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
3634
3700
|
// The channel carries no extra context fields, but the generated
|
|
3635
3701
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -3657,7 +3723,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
3657
3723
|
}
|
|
3658
3724
|
const localToolMetadata = { toolName };
|
|
3659
3725
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
3660
|
-
wrappedArgs[handlerIndex] =
|
|
3726
|
+
wrappedArgs[handlerIndex] = _chunkQRHGVBKUjs.wrapLocalClaudeToolHandler.call(void 0,
|
|
3661
3727
|
originalHandler,
|
|
3662
3728
|
() => localToolMetadata
|
|
3663
3729
|
);
|
|
@@ -3734,6 +3800,52 @@ function claudeAgentSDKProxy(sdk) {
|
|
|
3734
3800
|
});
|
|
3735
3801
|
}
|
|
3736
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
|
+
|
|
3737
3849
|
// src/wrappers/openai-codex.ts
|
|
3738
3850
|
var WRAPPED_CLIENT = /* @__PURE__ */ Symbol.for("braintrust.openai-codex.wrapped-client");
|
|
3739
3851
|
var WRAPPED_THREAD = /* @__PURE__ */ Symbol.for("braintrust.openai-codex.wrapped-thread");
|
|
@@ -3840,7 +3952,7 @@ function wrapCodexThread(thread) {
|
|
|
3840
3952
|
if (prop === "run" && typeof value === "function") {
|
|
3841
3953
|
return function(input, turnOptions) {
|
|
3842
3954
|
const args = [input, turnOptions];
|
|
3843
|
-
return
|
|
3955
|
+
return _chunkMF7NU6BTjs.openAICodexChannels.run.tracePromise(
|
|
3844
3956
|
() => Reflect.apply(value, target, args),
|
|
3845
3957
|
{
|
|
3846
3958
|
arguments: args,
|
|
@@ -3853,7 +3965,7 @@ function wrapCodexThread(thread) {
|
|
|
3853
3965
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
3854
3966
|
return function(input, turnOptions) {
|
|
3855
3967
|
const args = [input, turnOptions];
|
|
3856
|
-
return
|
|
3968
|
+
return _chunkMF7NU6BTjs.openAICodexChannels.runStreamed.tracePromise(
|
|
3857
3969
|
() => Reflect.apply(value, target, args),
|
|
3858
3970
|
{
|
|
3859
3971
|
arguments: args,
|
|
@@ -3921,7 +4033,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3921
4033
|
if (prop === "create" && typeof value === "function") {
|
|
3922
4034
|
const wrapped = async function(options) {
|
|
3923
4035
|
const args = [options];
|
|
3924
|
-
return
|
|
4036
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.create.tracePromise(
|
|
3925
4037
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3926
4038
|
{ arguments: args }
|
|
3927
4039
|
);
|
|
@@ -3932,7 +4044,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3932
4044
|
if (prop === "resume" && typeof value === "function") {
|
|
3933
4045
|
const wrapped = async function(agentId, options) {
|
|
3934
4046
|
const args = [agentId, options];
|
|
3935
|
-
return
|
|
4047
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.resume.tracePromise(
|
|
3936
4048
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3937
4049
|
{ arguments: args }
|
|
3938
4050
|
);
|
|
@@ -3943,7 +4055,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3943
4055
|
if (prop === "prompt" && typeof value === "function") {
|
|
3944
4056
|
const wrapped = async function(message, options) {
|
|
3945
4057
|
const args = [message, options];
|
|
3946
|
-
return
|
|
4058
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.prompt.tracePromise(
|
|
3947
4059
|
() => Reflect.apply(value, target, args),
|
|
3948
4060
|
{ arguments: args }
|
|
3949
4061
|
);
|
|
@@ -3976,7 +4088,7 @@ function wrapCursorAgent(agent) {
|
|
|
3976
4088
|
if (prop === "send" && typeof value === "function") {
|
|
3977
4089
|
return function(message, options) {
|
|
3978
4090
|
const args = [message, options];
|
|
3979
|
-
return
|
|
4091
|
+
return _chunkMF7NU6BTjs.cursorSDKChannels.send.tracePromise(
|
|
3980
4092
|
() => Reflect.apply(value, target, args),
|
|
3981
4093
|
{
|
|
3982
4094
|
agent: target,
|
|
@@ -4026,14 +4138,9 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
4026
4138
|
...descriptor,
|
|
4027
4139
|
value: function wrappedPiCodingAgentPrompt(text, options) {
|
|
4028
4140
|
const args = [text, options];
|
|
4029
|
-
return
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
arguments: args,
|
|
4033
|
-
self: this,
|
|
4034
|
-
session: this
|
|
4035
|
-
}
|
|
4036
|
-
);
|
|
4141
|
+
return _chunkMF7NU6BTjs.piCodingAgentChannels.prompt.invoke(originalPrompt, this, args, {
|
|
4142
|
+
session: this
|
|
4143
|
+
});
|
|
4037
4144
|
}
|
|
4038
4145
|
});
|
|
4039
4146
|
Object.defineProperty(prototype, WRAPPED_PROMPT, {
|
|
@@ -4077,7 +4184,7 @@ function wrapCloudflareAgent(Agent) {
|
|
|
4077
4184
|
if (ownValue(options, "detached")) {
|
|
4078
4185
|
return Reflect.apply(originalRunAgentTool, this, args);
|
|
4079
4186
|
}
|
|
4080
|
-
return
|
|
4187
|
+
return _chunkMF7NU6BTjs.cloudflareAgentsChannels.runAgentTool.tracePromise(
|
|
4081
4188
|
() => Reflect.apply(originalRunAgentTool, this, args),
|
|
4082
4189
|
{ arguments: args, self: this }
|
|
4083
4190
|
);
|
|
@@ -4101,7 +4208,7 @@ function isObjectLike(value) {
|
|
|
4101
4208
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
4102
4209
|
}
|
|
4103
4210
|
function warnUnsupportedAgent() {
|
|
4104
|
-
|
|
4211
|
+
_chunkQRHGVBKUjs.debugLogger.warn("Unsupported Cloudflare Agents Agent class. Not wrapping.");
|
|
4105
4212
|
}
|
|
4106
4213
|
|
|
4107
4214
|
// src/wrappers/strands-agent-sdk.ts
|
|
@@ -4207,7 +4314,7 @@ function wrapAgentInstance(agent) {
|
|
|
4207
4314
|
if (prop === "stream" && typeof value === "function") {
|
|
4208
4315
|
return function(args, options) {
|
|
4209
4316
|
const callArgs = [args, options];
|
|
4210
|
-
return
|
|
4317
|
+
return _chunkMF7NU6BTjs.strandsAgentSDKChannels.agentStream.traceSync(
|
|
4211
4318
|
() => Reflect.apply(value, target, callArgs),
|
|
4212
4319
|
{
|
|
4213
4320
|
agent: proxy,
|
|
@@ -4243,7 +4350,7 @@ function wrapMultiAgentInstance(orchestrator, kind) {
|
|
|
4243
4350
|
if (prop === "stream" && typeof value === "function") {
|
|
4244
4351
|
return function(input, options) {
|
|
4245
4352
|
const callArgs = [input, options];
|
|
4246
|
-
const channel = kind === "graph" ?
|
|
4353
|
+
const channel = kind === "graph" ? _chunkMF7NU6BTjs.strandsAgentSDKChannels.graphStream : _chunkMF7NU6BTjs.strandsAgentSDKChannels.swarmStream;
|
|
4247
4354
|
return channel.traceSync(
|
|
4248
4355
|
() => Reflect.apply(value, target, callArgs),
|
|
4249
4356
|
{
|
|
@@ -4283,11 +4390,11 @@ function wrapCloudflareAIChat(module) {
|
|
|
4283
4390
|
try {
|
|
4284
4391
|
AIChatAgent = Reflect.get(candidate, "AIChatAgent");
|
|
4285
4392
|
} catch (error) {
|
|
4286
|
-
|
|
4393
|
+
_chunkQRHGVBKUjs.debugLogger.debug("Failed to inspect @cloudflare/ai-chat module:", error);
|
|
4287
4394
|
return module;
|
|
4288
4395
|
}
|
|
4289
4396
|
if (typeof AIChatAgent !== "function") {
|
|
4290
|
-
|
|
4397
|
+
_chunkQRHGVBKUjs.debugLogger.warn(
|
|
4291
4398
|
"Unsupported @cloudflare/ai-chat module. AIChatAgent was not found; not wrapping."
|
|
4292
4399
|
);
|
|
4293
4400
|
return module;
|
|
@@ -4321,7 +4428,7 @@ function wrapAIChatAgentClass(AgentClass) {
|
|
|
4321
4428
|
args,
|
|
4322
4429
|
newTarget
|
|
4323
4430
|
);
|
|
4324
|
-
return
|
|
4431
|
+
return _chunkQRHGVBKUjs.instrumentCloudflareAIChatAgent.call(void 0, instance);
|
|
4325
4432
|
}
|
|
4326
4433
|
});
|
|
4327
4434
|
wrappedClasses.set(AgentClass, wrapped);
|
|
@@ -4393,7 +4500,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
4393
4500
|
}
|
|
4394
4501
|
if (prop === "interactions") {
|
|
4395
4502
|
const interactions = Reflect.get(target, prop, receiver);
|
|
4396
|
-
if (!
|
|
4503
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
4397
4504
|
return interactions;
|
|
4398
4505
|
}
|
|
4399
4506
|
if (interactions !== originalInteractions) {
|
|
@@ -4407,7 +4514,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
4407
4514
|
});
|
|
4408
4515
|
}
|
|
4409
4516
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
4410
|
-
if (!
|
|
4517
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
4411
4518
|
return;
|
|
4412
4519
|
}
|
|
4413
4520
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -4440,7 +4547,7 @@ function wrapInteractions(interactions) {
|
|
|
4440
4547
|
}
|
|
4441
4548
|
function wrapGenerateContent(original) {
|
|
4442
4549
|
return function(params) {
|
|
4443
|
-
return
|
|
4550
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.generateContent.tracePromise(
|
|
4444
4551
|
() => original(params),
|
|
4445
4552
|
{ arguments: [params] }
|
|
4446
4553
|
);
|
|
@@ -4448,7 +4555,7 @@ function wrapGenerateContent(original) {
|
|
|
4448
4555
|
}
|
|
4449
4556
|
function wrapGenerateContentStream(original) {
|
|
4450
4557
|
return function(params) {
|
|
4451
|
-
return
|
|
4558
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.generateContentStream.tracePromise(
|
|
4452
4559
|
() => original(params),
|
|
4453
4560
|
{ arguments: [params] }
|
|
4454
4561
|
);
|
|
@@ -4456,7 +4563,7 @@ function wrapGenerateContentStream(original) {
|
|
|
4456
4563
|
}
|
|
4457
4564
|
function wrapEmbedContent(original) {
|
|
4458
4565
|
return function(params) {
|
|
4459
|
-
return
|
|
4566
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.embedContent.tracePromise(
|
|
4460
4567
|
() => original(params),
|
|
4461
4568
|
{ arguments: [params] }
|
|
4462
4569
|
);
|
|
@@ -4468,7 +4575,7 @@ function wrapInteractionCreate(original) {
|
|
|
4468
4575
|
return options === void 0 ? original(params) : original(params, options);
|
|
4469
4576
|
}
|
|
4470
4577
|
const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
|
|
4471
|
-
return
|
|
4578
|
+
return _chunkMF7NU6BTjs.googleGenAIChannels.interactionsCreate.tracePromise(
|
|
4472
4579
|
() => options === void 0 ? original(params) : original(params, options),
|
|
4473
4580
|
traceContext
|
|
4474
4581
|
);
|
|
@@ -4529,7 +4636,7 @@ function wrapRunnerInstance(runner) {
|
|
|
4529
4636
|
function wrapRunnerRunAsync(runner) {
|
|
4530
4637
|
const original = runner.runAsync.bind(runner);
|
|
4531
4638
|
return function(params) {
|
|
4532
|
-
return
|
|
4639
|
+
return _chunkMF7NU6BTjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
4533
4640
|
arguments: [params],
|
|
4534
4641
|
self: runner
|
|
4535
4642
|
});
|
|
@@ -4556,7 +4663,7 @@ function wrapAgentInstance2(agent) {
|
|
|
4556
4663
|
function wrapAgentRunAsync(agent) {
|
|
4557
4664
|
const original = agent.runAsync.bind(agent);
|
|
4558
4665
|
return function(parentContext) {
|
|
4559
|
-
return
|
|
4666
|
+
return _chunkMF7NU6BTjs.googleADKChannels.agentRunAsync.traceSync(
|
|
4560
4667
|
() => original(parentContext),
|
|
4561
4668
|
{ arguments: [parentContext], self: agent }
|
|
4562
4669
|
);
|
|
@@ -4583,7 +4690,7 @@ function wrapToolInstance(tool) {
|
|
|
4583
4690
|
function wrapToolRunAsync(tool) {
|
|
4584
4691
|
const original = tool.runAsync.bind(tool);
|
|
4585
4692
|
return function(req) {
|
|
4586
|
-
return
|
|
4693
|
+
return _chunkMF7NU6BTjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
4587
4694
|
arguments: [req],
|
|
4588
4695
|
self: tool
|
|
4589
4696
|
});
|
|
@@ -4730,27 +4837,27 @@ function patchGenkitRegistryConstructor(registry) {
|
|
|
4730
4837
|
}
|
|
4731
4838
|
}
|
|
4732
4839
|
function wrapGenerate(generate) {
|
|
4733
|
-
return (input) =>
|
|
4840
|
+
return (input) => _chunkMF7NU6BTjs.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
4734
4841
|
arguments: [input]
|
|
4735
4842
|
});
|
|
4736
4843
|
}
|
|
4737
4844
|
function wrapGenerateStream(generateStream) {
|
|
4738
|
-
return (input) =>
|
|
4845
|
+
return (input) => _chunkMF7NU6BTjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
4739
4846
|
arguments: [input]
|
|
4740
4847
|
});
|
|
4741
4848
|
}
|
|
4742
4849
|
function wrapEmbed2(embed) {
|
|
4743
|
-
return (params) =>
|
|
4850
|
+
return (params) => _chunkMF7NU6BTjs.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
4744
4851
|
arguments: [params]
|
|
4745
4852
|
});
|
|
4746
4853
|
}
|
|
4747
4854
|
function wrapEmbedMany2(embedMany) {
|
|
4748
|
-
return (params) =>
|
|
4855
|
+
return (params) => _chunkMF7NU6BTjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
4749
4856
|
arguments: [params]
|
|
4750
4857
|
});
|
|
4751
4858
|
}
|
|
4752
4859
|
function wrapRun(run) {
|
|
4753
|
-
return (name, inputOrFn, maybeFn) =>
|
|
4860
|
+
return (name, inputOrFn, maybeFn) => _chunkMF7NU6BTjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
4754
4861
|
arguments: [name, inputOrFn, maybeFn]
|
|
4755
4862
|
});
|
|
4756
4863
|
}
|
|
@@ -4789,13 +4896,13 @@ function isGenkitAction(value) {
|
|
|
4789
4896
|
return typeof value === "function" && "__action" in value;
|
|
4790
4897
|
}
|
|
4791
4898
|
function traceActionRun(action, run) {
|
|
4792
|
-
return (input, options) =>
|
|
4899
|
+
return (input, options) => _chunkMF7NU6BTjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
4793
4900
|
arguments: [input, options],
|
|
4794
4901
|
self: action
|
|
4795
4902
|
});
|
|
4796
4903
|
}
|
|
4797
4904
|
function traceActionStream(action, stream) {
|
|
4798
|
-
return (input, options) =>
|
|
4905
|
+
return (input, options) => _chunkMF7NU6BTjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
4799
4906
|
arguments: [input, options],
|
|
4800
4907
|
self: action
|
|
4801
4908
|
});
|
|
@@ -4841,10 +4948,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
4841
4948
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
4842
4949
|
}
|
|
4843
4950
|
function hasFunction2(value, methodName) {
|
|
4844
|
-
return
|
|
4951
|
+
return _chunkQRHGVBKUjs.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
4845
4952
|
}
|
|
4846
4953
|
function isSupportedHuggingFaceModule(value) {
|
|
4847
|
-
if (!
|
|
4954
|
+
if (!_chunkQRHGVBKUjs.isObject.call(void 0, value)) {
|
|
4848
4955
|
return false;
|
|
4849
4956
|
}
|
|
4850
4957
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -4952,14 +5059,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
4952
5059
|
const context = {
|
|
4953
5060
|
arguments: [traceParams]
|
|
4954
5061
|
};
|
|
4955
|
-
return
|
|
5062
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.chatCompletion.tracePromise(
|
|
4956
5063
|
() => original(params, options),
|
|
4957
5064
|
context
|
|
4958
5065
|
);
|
|
4959
5066
|
};
|
|
4960
5067
|
}
|
|
4961
5068
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
4962
|
-
return (params, options) =>
|
|
5069
|
+
return (params, options) => _chunkMF7NU6BTjs.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
4963
5070
|
() => original(params, options),
|
|
4964
5071
|
{
|
|
4965
5072
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4972,14 +5079,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
4972
5079
|
const context = {
|
|
4973
5080
|
arguments: [traceParams]
|
|
4974
5081
|
};
|
|
4975
|
-
return
|
|
5082
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.textGeneration.tracePromise(
|
|
4976
5083
|
() => original(params, options),
|
|
4977
5084
|
context
|
|
4978
5085
|
);
|
|
4979
5086
|
};
|
|
4980
5087
|
}
|
|
4981
5088
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
4982
|
-
return (params, options) =>
|
|
5089
|
+
return (params, options) => _chunkMF7NU6BTjs.huggingFaceChannels.textGenerationStream.traceSync(
|
|
4983
5090
|
() => original(params, options),
|
|
4984
5091
|
{
|
|
4985
5092
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4992,7 +5099,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
4992
5099
|
const context = {
|
|
4993
5100
|
arguments: [traceParams]
|
|
4994
5101
|
};
|
|
4995
|
-
return
|
|
5102
|
+
return _chunkMF7NU6BTjs.huggingFaceChannels.featureExtraction.tracePromise(
|
|
4996
5103
|
() => original(params, options),
|
|
4997
5104
|
context
|
|
4998
5105
|
);
|
|
@@ -5010,7 +5117,7 @@ var PIPELINE_CONSTRUCTOR_KEYS = /* @__PURE__ */ new Set([
|
|
|
5010
5117
|
var wrappedValues = /* @__PURE__ */ new WeakMap();
|
|
5011
5118
|
function wrapHuggingFaceTransformers(transformers) {
|
|
5012
5119
|
const pipelineTask = _optionalChain([transformers, 'optionalAccess', _124 => _124.task]);
|
|
5013
|
-
if (typeof transformers === "function" &&
|
|
5120
|
+
if (typeof transformers === "function" && _chunkMF7NU6BTjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipelineTask)) {
|
|
5014
5121
|
return wrapPipeline(transformers);
|
|
5015
5122
|
}
|
|
5016
5123
|
if (!isSupportedModule(transformers)) {
|
|
@@ -5062,8 +5169,8 @@ function wrapPipelineFactory(factory) {
|
|
|
5062
5169
|
const context = {
|
|
5063
5170
|
arguments: args
|
|
5064
5171
|
};
|
|
5065
|
-
return
|
|
5066
|
-
if (
|
|
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)))) {
|
|
5067
5174
|
return wrapPipeline(pipeline);
|
|
5068
5175
|
}
|
|
5069
5176
|
return pipeline;
|
|
@@ -5081,7 +5188,7 @@ function wrapPipelineConstructor(constructor) {
|
|
|
5081
5188
|
const proxy = new Proxy(constructor, {
|
|
5082
5189
|
construct(target, args, newTarget) {
|
|
5083
5190
|
const pipeline = Reflect.construct(target, args, newTarget);
|
|
5084
|
-
if (
|
|
5191
|
+
if (_chunkMF7NU6BTjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipeline.task)) {
|
|
5085
5192
|
return wrapPipeline(pipeline);
|
|
5086
5193
|
}
|
|
5087
5194
|
return pipeline;
|
|
@@ -5102,7 +5209,7 @@ function wrapPipeline(pipeline) {
|
|
|
5102
5209
|
arguments: args,
|
|
5103
5210
|
self: target
|
|
5104
5211
|
};
|
|
5105
|
-
return
|
|
5212
|
+
return _chunkMF7NU6BTjs.huggingFaceTransformersChannels.pipelineCall.tracePromise(
|
|
5106
5213
|
() => Reflect.apply(target, thisArg, args),
|
|
5107
5214
|
context
|
|
5108
5215
|
);
|
|
@@ -5153,7 +5260,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
5153
5260
|
const request = cloneCallModelRequest(argArray[0]);
|
|
5154
5261
|
const options = argArray[1];
|
|
5155
5262
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
5156
|
-
return
|
|
5263
|
+
return _chunkMF7NU6BTjs.openRouterAgentChannels.callModel.traceSync(
|
|
5157
5264
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
5158
5265
|
{
|
|
5159
5266
|
arguments: [request]
|
|
@@ -5249,24 +5356,24 @@ function rerankProxy(rerank) {
|
|
|
5249
5356
|
});
|
|
5250
5357
|
}
|
|
5251
5358
|
function wrapChatSend(send) {
|
|
5252
|
-
return (request, options) =>
|
|
5359
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
5253
5360
|
arguments: [request]
|
|
5254
5361
|
});
|
|
5255
5362
|
}
|
|
5256
5363
|
function wrapEmbeddingsGenerate(generate) {
|
|
5257
|
-
return (request, options) =>
|
|
5364
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
5258
5365
|
() => generate(request, options),
|
|
5259
5366
|
{ arguments: [request] }
|
|
5260
5367
|
);
|
|
5261
5368
|
}
|
|
5262
5369
|
function wrapResponsesSend(send) {
|
|
5263
|
-
return (request, options) =>
|
|
5370
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.betaResponsesSend.tracePromise(
|
|
5264
5371
|
() => send(request, options),
|
|
5265
5372
|
{ arguments: [request] }
|
|
5266
5373
|
);
|
|
5267
5374
|
}
|
|
5268
5375
|
function wrapRerank2(rerank) {
|
|
5269
|
-
return (request, options) =>
|
|
5376
|
+
return (request, options) => _chunkMF7NU6BTjs.openRouterChannels.rerankRerank.tracePromise(
|
|
5270
5377
|
() => rerank(request, options),
|
|
5271
5378
|
{ arguments: [request] }
|
|
5272
5379
|
);
|
|
@@ -5274,7 +5381,7 @@ function wrapRerank2(rerank) {
|
|
|
5274
5381
|
function wrapCallModel2(callModel) {
|
|
5275
5382
|
return (request, options) => {
|
|
5276
5383
|
const tracedRequest = { ...request };
|
|
5277
|
-
return
|
|
5384
|
+
return _chunkMF7NU6BTjs.openRouterChannels.callModel.traceSync(
|
|
5278
5385
|
() => callModel(tracedRequest, options),
|
|
5279
5386
|
{
|
|
5280
5387
|
arguments: [tracedRequest]
|
|
@@ -5407,7 +5514,7 @@ function classifiersProxy(classifiers) {
|
|
|
5407
5514
|
});
|
|
5408
5515
|
}
|
|
5409
5516
|
function wrapChatComplete(complete) {
|
|
5410
|
-
return (request, options) =>
|
|
5517
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.chatComplete.tracePromise(
|
|
5411
5518
|
() => complete(request, options),
|
|
5412
5519
|
{
|
|
5413
5520
|
arguments: [request]
|
|
@@ -5415,52 +5522,52 @@ function wrapChatComplete(complete) {
|
|
|
5415
5522
|
);
|
|
5416
5523
|
}
|
|
5417
5524
|
function wrapChatStream(stream) {
|
|
5418
|
-
return (request, options) =>
|
|
5525
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
5419
5526
|
arguments: [request]
|
|
5420
5527
|
});
|
|
5421
5528
|
}
|
|
5422
5529
|
function wrapEmbeddingsCreate(create) {
|
|
5423
|
-
return (request, options) =>
|
|
5530
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.embeddingsCreate.tracePromise(
|
|
5424
5531
|
() => create(request, options),
|
|
5425
5532
|
{ arguments: [request] }
|
|
5426
5533
|
);
|
|
5427
5534
|
}
|
|
5428
5535
|
function wrapClassifiersModerate(moderate) {
|
|
5429
|
-
return (request, options) =>
|
|
5536
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersModerate.tracePromise(
|
|
5430
5537
|
() => moderate(request, options),
|
|
5431
5538
|
{ arguments: [request] }
|
|
5432
5539
|
);
|
|
5433
5540
|
}
|
|
5434
5541
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
5435
|
-
return (request, options) =>
|
|
5542
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersModerateChat.tracePromise(
|
|
5436
5543
|
() => moderateChat(request, options),
|
|
5437
5544
|
{ arguments: [request] }
|
|
5438
5545
|
);
|
|
5439
5546
|
}
|
|
5440
5547
|
function wrapClassifiersClassify(classify) {
|
|
5441
|
-
return (request, options) =>
|
|
5548
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersClassify.tracePromise(
|
|
5442
5549
|
() => classify(request, options),
|
|
5443
5550
|
{ arguments: [request] }
|
|
5444
5551
|
);
|
|
5445
5552
|
}
|
|
5446
5553
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
5447
|
-
return (request, options) =>
|
|
5554
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
5448
5555
|
() => classifyChat(request, options),
|
|
5449
5556
|
{ arguments: [request] }
|
|
5450
5557
|
);
|
|
5451
5558
|
}
|
|
5452
5559
|
function wrapFimComplete(complete) {
|
|
5453
|
-
return (request, options) =>
|
|
5560
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
5454
5561
|
arguments: [request]
|
|
5455
5562
|
});
|
|
5456
5563
|
}
|
|
5457
5564
|
function wrapFimStream(stream) {
|
|
5458
|
-
return (request, options) =>
|
|
5565
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
5459
5566
|
arguments: [request]
|
|
5460
5567
|
});
|
|
5461
5568
|
}
|
|
5462
5569
|
function wrapAgentsComplete(complete) {
|
|
5463
|
-
return (request, options) =>
|
|
5570
|
+
return (request, options) => _chunkMF7NU6BTjs.mistralChannels.agentsComplete.tracePromise(
|
|
5464
5571
|
() => complete(request, options),
|
|
5465
5572
|
{
|
|
5466
5573
|
arguments: [request]
|
|
@@ -5468,7 +5575,84 @@ function wrapAgentsComplete(complete) {
|
|
|
5468
5575
|
);
|
|
5469
5576
|
}
|
|
5470
5577
|
function wrapAgentsStream(stream) {
|
|
5471
|
-
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), {
|
|
5472
5656
|
arguments: [request]
|
|
5473
5657
|
});
|
|
5474
5658
|
}
|
|
@@ -5503,11 +5687,11 @@ function cohereProxy(cohere) {
|
|
|
5503
5687
|
get(target, prop, receiver) {
|
|
5504
5688
|
switch (prop) {
|
|
5505
5689
|
case "chat":
|
|
5506
|
-
return typeof target.chat === "function" ?
|
|
5690
|
+
return typeof target.chat === "function" ? wrapChat2(target.chat.bind(target)) : target.chat;
|
|
5507
5691
|
case "chatStream":
|
|
5508
5692
|
return typeof target.chatStream === "function" ? wrapChatStream2(target.chatStream.bind(target)) : target.chatStream;
|
|
5509
5693
|
case "embed":
|
|
5510
|
-
return typeof target.embed === "function" ?
|
|
5694
|
+
return typeof target.embed === "function" ? wrapEmbed4(target.embed.bind(target)) : target.embed;
|
|
5511
5695
|
case "rerank":
|
|
5512
5696
|
return typeof target.rerank === "function" ? wrapRerank3(target.rerank.bind(target)) : target.rerank;
|
|
5513
5697
|
default: {
|
|
@@ -5520,23 +5704,23 @@ function cohereProxy(cohere) {
|
|
|
5520
5704
|
cohereProxyCache.set(cohere, proxy);
|
|
5521
5705
|
return proxy;
|
|
5522
5706
|
}
|
|
5523
|
-
function
|
|
5524
|
-
return (request, options) =>
|
|
5707
|
+
function wrapChat2(chat) {
|
|
5708
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
5525
5709
|
arguments: [request]
|
|
5526
5710
|
});
|
|
5527
5711
|
}
|
|
5528
5712
|
function wrapChatStream2(chatStream) {
|
|
5529
|
-
return (request, options) =>
|
|
5713
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
5530
5714
|
arguments: [request]
|
|
5531
5715
|
});
|
|
5532
5716
|
}
|
|
5533
|
-
function
|
|
5534
|
-
return (request, options) =>
|
|
5717
|
+
function wrapEmbed4(embed) {
|
|
5718
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
5535
5719
|
arguments: [request]
|
|
5536
5720
|
});
|
|
5537
5721
|
}
|
|
5538
5722
|
function wrapRerank3(rerank) {
|
|
5539
|
-
return (request, options) =>
|
|
5723
|
+
return (request, options) => _chunkMF7NU6BTjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
5540
5724
|
arguments: [request]
|
|
5541
5725
|
});
|
|
5542
5726
|
}
|
|
@@ -5618,13 +5802,13 @@ function groqProxy(groq) {
|
|
|
5618
5802
|
return topLevelProxy;
|
|
5619
5803
|
}
|
|
5620
5804
|
function wrapChatCompletionsCreate(create) {
|
|
5621
|
-
return (request, options) =>
|
|
5805
|
+
return (request, options) => _chunkMF7NU6BTjs.groqChannels.chatCompletionsCreate.tracePromise(
|
|
5622
5806
|
() => create(request, options),
|
|
5623
5807
|
{ arguments: [request] }
|
|
5624
5808
|
);
|
|
5625
5809
|
}
|
|
5626
5810
|
function wrapEmbeddingsCreate2(create) {
|
|
5627
|
-
return (request, options) =>
|
|
5811
|
+
return (request, options) => _chunkMF7NU6BTjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
5628
5812
|
arguments: [request]
|
|
5629
5813
|
});
|
|
5630
5814
|
}
|
|
@@ -5698,16 +5882,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
5698
5882
|
}
|
|
5699
5883
|
function wrapSend(send) {
|
|
5700
5884
|
return (command, optionsOrCb, cb) => {
|
|
5701
|
-
if (
|
|
5885
|
+
if (_chunkQRHGVBKUjs.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
5702
5886
|
return send(command, optionsOrCb, cb);
|
|
5703
5887
|
}
|
|
5704
|
-
return
|
|
5705
|
-
() =>
|
|
5888
|
+
return _chunkMF7NU6BTjs.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
5889
|
+
() => _chunkQRHGVBKUjs.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
5706
5890
|
() => send(command, optionsOrCb)
|
|
5707
5891
|
),
|
|
5708
5892
|
{
|
|
5709
5893
|
arguments: [command, optionsOrCb],
|
|
5710
|
-
span_info:
|
|
5894
|
+
span_info: _chunkQRHGVBKUjs.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
5711
5895
|
}
|
|
5712
5896
|
);
|
|
5713
5897
|
};
|
|
@@ -5756,13 +5940,13 @@ function copilotClientProxy(client) {
|
|
|
5756
5940
|
return proxy;
|
|
5757
5941
|
}
|
|
5758
5942
|
function wrappedCreateSession(client) {
|
|
5759
|
-
return (config) =>
|
|
5943
|
+
return (config) => _chunkMF7NU6BTjs.gitHubCopilotChannels.createSession.tracePromise(
|
|
5760
5944
|
() => client.createSession(config),
|
|
5761
5945
|
{ arguments: [config] }
|
|
5762
5946
|
);
|
|
5763
5947
|
}
|
|
5764
5948
|
function wrappedResumeSession(client) {
|
|
5765
|
-
return (sessionId, config) =>
|
|
5949
|
+
return (sessionId, config) => _chunkMF7NU6BTjs.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
5766
5950
|
() => client.resumeSession(sessionId, config),
|
|
5767
5951
|
{ arguments: [sessionId, config] }
|
|
5768
5952
|
);
|
|
@@ -5940,13 +6124,13 @@ function wrapRunTreeInstance(runTree) {
|
|
|
5940
6124
|
wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
|
|
5941
6125
|
} else if (prop === "postRun") {
|
|
5942
6126
|
const method = value;
|
|
5943
|
-
wrapped = (...args) =>
|
|
6127
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.createRun.tracePromise(
|
|
5944
6128
|
() => Reflect.apply(method, target, args),
|
|
5945
6129
|
{ arguments: [target] }
|
|
5946
6130
|
);
|
|
5947
6131
|
} else if (prop === "patchRun") {
|
|
5948
6132
|
const method = value;
|
|
5949
|
-
wrapped = (...args) =>
|
|
6133
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(
|
|
5950
6134
|
() => Reflect.apply(method, target, args),
|
|
5951
6135
|
{
|
|
5952
6136
|
arguments: [
|
|
@@ -5995,19 +6179,19 @@ function wrapClientInstance(client) {
|
|
|
5995
6179
|
let wrapped;
|
|
5996
6180
|
if (prop === "createRun") {
|
|
5997
6181
|
const method = value;
|
|
5998
|
-
wrapped = (...args) =>
|
|
6182
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.createRun.tracePromise(
|
|
5999
6183
|
() => Reflect.apply(method, target, args),
|
|
6000
6184
|
{ arguments: args }
|
|
6001
6185
|
);
|
|
6002
6186
|
} else if (prop === "updateRun") {
|
|
6003
6187
|
const method = value;
|
|
6004
|
-
wrapped = (...args) =>
|
|
6188
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(
|
|
6005
6189
|
() => Reflect.apply(method, target, args),
|
|
6006
6190
|
{ arguments: args }
|
|
6007
6191
|
);
|
|
6008
6192
|
} else if (prop === "batchIngestRuns") {
|
|
6009
6193
|
const method = value;
|
|
6010
|
-
wrapped = (...args) =>
|
|
6194
|
+
wrapped = (...args) => _chunkMF7NU6BTjs.langSmithChannels.batchIngestRuns.tracePromise(
|
|
6011
6195
|
() => Reflect.apply(method, target, args),
|
|
6012
6196
|
{ arguments: args }
|
|
6013
6197
|
);
|
|
@@ -6023,13 +6207,13 @@ function publishRunUpdate(runTree) {
|
|
|
6023
6207
|
return;
|
|
6024
6208
|
}
|
|
6025
6209
|
try {
|
|
6026
|
-
void
|
|
6210
|
+
void _chunkMF7NU6BTjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
6027
6211
|
arguments: [runTree.id, runTree]
|
|
6028
6212
|
}).catch((error) => {
|
|
6029
|
-
|
|
6213
|
+
_chunkQRHGVBKUjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
6030
6214
|
});
|
|
6031
6215
|
} catch (error) {
|
|
6032
|
-
|
|
6216
|
+
_chunkQRHGVBKUjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
6033
6217
|
}
|
|
6034
6218
|
}
|
|
6035
6219
|
|
|
@@ -6041,7 +6225,7 @@ var VitestContextManager = class {
|
|
|
6041
6225
|
*/
|
|
6042
6226
|
|
|
6043
6227
|
constructor() {
|
|
6044
|
-
this.contextStorage =
|
|
6228
|
+
this.contextStorage = _chunkMF7NU6BTjs.isomorph_default.newAsyncLocalStorage();
|
|
6045
6229
|
}
|
|
6046
6230
|
getCurrentContext() {
|
|
6047
6231
|
return this.contextStorage.getStore();
|
|
@@ -6082,7 +6266,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
|
|
|
6082
6266
|
if (this.activeFlushes.has(experimentId)) {
|
|
6083
6267
|
return this.activeFlushes.get(experimentId);
|
|
6084
6268
|
}
|
|
6085
|
-
const flushPromise =
|
|
6269
|
+
const flushPromise = _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, context.experiment, {
|
|
6086
6270
|
displaySummary: config.displaySummary
|
|
6087
6271
|
});
|
|
6088
6272
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -6180,7 +6364,7 @@ async function runTracedEval(args) {
|
|
|
6180
6364
|
}
|
|
6181
6365
|
if (testError) {
|
|
6182
6366
|
span.log({ scores: { pass: 0 } });
|
|
6183
|
-
|
|
6367
|
+
_chunkQRHGVBKUjs.logError.call(void 0, span, testError);
|
|
6184
6368
|
throw testError;
|
|
6185
6369
|
}
|
|
6186
6370
|
span.log({
|
|
@@ -6354,10 +6538,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
6354
6538
|
const getOrCreateContext = () => {
|
|
6355
6539
|
if (!context) {
|
|
6356
6540
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
6357
|
-
const experiment = config.projectId ?
|
|
6541
|
+
const experiment = config.projectId ? _chunkQRHGVBKUjs.initExperiment.call(void 0, {
|
|
6358
6542
|
projectId: config.projectId,
|
|
6359
6543
|
experiment: experimentName
|
|
6360
|
-
}) :
|
|
6544
|
+
}) : _chunkQRHGVBKUjs.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
6361
6545
|
experiment: experimentName
|
|
6362
6546
|
});
|
|
6363
6547
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -6465,7 +6649,7 @@ function wrapExpect(originalExpect) {
|
|
|
6465
6649
|
return originalExpect(value);
|
|
6466
6650
|
}
|
|
6467
6651
|
const assertion = originalExpect(value, message);
|
|
6468
|
-
const span =
|
|
6652
|
+
const span = _chunkQRHGVBKUjs.currentSpan.call(void 0, );
|
|
6469
6653
|
if (!span) {
|
|
6470
6654
|
return assertion;
|
|
6471
6655
|
}
|
|
@@ -6477,16 +6661,16 @@ function wrapExpect(originalExpect) {
|
|
|
6477
6661
|
|
|
6478
6662
|
// src/wrappers/shared/logging.ts
|
|
6479
6663
|
function logOutputs(outputs) {
|
|
6480
|
-
|
|
6664
|
+
_chunkQRHGVBKUjs.currentSpan.call(void 0, ).log({ output: outputs });
|
|
6481
6665
|
}
|
|
6482
6666
|
function logFeedback(feedback) {
|
|
6483
|
-
|
|
6667
|
+
_chunkQRHGVBKUjs.currentSpan.call(void 0, ).log({
|
|
6484
6668
|
scores: { [feedback.name]: feedback.score },
|
|
6485
6669
|
metadata: feedback.metadata
|
|
6486
6670
|
});
|
|
6487
6671
|
}
|
|
6488
6672
|
function getCurrentSpan() {
|
|
6489
|
-
return
|
|
6673
|
+
return _chunkQRHGVBKUjs.currentSpan.call(void 0, );
|
|
6490
6674
|
}
|
|
6491
6675
|
|
|
6492
6676
|
// src/wrappers/vitest/index.ts
|
|
@@ -6534,7 +6718,7 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
6534
6718
|
);
|
|
6535
6719
|
return;
|
|
6536
6720
|
}
|
|
6537
|
-
await
|
|
6721
|
+
await _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
6538
6722
|
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _139 => _139.displaySummary]), () => ( config.displaySummary))
|
|
6539
6723
|
});
|
|
6540
6724
|
}
|
|
@@ -6549,7 +6733,7 @@ function initNodeTestSuite(config) {
|
|
|
6549
6733
|
return experiment;
|
|
6550
6734
|
}
|
|
6551
6735
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
6552
|
-
experiment =
|
|
6736
|
+
experiment = _chunkQRHGVBKUjs.initExperiment.call(void 0, config.projectName, {
|
|
6553
6737
|
experiment: experimentName
|
|
6554
6738
|
});
|
|
6555
6739
|
return experiment;
|
|
@@ -6598,7 +6782,7 @@ function initNodeTestSuite(config) {
|
|
|
6598
6782
|
if (!experiment) {
|
|
6599
6783
|
return;
|
|
6600
6784
|
}
|
|
6601
|
-
await
|
|
6785
|
+
await _chunkQRHGVBKUjs.summarizeAndFlush.call(void 0, experiment, {
|
|
6602
6786
|
displaySummary: config.displaySummary
|
|
6603
6787
|
});
|
|
6604
6788
|
experiment = void 0;
|
|
@@ -6615,7 +6799,7 @@ function initNodeTestSuite(config) {
|
|
|
6615
6799
|
|
|
6616
6800
|
// src/graph-framework.ts
|
|
6617
6801
|
var graph_framework_exports = {};
|
|
6618
|
-
|
|
6802
|
+
_chunkMF7NU6BTjs.__export.call(void 0, graph_framework_exports, {
|
|
6619
6803
|
AggregatorNode: () => AggregatorNode,
|
|
6620
6804
|
GateNode: () => GateNode,
|
|
6621
6805
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -6689,7 +6873,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6689
6873
|
};
|
|
6690
6874
|
}
|
|
6691
6875
|
resolveNode(node) {
|
|
6692
|
-
if (node instanceof
|
|
6876
|
+
if (node instanceof _chunkQRHGVBKUjs.Prompt) {
|
|
6693
6877
|
const cached = this.nodeLikeNodes.get(node);
|
|
6694
6878
|
if (cached) {
|
|
6695
6879
|
return [cached, []];
|
|
@@ -6739,7 +6923,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6739
6923
|
// }
|
|
6740
6924
|
// Helper to generate node IDs
|
|
6741
6925
|
generateId(name) {
|
|
6742
|
-
const uuid =
|
|
6926
|
+
const uuid = _chunkQRHGVBKUjs.newId.call(void 0, );
|
|
6743
6927
|
if (name) {
|
|
6744
6928
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
6745
6929
|
} else {
|
|
@@ -7939,7 +8123,7 @@ function waterfall(tasks, callback) {
|
|
|
7939
8123
|
var waterfall$1 = awaitify(waterfall);
|
|
7940
8124
|
|
|
7941
8125
|
// src/trace.ts
|
|
7942
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
8126
|
+
var SpanFetcher = class _SpanFetcher extends _chunkQRHGVBKUjs.ObjectFetcher {
|
|
7943
8127
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
7944
8128
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
7945
8129
|
rootSpanId,
|
|
@@ -8256,20 +8440,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
8256
8440
|
prompt: _v3.z.string()
|
|
8257
8441
|
}),
|
|
8258
8442
|
_v3.z.object({
|
|
8259
|
-
messages: _v3.z.array(
|
|
8443
|
+
messages: _v3.z.array(_chunkQRHGVBKUjs.ChatCompletionMessageParam)
|
|
8260
8444
|
})
|
|
8261
8445
|
]);
|
|
8262
8446
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
8263
8447
|
_v3.z.object({
|
|
8264
8448
|
model: _v3.z.string(),
|
|
8265
|
-
params:
|
|
8449
|
+
params: _chunkQRHGVBKUjs.ModelParams.optional(),
|
|
8266
8450
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
8267
8451
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
8268
8452
|
})
|
|
8269
8453
|
);
|
|
8270
8454
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
8271
8455
|
_v3.z.object({
|
|
8272
|
-
tools: _v3.z.array(
|
|
8456
|
+
tools: _v3.z.array(_chunkQRHGVBKUjs.ToolFunctionDefinition).optional()
|
|
8273
8457
|
})
|
|
8274
8458
|
);
|
|
8275
8459
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -8317,7 +8501,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
8317
8501
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
8318
8502
|
return parameters;
|
|
8319
8503
|
}
|
|
8320
|
-
if (
|
|
8504
|
+
if (_chunkQRHGVBKUjs.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
8321
8505
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
8322
8506
|
...resolvedSchema.data,
|
|
8323
8507
|
...parameters
|
|
@@ -8339,14 +8523,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
8339
8523
|
const value = parameters[name];
|
|
8340
8524
|
try {
|
|
8341
8525
|
if ("type" in schema && schema.type === "prompt") {
|
|
8342
|
-
const promptData = value ?
|
|
8526
|
+
const promptData = value ? _chunkQRHGVBKUjs.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
8343
8527
|
schema.default,
|
|
8344
8528
|
schema.default.tools
|
|
8345
8529
|
) : void 0;
|
|
8346
8530
|
if (!promptData) {
|
|
8347
8531
|
throw new Error(`Parameter '${name}' is required`);
|
|
8348
8532
|
}
|
|
8349
|
-
return [name,
|
|
8533
|
+
return [name, _chunkQRHGVBKUjs.Prompt.fromPromptData(name, promptData)];
|
|
8350
8534
|
} else if ("type" in schema && schema.type === "model") {
|
|
8351
8535
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
8352
8536
|
if (model === void 0) {
|
|
@@ -8397,7 +8581,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
8397
8581
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
8398
8582
|
return [
|
|
8399
8583
|
name,
|
|
8400
|
-
|
|
8584
|
+
_chunkQRHGVBKUjs.Prompt.fromPromptData(name, _chunkQRHGVBKUjs.PromptData.parse(value))
|
|
8401
8585
|
];
|
|
8402
8586
|
}
|
|
8403
8587
|
return [name, value];
|
|
@@ -8447,7 +8631,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
8447
8631
|
return out;
|
|
8448
8632
|
}
|
|
8449
8633
|
function initExperiment2(state, options = {}) {
|
|
8450
|
-
return
|
|
8634
|
+
return _chunkQRHGVBKUjs.init.call(void 0, {
|
|
8451
8635
|
state,
|
|
8452
8636
|
...options,
|
|
8453
8637
|
setCurrent: false
|
|
@@ -8458,7 +8642,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
8458
8642
|
return void 0;
|
|
8459
8643
|
}
|
|
8460
8644
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
8461
|
-
if (!
|
|
8645
|
+
if (!_chunkQRHGVBKUjs.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
8462
8646
|
return void 0;
|
|
8463
8647
|
}
|
|
8464
8648
|
if (resolvedParameters.id === void 0) {
|
|
@@ -8494,10 +8678,10 @@ globalThis._evals = {
|
|
|
8494
8678
|
reporters: {}
|
|
8495
8679
|
};
|
|
8496
8680
|
function _initializeSpanContext() {
|
|
8497
|
-
globalThis._spanContext = { currentSpan:
|
|
8681
|
+
globalThis._spanContext = { currentSpan: _chunkQRHGVBKUjs.currentSpan, withCurrent: _chunkQRHGVBKUjs.withCurrent, startSpan: _chunkQRHGVBKUjs.startSpan, NOOP_SPAN: _chunkQRHGVBKUjs.NOOP_SPAN };
|
|
8498
8682
|
}
|
|
8499
8683
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
8500
|
-
const options =
|
|
8684
|
+
const options = _chunkQRHGVBKUjs.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
8501
8685
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
8502
8686
|
if (globalThis._evals.evaluators[evalName]) {
|
|
8503
8687
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -8548,7 +8732,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8548
8732
|
baseExperimentId: evaluator.baseExperimentId,
|
|
8549
8733
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
8550
8734
|
repoInfo: evaluator.repoInfo,
|
|
8551
|
-
dataset:
|
|
8735
|
+
dataset: _chunkQRHGVBKUjs.Dataset.isDataset(data) ? data : void 0,
|
|
8552
8736
|
parameters
|
|
8553
8737
|
});
|
|
8554
8738
|
if (experiment && typeof process !== "undefined" && globalThis.BRAINTRUST_CONTEXT_MANAGER !== void 0) {
|
|
@@ -8568,7 +8752,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8568
8752
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
8569
8753
|
let ret;
|
|
8570
8754
|
if (options.parent) {
|
|
8571
|
-
ret = await
|
|
8755
|
+
ret = await _chunkQRHGVBKUjs.withParent.call(void 0,
|
|
8572
8756
|
options.parent,
|
|
8573
8757
|
() => runEvaluator(
|
|
8574
8758
|
null,
|
|
@@ -8604,7 +8788,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
8604
8788
|
if (experiment) {
|
|
8605
8789
|
await experiment.flush().catch(console.error);
|
|
8606
8790
|
} else if (options.parent) {
|
|
8607
|
-
await
|
|
8791
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
8608
8792
|
}
|
|
8609
8793
|
}
|
|
8610
8794
|
} finally {
|
|
@@ -8650,13 +8834,13 @@ function classifierName(classifier, classifier_idx) {
|
|
|
8650
8834
|
}
|
|
8651
8835
|
function buildSpanMetadata(results) {
|
|
8652
8836
|
return results.length === 1 ? results[0].metadata : results.reduce(
|
|
8653
|
-
(prev, s) =>
|
|
8837
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, { [s.name]: s.metadata }),
|
|
8654
8838
|
{}
|
|
8655
8839
|
);
|
|
8656
8840
|
}
|
|
8657
8841
|
function buildSpanScores(results) {
|
|
8658
8842
|
const scoresRecord = results.reduce(
|
|
8659
|
-
(prev, s) =>
|
|
8843
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, { [s.name]: s.score }),
|
|
8660
8844
|
{}
|
|
8661
8845
|
);
|
|
8662
8846
|
return { resultMetadata: buildSpanMetadata(results), scoresRecord };
|
|
@@ -8686,7 +8870,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
8686
8870
|
return failing;
|
|
8687
8871
|
}
|
|
8688
8872
|
function validateClassificationResult(value, scorerName2) {
|
|
8689
|
-
if (!(typeof value === "object" && value !== null && !
|
|
8873
|
+
if (!(typeof value === "object" && value !== null && !_chunkQRHGVBKUjs.isEmpty.call(void 0, value))) {
|
|
8690
8874
|
throw new Error(
|
|
8691
8875
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
8692
8876
|
);
|
|
@@ -8715,7 +8899,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
8715
8899
|
);
|
|
8716
8900
|
metadata[`${kind}_errors`] = errorMap;
|
|
8717
8901
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
8718
|
-
|
|
8902
|
+
_chunkQRHGVBKUjs.debugLogger.forState(state).warn(
|
|
8719
8903
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
8720
8904
|
failures.map((f) => f.error)
|
|
8721
8905
|
);
|
|
@@ -8749,7 +8933,7 @@ var defaultErrorScoreHandler = ({
|
|
|
8749
8933
|
};
|
|
8750
8934
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
8751
8935
|
if (enableCache) {
|
|
8752
|
-
_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()]);
|
|
8753
8937
|
}
|
|
8754
8938
|
try {
|
|
8755
8939
|
if (typeof evaluator.data === "string") {
|
|
@@ -8770,7 +8954,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8770
8954
|
);
|
|
8771
8955
|
}
|
|
8772
8956
|
let name = dataResult.name;
|
|
8773
|
-
if (
|
|
8957
|
+
if (_chunkQRHGVBKUjs.isEmpty.call(void 0, name)) {
|
|
8774
8958
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
8775
8959
|
if (!baseExperiment) {
|
|
8776
8960
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -8820,7 +9004,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8820
9004
|
if (cancelled) {
|
|
8821
9005
|
return;
|
|
8822
9006
|
}
|
|
8823
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
9007
|
+
const eventDataset = experiment ? experiment.dataset : _chunkQRHGVBKUjs.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
8824
9008
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
8825
9009
|
object_type: "dataset",
|
|
8826
9010
|
object_id: await eventDataset.id,
|
|
@@ -8828,7 +9012,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8828
9012
|
created: datum.created,
|
|
8829
9013
|
_xact_id: datum._xact_id
|
|
8830
9014
|
} : void 0;
|
|
8831
|
-
const parsedDatumOrigin =
|
|
9015
|
+
const parsedDatumOrigin = _chunkQRHGVBKUjs.ObjectReference.safeParse(datum.origin);
|
|
8832
9016
|
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _156 => _156.success]) ? parsedDatumOrigin.data : void 0)));
|
|
8833
9017
|
const baseEvent = {
|
|
8834
9018
|
name: "eval",
|
|
@@ -8844,23 +9028,23 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8844
9028
|
}
|
|
8845
9029
|
};
|
|
8846
9030
|
const callback = async (rootSpan) => {
|
|
8847
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
9031
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )));
|
|
8848
9032
|
const ensureSpansFlushed = async () => {
|
|
8849
9033
|
if (experiment) {
|
|
8850
|
-
await
|
|
9034
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state: experiment.loggingState });
|
|
8851
9035
|
} else if (state) {
|
|
8852
|
-
await
|
|
9036
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, { state });
|
|
8853
9037
|
} else {
|
|
8854
|
-
await
|
|
9038
|
+
await _chunkQRHGVBKUjs.flush.call(void 0, );
|
|
8855
9039
|
}
|
|
8856
9040
|
if (state) {
|
|
8857
9041
|
await state.flushOtel();
|
|
8858
9042
|
}
|
|
8859
9043
|
};
|
|
8860
9044
|
const parentStr = state.currentParent.getStore();
|
|
8861
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
9045
|
+
const parentComponents = typeof parentStr === "string" ? _chunkQRHGVBKUjs.SpanComponentsV4.fromStr(parentStr) : null;
|
|
8862
9046
|
const trace = state ? new LocalTrace({
|
|
8863
|
-
objectType: parentComponents ?
|
|
9047
|
+
objectType: parentComponents ? _chunkQRHGVBKUjs.spanObjectTypeV3ToTypedString.call(void 0,
|
|
8864
9048
|
parentComponents.data.object_type
|
|
8865
9049
|
) : "experiment",
|
|
8866
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 () => ( "")) : ""))),
|
|
@@ -8935,7 +9119,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8935
9119
|
trace
|
|
8936
9120
|
};
|
|
8937
9121
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
8938
|
-
const propagatedEvent =
|
|
9122
|
+
const propagatedEvent = _chunkQRHGVBKUjs.makeScorerPropagatedEvent.call(void 0,
|
|
8939
9123
|
await rootSpan.export()
|
|
8940
9124
|
);
|
|
8941
9125
|
const getOtherFields = (s) => {
|
|
@@ -8958,14 +9142,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8958
9142
|
if (scoreValue === null) return null;
|
|
8959
9143
|
if (Array.isArray(scoreValue)) {
|
|
8960
9144
|
for (const s of scoreValue) {
|
|
8961
|
-
if (!(typeof s === "object" && !
|
|
9145
|
+
if (!(typeof s === "object" && !_chunkQRHGVBKUjs.isEmpty.call(void 0, s))) {
|
|
8962
9146
|
throw new Error(
|
|
8963
9147
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(s)}`
|
|
8964
9148
|
);
|
|
8965
9149
|
}
|
|
8966
9150
|
}
|
|
8967
9151
|
}
|
|
8968
|
-
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] : [
|
|
8969
9153
|
{
|
|
8970
9154
|
name: scorerNames[score_idx],
|
|
8971
9155
|
score: scoreValue
|
|
@@ -8973,7 +9157,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8973
9157
|
];
|
|
8974
9158
|
const { resultMetadata, scoresRecord } = buildSpanScores(results);
|
|
8975
9159
|
const resultOutput = results.length === 1 ? getOtherFields(results[0]) : results.reduce(
|
|
8976
|
-
(prev, s) =>
|
|
9160
|
+
(prev, s) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, {
|
|
8977
9161
|
[s.name]: getOtherFields(s)
|
|
8978
9162
|
}),
|
|
8979
9163
|
{}
|
|
@@ -9008,7 +9192,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9008
9192
|
)
|
|
9009
9193
|
);
|
|
9010
9194
|
const resultOutput = rawResults.length === 1 ? toClassificationItem(rawResults[0]) : rawResults.reduce(
|
|
9011
|
-
(prev, r) =>
|
|
9195
|
+
(prev, r) => _chunkQRHGVBKUjs.mergeDicts.call(void 0, prev, {
|
|
9012
9196
|
[r.name]: toClassificationItem(r)
|
|
9013
9197
|
}),
|
|
9014
9198
|
{}
|
|
@@ -9060,7 +9244,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9060
9244
|
evaluator.state
|
|
9061
9245
|
);
|
|
9062
9246
|
} catch (e) {
|
|
9063
|
-
|
|
9247
|
+
_chunkQRHGVBKUjs.logError.call(void 0, rootSpan, e);
|
|
9064
9248
|
error = e;
|
|
9065
9249
|
} finally {
|
|
9066
9250
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -9094,7 +9278,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9094
9278
|
}
|
|
9095
9279
|
};
|
|
9096
9280
|
if (!experiment) {
|
|
9097
|
-
return await
|
|
9281
|
+
return await _chunkQRHGVBKUjs.traced.call(void 0, callback, {
|
|
9098
9282
|
...baseEvent,
|
|
9099
9283
|
state: evaluator.state
|
|
9100
9284
|
});
|
|
@@ -9148,7 +9332,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9148
9332
|
const cancel = async () => {
|
|
9149
9333
|
await new Promise((_, reject2) => {
|
|
9150
9334
|
if (cancelled) {
|
|
9151
|
-
reject2(new (0,
|
|
9335
|
+
reject2(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator already cancelled"));
|
|
9152
9336
|
return;
|
|
9153
9337
|
}
|
|
9154
9338
|
const rejectOnce = (error) => {
|
|
@@ -9161,12 +9345,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9161
9345
|
};
|
|
9162
9346
|
if (evaluator.timeout) {
|
|
9163
9347
|
timeoutId = setTimeout(() => {
|
|
9164
|
-
rejectOnce(new (0,
|
|
9348
|
+
rejectOnce(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator timed out"));
|
|
9165
9349
|
}, evaluator.timeout);
|
|
9166
9350
|
}
|
|
9167
9351
|
if (evaluator.signal) {
|
|
9168
9352
|
abortHandler = () => {
|
|
9169
|
-
rejectOnce(new (0,
|
|
9353
|
+
rejectOnce(new (0, _chunkQRHGVBKUjs.InternalAbortError)("Evaluator aborted"));
|
|
9170
9354
|
};
|
|
9171
9355
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
9172
9356
|
}
|
|
@@ -9189,9 +9373,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9189
9373
|
}
|
|
9190
9374
|
} catch (e) {
|
|
9191
9375
|
q.kill();
|
|
9192
|
-
if (e instanceof
|
|
9193
|
-
if (
|
|
9194
|
-
|
|
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);
|
|
9195
9379
|
}
|
|
9196
9380
|
}
|
|
9197
9381
|
throw e;
|
|
@@ -9216,7 +9400,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
9216
9400
|
);
|
|
9217
9401
|
} finally {
|
|
9218
9402
|
if (enableCache) {
|
|
9219
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
9403
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _166 => _166.spanCache]);
|
|
9220
9404
|
_optionalChain([spanCache, 'optionalAccess', _167 => _167.dispose, 'call', _168 => _168()]);
|
|
9221
9405
|
_optionalChain([spanCache, 'optionalAccess', _169 => _169.stop, 'call', _170 => _170()]);
|
|
9222
9406
|
}
|
|
@@ -9311,25 +9495,25 @@ var defaultReporter = {
|
|
|
9311
9495
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
9312
9496
|
}
|
|
9313
9497
|
if (jsonl) {
|
|
9314
|
-
|
|
9498
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(JSON.stringify(summary));
|
|
9315
9499
|
} else {
|
|
9316
|
-
|
|
9317
|
-
|
|
9500
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("Experiment summary");
|
|
9501
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("==================");
|
|
9318
9502
|
if (summary.comparisonExperimentName) {
|
|
9319
|
-
|
|
9503
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9320
9504
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
9321
9505
|
);
|
|
9322
|
-
|
|
9506
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("");
|
|
9323
9507
|
}
|
|
9324
9508
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
9325
9509
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
9326
9510
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
9327
9511
|
if (hasScores || hasMetrics) {
|
|
9328
9512
|
if (hasComparison) {
|
|
9329
|
-
|
|
9513
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9330
9514
|
"Name Value Change Improvements Regressions"
|
|
9331
9515
|
);
|
|
9332
|
-
|
|
9516
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9333
9517
|
"----------------------------------------------------------------"
|
|
9334
9518
|
);
|
|
9335
9519
|
}
|
|
@@ -9338,18 +9522,18 @@ var defaultReporter = {
|
|
|
9338
9522
|
const scoreValue = `${scorePercent}%`;
|
|
9339
9523
|
if (hasComparison) {
|
|
9340
9524
|
let diffString = "-";
|
|
9341
|
-
if (!
|
|
9525
|
+
if (!_chunkQRHGVBKUjs.isEmpty.call(void 0, score.diff)) {
|
|
9342
9526
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
9343
9527
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
9344
9528
|
diffString = `${diffSign}${diffPercent}%`;
|
|
9345
9529
|
}
|
|
9346
9530
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
9347
9531
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
9348
|
-
|
|
9532
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9349
9533
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
9350
9534
|
);
|
|
9351
9535
|
} else {
|
|
9352
|
-
|
|
9536
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
9353
9537
|
}
|
|
9354
9538
|
}
|
|
9355
9539
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -9358,30 +9542,30 @@ var defaultReporter = {
|
|
|
9358
9542
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
9359
9543
|
if (hasComparison) {
|
|
9360
9544
|
let diffString = "-";
|
|
9361
|
-
if (!
|
|
9545
|
+
if (!_chunkQRHGVBKUjs.isEmpty.call(void 0, metric.diff)) {
|
|
9362
9546
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
9363
9547
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
9364
9548
|
diffString = `${diffSign}${diffPercent}%`;
|
|
9365
9549
|
}
|
|
9366
9550
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
9367
9551
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
9368
|
-
|
|
9552
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9369
9553
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
9370
9554
|
);
|
|
9371
9555
|
} else {
|
|
9372
|
-
|
|
9556
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln(
|
|
9373
9557
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
9374
9558
|
);
|
|
9375
9559
|
}
|
|
9376
9560
|
}
|
|
9377
9561
|
}
|
|
9378
9562
|
if (summary.experimentUrl) {
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
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}`);
|
|
9382
9566
|
}
|
|
9383
9567
|
}
|
|
9384
|
-
|
|
9568
|
+
_chunkMF7NU6BTjs.isomorph_default.writeln("");
|
|
9385
9569
|
return failingResults.length === 0;
|
|
9386
9570
|
},
|
|
9387
9571
|
async reportRun(evalReports) {
|
|
@@ -9816,7 +10000,7 @@ var Project2 = (_class7 = class {
|
|
|
9816
10000
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
9817
10001
|
return;
|
|
9818
10002
|
}
|
|
9819
|
-
await
|
|
10003
|
+
await _chunkQRHGVBKUjs.login.call(void 0, );
|
|
9820
10004
|
const projectMap = new ProjectNameIdMap();
|
|
9821
10005
|
const functionDefinitions = [];
|
|
9822
10006
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -9830,7 +10014,7 @@ var Project2 = (_class7 = class {
|
|
|
9830
10014
|
functionDefinitions.push(functionDefinition);
|
|
9831
10015
|
}
|
|
9832
10016
|
}
|
|
9833
|
-
await
|
|
10017
|
+
await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
9834
10018
|
functions: functionDefinitions
|
|
9835
10019
|
});
|
|
9836
10020
|
}
|
|
@@ -9849,12 +10033,12 @@ var ToolBuilder = (_class8 = class {
|
|
|
9849
10033
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
9850
10034
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
9851
10035
|
if (resolvedName.trim().length === 0) {
|
|
9852
|
-
resolvedName = `Tool ${
|
|
10036
|
+
resolvedName = `Tool ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9853
10037
|
}
|
|
9854
10038
|
const tool = new CodeFunction(this.project, {
|
|
9855
10039
|
handler,
|
|
9856
10040
|
name: resolvedName,
|
|
9857
|
-
slug: _nullishCoalesce(slug, () => (
|
|
10041
|
+
slug: _nullishCoalesce(slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
9858
10042
|
type: "tool",
|
|
9859
10043
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
9860
10044
|
parameters,
|
|
@@ -9879,9 +10063,9 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9879
10063
|
resolvedName = opts.handler.name;
|
|
9880
10064
|
}
|
|
9881
10065
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9882
|
-
resolvedName = `Scorer ${
|
|
10066
|
+
resolvedName = `Scorer ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9883
10067
|
}
|
|
9884
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10068
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9885
10069
|
if ("handler" in opts) {
|
|
9886
10070
|
const scorer = new CodeFunction(this.project, {
|
|
9887
10071
|
...opts,
|
|
@@ -9936,9 +10120,9 @@ var ClassifierBuilder = (_class10 = class {
|
|
|
9936
10120
|
this.taskCounter++;
|
|
9937
10121
|
let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
|
|
9938
10122
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9939
|
-
resolvedName = `Classifier ${
|
|
10123
|
+
resolvedName = `Classifier ${_chunkMF7NU6BTjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9940
10124
|
}
|
|
9941
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10125
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9942
10126
|
const classifier = new CodeFunction(this.project, {
|
|
9943
10127
|
...opts,
|
|
9944
10128
|
name: resolvedName,
|
|
@@ -10067,18 +10251,18 @@ var PromptBuilder = class {
|
|
|
10067
10251
|
rawTools.push(tool);
|
|
10068
10252
|
}
|
|
10069
10253
|
}
|
|
10070
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10254
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
10071
10255
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
10072
10256
|
const promptRow = {
|
|
10073
10257
|
id: opts.id,
|
|
10074
|
-
_xact_id: opts.version ?
|
|
10258
|
+
_xact_id: opts.version ? _chunkQRHGVBKUjs.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
10075
10259
|
name: opts.name,
|
|
10076
10260
|
slug,
|
|
10077
10261
|
prompt_data: promptData,
|
|
10078
10262
|
tags: opts.tags,
|
|
10079
10263
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
10080
10264
|
};
|
|
10081
|
-
const prompt = new (0,
|
|
10265
|
+
const prompt = new (0, _chunkQRHGVBKUjs.Prompt)(
|
|
10082
10266
|
promptRow,
|
|
10083
10267
|
{},
|
|
10084
10268
|
// It doesn't make sense to specify defaults here.
|
|
@@ -10133,7 +10317,7 @@ var ParametersBuilder = class {
|
|
|
10133
10317
|
}
|
|
10134
10318
|
|
|
10135
10319
|
create(opts) {
|
|
10136
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
10320
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkQRHGVBKUjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
10137
10321
|
const codeParameters = new CodeParameters(this.project, {
|
|
10138
10322
|
name: opts.name,
|
|
10139
10323
|
slug,
|
|
@@ -10172,7 +10356,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
10172
10356
|
required.push(name);
|
|
10173
10357
|
}
|
|
10174
10358
|
} else {
|
|
10175
|
-
const schemaObj =
|
|
10359
|
+
const schemaObj = _chunkQRHGVBKUjs.zodToJsonSchema.call(void 0, value);
|
|
10176
10360
|
properties[name] = schemaObj;
|
|
10177
10361
|
if (!("default" in schemaObj)) {
|
|
10178
10362
|
required.push(name);
|
|
@@ -10201,11 +10385,11 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
10201
10385
|
__init23() {this.idToName = {}}
|
|
10202
10386
|
async getId(projectName) {
|
|
10203
10387
|
if (!(projectName in this.nameToId)) {
|
|
10204
|
-
const response = await
|
|
10388
|
+
const response = await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
10205
10389
|
project_name: projectName
|
|
10206
10390
|
});
|
|
10207
10391
|
const result = _v3.z.object({
|
|
10208
|
-
project:
|
|
10392
|
+
project: _chunkQRHGVBKUjs.Project
|
|
10209
10393
|
}).parse(response);
|
|
10210
10394
|
const projectId = result.project.id;
|
|
10211
10395
|
this.nameToId[projectName] = projectId;
|
|
@@ -10215,10 +10399,10 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
10215
10399
|
}
|
|
10216
10400
|
async getName(projectId) {
|
|
10217
10401
|
if (!(projectId in this.idToName)) {
|
|
10218
|
-
const response = await
|
|
10402
|
+
const response = await _chunkQRHGVBKUjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
10219
10403
|
id: projectId
|
|
10220
10404
|
});
|
|
10221
|
-
const result = _v3.z.array(
|
|
10405
|
+
const result = _v3.z.array(_chunkQRHGVBKUjs.Project).nonempty().parse(response);
|
|
10222
10406
|
const projectName = result[0].name;
|
|
10223
10407
|
this.idToName[projectId] = projectName;
|
|
10224
10408
|
this.nameToId[projectName] = projectId;
|
|
@@ -10238,16 +10422,16 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
10238
10422
|
var evalBodySchema = _v3.z.object({
|
|
10239
10423
|
name: _v3.z.string(),
|
|
10240
10424
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
10241
|
-
data:
|
|
10425
|
+
data: _chunkQRHGVBKUjs.RunEval.shape.data,
|
|
10242
10426
|
scores: _v3.z.array(
|
|
10243
10427
|
_v3.z.object({
|
|
10244
|
-
function_id:
|
|
10428
|
+
function_id: _chunkQRHGVBKUjs.FunctionId,
|
|
10245
10429
|
name: _v3.z.string()
|
|
10246
10430
|
})
|
|
10247
10431
|
).nullish(),
|
|
10248
10432
|
experiment_name: _v3.z.string().nullish(),
|
|
10249
10433
|
project_id: _v3.z.string().nullish(),
|
|
10250
|
-
parent:
|
|
10434
|
+
parent: _chunkQRHGVBKUjs.InvokeParent.optional(),
|
|
10251
10435
|
stream: _v3.z.boolean().optional()
|
|
10252
10436
|
});
|
|
10253
10437
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -10255,7 +10439,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
10255
10439
|
_v3.z.union([
|
|
10256
10440
|
_v3.z.object({
|
|
10257
10441
|
type: _v3.z.literal("prompt"),
|
|
10258
|
-
default:
|
|
10442
|
+
default: _chunkQRHGVBKUjs.PromptData.optional(),
|
|
10259
10443
|
description: _v3.z.string().optional()
|
|
10260
10444
|
}),
|
|
10261
10445
|
_v3.z.object({
|
|
@@ -10311,7 +10495,10 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
10311
10495
|
);
|
|
10312
10496
|
|
|
10313
10497
|
// src/node/index.ts
|
|
10314
|
-
|
|
10498
|
+
_chunkQRHGVBKUjs.configureNode.call(void 0, );
|
|
10499
|
+
|
|
10500
|
+
|
|
10501
|
+
|
|
10315
10502
|
|
|
10316
10503
|
|
|
10317
10504
|
|
|
@@ -10485,4 +10672,4 @@ _chunkVRZZQPAAjs.configureNode.call(void 0, );
|
|
|
10485
10672
|
|
|
10486
10673
|
|
|
10487
10674
|
|
|
10488
|
-
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;
|