braintrust 3.23.1 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/dist/index.d.mts +6 -0
- package/dev/dist/index.d.ts +6 -0
- package/dev/dist/index.js +902 -586
- package/dev/dist/index.mjs +320 -4
- package/dist/apply-auto-instrumentation.js +211 -189
- package/dist/apply-auto-instrumentation.mjs +23 -1
- package/dist/auto-instrumentations/bundler/esbuild.cjs +40 -0
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +40 -0
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +40 -0
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +40 -0
- package/dist/auto-instrumentations/bundler/vite.d.mts +1 -1
- package/dist/auto-instrumentations/bundler/vite.d.ts +1 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +40 -0
- package/dist/auto-instrumentations/bundler/webpack.cjs +40 -0
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-KIMLYPRW.mjs → chunk-BURMPO7L.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-YXLNSAMJ.mjs → chunk-F43DNLPD.mjs} +40 -0
- package/dist/auto-instrumentations/{chunk-EXY7QCJD.mjs → chunk-GSZHTAQW.mjs} +1 -1
- package/dist/auto-instrumentations/hook.mjs +150 -1
- package/dist/auto-instrumentations/index.cjs +40 -0
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +131 -9
- package/dist/browser.d.ts +131 -9
- package/dist/browser.js +703 -65
- package/dist/browser.mjs +703 -65
- package/dist/{chunk-CDIKAHDZ.js → chunk-7AUY2XWX.js} +21 -1
- package/dist/{chunk-36IPYKMG.mjs → chunk-7F6GCRHH.mjs} +20 -0
- package/dist/{chunk-B6ZQIAK3.js → chunk-SU6EHKJV.js} +1085 -799
- package/dist/{chunk-RBXD2KYN.mjs → chunk-XE5FS7QY.mjs} +291 -5
- package/dist/cli.js +328 -8
- package/dist/edge-light.js +703 -65
- package/dist/edge-light.mjs +703 -65
- package/dist/index.d.mts +131 -9
- package/dist/index.d.ts +131 -9
- package/dist/index.js +891 -532
- package/dist/index.mjs +423 -64
- package/dist/instrumentation/index.d.mts +130 -9
- package/dist/instrumentation/index.d.ts +130 -9
- package/dist/instrumentation/index.js +601 -65
- package/dist/instrumentation/index.mjs +601 -65
- package/dist/vitest-evals-reporter.js +17 -16
- package/dist/vitest-evals-reporter.mjs +3 -2
- package/dist/workerd.js +703 -65
- package/dist/workerd.mjs +703 -65
- package/package.json +3 -3
- package/util/dist/index.js +4 -0
- package/util/dist/index.mjs +4 -0
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
var
|
|
142
|
+
var _chunkSU6EHKJVjs = require('./chunk-SU6EHKJV.js');
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
@@ -163,151 +163,152 @@ var _chunkB6ZQIAK3js = require('./chunk-B6ZQIAK3.js');
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
|
|
167
|
+
var _chunk7AUY2XWXjs = require('./chunk-7AUY2XWX.js');
|
|
167
168
|
|
|
168
169
|
// src/exports.ts
|
|
169
170
|
var exports_exports = {};
|
|
170
|
-
|
|
171
|
-
Attachment: () =>
|
|
172
|
-
AttachmentReference: () =>
|
|
173
|
-
BAGGAGE_HEADER: () =>
|
|
174
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
175
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
176
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
177
|
-
BaseAttachment: () =>
|
|
171
|
+
_chunk7AUY2XWXjs.__export.call(void 0, exports_exports, {
|
|
172
|
+
Attachment: () => _chunkSU6EHKJVjs.Attachment,
|
|
173
|
+
AttachmentReference: () => _chunkSU6EHKJVjs.AttachmentReference,
|
|
174
|
+
BAGGAGE_HEADER: () => _chunkSU6EHKJVjs.BAGGAGE_HEADER,
|
|
175
|
+
BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkSU6EHKJVjs.BRAINTRUST_CURRENT_SPAN_STORE,
|
|
176
|
+
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkSU6EHKJVjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
|
|
177
|
+
BRAINTRUST_PARENT_KEY: () => _chunkSU6EHKJVjs.BRAINTRUST_PARENT_KEY,
|
|
178
|
+
BaseAttachment: () => _chunkSU6EHKJVjs.BaseAttachment,
|
|
178
179
|
BaseExperiment: () => BaseExperiment,
|
|
179
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
180
|
+
BraintrustLangChainCallbackHandler: () => _chunkSU6EHKJVjs.BraintrustLangChainCallbackHandler,
|
|
180
181
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
181
|
-
BraintrustObservabilityExporter: () =>
|
|
182
|
-
BraintrustState: () =>
|
|
183
|
-
BraintrustStream: () =>
|
|
182
|
+
BraintrustObservabilityExporter: () => _chunkSU6EHKJVjs.BraintrustObservabilityExporter,
|
|
183
|
+
BraintrustState: () => _chunkSU6EHKJVjs.BraintrustState,
|
|
184
|
+
BraintrustStream: () => _chunkSU6EHKJVjs.BraintrustStream,
|
|
184
185
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
185
186
|
CodeFunction: () => CodeFunction,
|
|
186
187
|
CodePrompt: () => CodePrompt,
|
|
187
|
-
ContextManager: () =>
|
|
188
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
189
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
190
|
-
Dataset: () =>
|
|
188
|
+
ContextManager: () => _chunkSU6EHKJVjs.ContextManager,
|
|
189
|
+
DEFAULT_FETCH_BATCH_SIZE: () => _chunkSU6EHKJVjs.DEFAULT_FETCH_BATCH_SIZE,
|
|
190
|
+
DEFAULT_MAX_REQUEST_SIZE: () => _chunkSU6EHKJVjs.DEFAULT_MAX_REQUEST_SIZE,
|
|
191
|
+
Dataset: () => _chunkSU6EHKJVjs.Dataset,
|
|
191
192
|
DatasetPipeline: () => DatasetPipeline,
|
|
192
|
-
ERR_PERMALINK: () =>
|
|
193
|
+
ERR_PERMALINK: () => _chunkSU6EHKJVjs.ERR_PERMALINK,
|
|
193
194
|
Eval: () => Eval,
|
|
194
195
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
195
|
-
Experiment: () =>
|
|
196
|
-
ExternalAttachment: () =>
|
|
197
|
-
FailedHTTPResponse: () =>
|
|
198
|
-
IDGenerator: () =>
|
|
199
|
-
JSONAttachment: () =>
|
|
200
|
-
LEGACY_CACHED_HEADER: () =>
|
|
201
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
202
|
-
LazyValue: () =>
|
|
196
|
+
Experiment: () => _chunkSU6EHKJVjs.Experiment,
|
|
197
|
+
ExternalAttachment: () => _chunkSU6EHKJVjs.ExternalAttachment,
|
|
198
|
+
FailedHTTPResponse: () => _chunkSU6EHKJVjs.FailedHTTPResponse,
|
|
199
|
+
IDGenerator: () => _chunkSU6EHKJVjs.IDGenerator,
|
|
200
|
+
JSONAttachment: () => _chunkSU6EHKJVjs.JSONAttachment,
|
|
201
|
+
LEGACY_CACHED_HEADER: () => _chunkSU6EHKJVjs.LEGACY_CACHED_HEADER,
|
|
202
|
+
LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkSU6EHKJVjs.LOGS3_OVERFLOW_REFERENCE_TYPE,
|
|
203
|
+
LazyValue: () => _chunkSU6EHKJVjs.LazyValue,
|
|
203
204
|
LocalTrace: () => LocalTrace,
|
|
204
|
-
Logger: () =>
|
|
205
|
-
LoginInvalidOrgError: () =>
|
|
206
|
-
NOOP_SPAN: () =>
|
|
207
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
208
|
-
NoopSpan: () =>
|
|
209
|
-
OTELIDGenerator: () =>
|
|
210
|
-
ObjectFetcher: () =>
|
|
205
|
+
Logger: () => _chunkSU6EHKJVjs.Logger,
|
|
206
|
+
LoginInvalidOrgError: () => _chunkSU6EHKJVjs.LoginInvalidOrgError,
|
|
207
|
+
NOOP_SPAN: () => _chunkSU6EHKJVjs.NOOP_SPAN,
|
|
208
|
+
NOOP_SPAN_PERMALINK: () => _chunkSU6EHKJVjs.NOOP_SPAN_PERMALINK,
|
|
209
|
+
NoopSpan: () => _chunkSU6EHKJVjs.NoopSpan,
|
|
210
|
+
OTELIDGenerator: () => _chunkSU6EHKJVjs.OTELIDGenerator,
|
|
211
|
+
ObjectFetcher: () => _chunkSU6EHKJVjs.ObjectFetcher,
|
|
211
212
|
Project: () => Project2,
|
|
212
213
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
213
|
-
Prompt: () =>
|
|
214
|
+
Prompt: () => _chunkSU6EHKJVjs.Prompt,
|
|
214
215
|
PromptBuilder: () => PromptBuilder,
|
|
215
|
-
ReadonlyAttachment: () =>
|
|
216
|
-
ReadonlyExperiment: () =>
|
|
216
|
+
ReadonlyAttachment: () => _chunkSU6EHKJVjs.ReadonlyAttachment,
|
|
217
|
+
ReadonlyExperiment: () => _chunkSU6EHKJVjs.ReadonlyExperiment,
|
|
217
218
|
Reporter: () => Reporter,
|
|
218
219
|
ScorerBuilder: () => ScorerBuilder,
|
|
219
220
|
SpanFetcher: () => SpanFetcher,
|
|
220
|
-
SpanImpl: () =>
|
|
221
|
-
TRACEPARENT_HEADER: () =>
|
|
222
|
-
TRACESTATE_HEADER: () =>
|
|
223
|
-
TestBackgroundLogger: () =>
|
|
221
|
+
SpanImpl: () => _chunkSU6EHKJVjs.SpanImpl,
|
|
222
|
+
TRACEPARENT_HEADER: () => _chunkSU6EHKJVjs.TRACEPARENT_HEADER,
|
|
223
|
+
TRACESTATE_HEADER: () => _chunkSU6EHKJVjs.TRACESTATE_HEADER,
|
|
224
|
+
TestBackgroundLogger: () => _chunkSU6EHKJVjs.TestBackgroundLogger,
|
|
224
225
|
ToolBuilder: () => ToolBuilder,
|
|
225
|
-
UUIDGenerator: () =>
|
|
226
|
-
X_CACHED_HEADER: () =>
|
|
227
|
-
_exportsForTestingOnly: () =>
|
|
228
|
-
_internalGetGlobalState: () =>
|
|
229
|
-
_internalIso: () =>
|
|
230
|
-
_internalSetInitialState: () =>
|
|
231
|
-
addAzureBlobHeaders: () =>
|
|
226
|
+
UUIDGenerator: () => _chunkSU6EHKJVjs.UUIDGenerator,
|
|
227
|
+
X_CACHED_HEADER: () => _chunkSU6EHKJVjs.X_CACHED_HEADER,
|
|
228
|
+
_exportsForTestingOnly: () => _chunkSU6EHKJVjs._exportsForTestingOnly,
|
|
229
|
+
_internalGetGlobalState: () => _chunkSU6EHKJVjs._internalGetGlobalState,
|
|
230
|
+
_internalIso: () => _chunk7AUY2XWXjs.isomorph_default,
|
|
231
|
+
_internalSetInitialState: () => _chunkSU6EHKJVjs._internalSetInitialState,
|
|
232
|
+
addAzureBlobHeaders: () => _chunkSU6EHKJVjs.addAzureBlobHeaders,
|
|
232
233
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
233
|
-
braintrustAISDKTelemetry: () =>
|
|
234
|
+
braintrustAISDKTelemetry: () => _chunkSU6EHKJVjs.braintrustAISDKTelemetry,
|
|
234
235
|
braintrustEveHook: () => braintrustEveHook,
|
|
235
236
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
236
|
-
braintrustFlueInstrumentation: () =>
|
|
237
|
-
braintrustFlueObserver: () =>
|
|
238
|
-
braintrustStreamChunkSchema: () =>
|
|
237
|
+
braintrustFlueInstrumentation: () => _chunkSU6EHKJVjs.braintrustFlueInstrumentation,
|
|
238
|
+
braintrustFlueObserver: () => _chunkSU6EHKJVjs.braintrustFlueObserver,
|
|
239
|
+
braintrustStreamChunkSchema: () => _chunkSU6EHKJVjs.braintrustStreamChunkSchema,
|
|
239
240
|
buildLocalSummary: () => buildLocalSummary,
|
|
240
|
-
configureInstrumentation: () =>
|
|
241
|
-
constructLogs3OverflowRequest: () =>
|
|
242
|
-
createFinalValuePassThroughStream: () =>
|
|
243
|
-
currentExperiment: () =>
|
|
244
|
-
currentLogger: () =>
|
|
245
|
-
currentSpan: () =>
|
|
246
|
-
deepCopyEvent: () =>
|
|
241
|
+
configureInstrumentation: () => _chunkSU6EHKJVjs.configureInstrumentation,
|
|
242
|
+
constructLogs3OverflowRequest: () => _chunkSU6EHKJVjs.constructLogs3OverflowRequest,
|
|
243
|
+
createFinalValuePassThroughStream: () => _chunkSU6EHKJVjs.createFinalValuePassThroughStream,
|
|
244
|
+
currentExperiment: () => _chunkSU6EHKJVjs.currentExperiment,
|
|
245
|
+
currentLogger: () => _chunkSU6EHKJVjs.currentLogger,
|
|
246
|
+
currentSpan: () => _chunkSU6EHKJVjs.currentSpan,
|
|
247
|
+
deepCopyEvent: () => _chunkSU6EHKJVjs.deepCopyEvent,
|
|
247
248
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
248
|
-
deserializePlainStringAsJSON: () =>
|
|
249
|
-
devNullWritableStream: () =>
|
|
249
|
+
deserializePlainStringAsJSON: () => _chunkSU6EHKJVjs.deserializePlainStringAsJSON,
|
|
250
|
+
devNullWritableStream: () => _chunkSU6EHKJVjs.devNullWritableStream,
|
|
250
251
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
251
252
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
252
|
-
extractTraceContextFromHeaders: () =>
|
|
253
|
-
flush: () =>
|
|
254
|
-
getContextManager: () =>
|
|
255
|
-
getIdGenerator: () =>
|
|
256
|
-
getPromptVersions: () =>
|
|
257
|
-
getSpanParentObject: () =>
|
|
258
|
-
getTemplateRenderer: () =>
|
|
253
|
+
extractTraceContextFromHeaders: () => _chunkSU6EHKJVjs.extractTraceContextFromHeaders,
|
|
254
|
+
flush: () => _chunkSU6EHKJVjs.flush,
|
|
255
|
+
getContextManager: () => _chunkSU6EHKJVjs.getContextManager,
|
|
256
|
+
getIdGenerator: () => _chunkSU6EHKJVjs.getIdGenerator,
|
|
257
|
+
getPromptVersions: () => _chunkSU6EHKJVjs.getPromptVersions,
|
|
258
|
+
getSpanParentObject: () => _chunkSU6EHKJVjs.getSpanParentObject,
|
|
259
|
+
getTemplateRenderer: () => _chunkSU6EHKJVjs.getTemplateRenderer,
|
|
259
260
|
graph: () => graph_framework_exports,
|
|
260
|
-
init: () =>
|
|
261
|
-
initDataset: () =>
|
|
262
|
-
initExperiment: () =>
|
|
261
|
+
init: () => _chunkSU6EHKJVjs.init,
|
|
262
|
+
initDataset: () => _chunkSU6EHKJVjs.initDataset,
|
|
263
|
+
initExperiment: () => _chunkSU6EHKJVjs.initExperiment,
|
|
263
264
|
initFunction: () => initFunction,
|
|
264
|
-
initLogger: () =>
|
|
265
|
+
initLogger: () => _chunkSU6EHKJVjs.initLogger,
|
|
265
266
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
266
|
-
injectTraceContext: () =>
|
|
267
|
+
injectTraceContext: () => _chunkSU6EHKJVjs.injectTraceContext,
|
|
267
268
|
invoke: () => invoke,
|
|
268
|
-
isTemplateFormat: () =>
|
|
269
|
-
loadParameters: () =>
|
|
270
|
-
loadPrompt: () =>
|
|
271
|
-
log: () =>
|
|
272
|
-
logError: () =>
|
|
273
|
-
login: () =>
|
|
274
|
-
loginToState: () =>
|
|
275
|
-
logs3OverflowUploadSchema: () =>
|
|
276
|
-
newId: () =>
|
|
277
|
-
parseCachedHeader: () =>
|
|
278
|
-
parseTemplateFormat: () =>
|
|
279
|
-
permalink: () =>
|
|
280
|
-
pickLogs3OverflowObjectIds: () =>
|
|
269
|
+
isTemplateFormat: () => _chunkSU6EHKJVjs.isTemplateFormat,
|
|
270
|
+
loadParameters: () => _chunkSU6EHKJVjs.loadParameters,
|
|
271
|
+
loadPrompt: () => _chunkSU6EHKJVjs.loadPrompt,
|
|
272
|
+
log: () => _chunkSU6EHKJVjs.log,
|
|
273
|
+
logError: () => _chunkSU6EHKJVjs.logError,
|
|
274
|
+
login: () => _chunkSU6EHKJVjs.login,
|
|
275
|
+
loginToState: () => _chunkSU6EHKJVjs.loginToState,
|
|
276
|
+
logs3OverflowUploadSchema: () => _chunkSU6EHKJVjs.logs3OverflowUploadSchema,
|
|
277
|
+
newId: () => _chunkSU6EHKJVjs.newId,
|
|
278
|
+
parseCachedHeader: () => _chunkSU6EHKJVjs.parseCachedHeader,
|
|
279
|
+
parseTemplateFormat: () => _chunkSU6EHKJVjs.parseTemplateFormat,
|
|
280
|
+
permalink: () => _chunkSU6EHKJVjs.permalink,
|
|
281
|
+
pickLogs3OverflowObjectIds: () => _chunkSU6EHKJVjs.pickLogs3OverflowObjectIds,
|
|
281
282
|
projects: () => projects,
|
|
282
283
|
promptContentsSchema: () => promptContentsSchema,
|
|
283
284
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
284
285
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
285
286
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
286
|
-
registerOtelFlush: () =>
|
|
287
|
+
registerOtelFlush: () => _chunkSU6EHKJVjs.registerOtelFlush,
|
|
287
288
|
registerSandbox: () => registerSandbox,
|
|
288
|
-
registerTemplatePlugin: () =>
|
|
289
|
-
renderMessage: () =>
|
|
290
|
-
renderPromptParams: () =>
|
|
291
|
-
renderTemplateContent: () =>
|
|
289
|
+
registerTemplatePlugin: () => _chunkSU6EHKJVjs.registerTemplatePlugin,
|
|
290
|
+
renderMessage: () => _chunkSU6EHKJVjs.renderMessage,
|
|
291
|
+
renderPromptParams: () => _chunkSU6EHKJVjs.renderPromptParams,
|
|
292
|
+
renderTemplateContent: () => _chunkSU6EHKJVjs.renderTemplateContent,
|
|
292
293
|
reportFailures: () => reportFailures,
|
|
293
294
|
runEvaluator: () => runEvaluator,
|
|
294
|
-
setFetch: () =>
|
|
295
|
-
setMaskingFunction: () =>
|
|
296
|
-
spanComponentsToObjectId: () =>
|
|
297
|
-
startSpan: () =>
|
|
298
|
-
summarize: () =>
|
|
299
|
-
templateRegistry: () =>
|
|
300
|
-
toolFunctionDefinitionSchema: () =>
|
|
301
|
-
traceable: () =>
|
|
302
|
-
traced: () =>
|
|
303
|
-
updateSpan: () =>
|
|
304
|
-
uploadLogs3OverflowPayload: () =>
|
|
305
|
-
utf8ByteLength: () =>
|
|
306
|
-
withCurrent: () =>
|
|
307
|
-
withDataset: () =>
|
|
308
|
-
withExperiment: () =>
|
|
309
|
-
withLogger: () =>
|
|
310
|
-
withParent: () =>
|
|
295
|
+
setFetch: () => _chunkSU6EHKJVjs.setFetch,
|
|
296
|
+
setMaskingFunction: () => _chunkSU6EHKJVjs.setMaskingFunction,
|
|
297
|
+
spanComponentsToObjectId: () => _chunkSU6EHKJVjs.spanComponentsToObjectId,
|
|
298
|
+
startSpan: () => _chunkSU6EHKJVjs.startSpan,
|
|
299
|
+
summarize: () => _chunkSU6EHKJVjs.summarize,
|
|
300
|
+
templateRegistry: () => _chunkSU6EHKJVjs.templateRegistry,
|
|
301
|
+
toolFunctionDefinitionSchema: () => _chunkSU6EHKJVjs.ToolFunctionDefinition,
|
|
302
|
+
traceable: () => _chunkSU6EHKJVjs.traceable,
|
|
303
|
+
traced: () => _chunkSU6EHKJVjs.traced,
|
|
304
|
+
updateSpan: () => _chunkSU6EHKJVjs.updateSpan,
|
|
305
|
+
uploadLogs3OverflowPayload: () => _chunkSU6EHKJVjs.uploadLogs3OverflowPayload,
|
|
306
|
+
utf8ByteLength: () => _chunkSU6EHKJVjs.utf8ByteLength,
|
|
307
|
+
withCurrent: () => _chunkSU6EHKJVjs.withCurrent,
|
|
308
|
+
withDataset: () => _chunkSU6EHKJVjs.withDataset,
|
|
309
|
+
withExperiment: () => _chunkSU6EHKJVjs.withExperiment,
|
|
310
|
+
withLogger: () => _chunkSU6EHKJVjs.withLogger,
|
|
311
|
+
withParent: () => _chunkSU6EHKJVjs.withParent,
|
|
311
312
|
wrapAISDK: () => wrapAISDK,
|
|
312
313
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
313
314
|
wrapAgentClass: () => wrapAgentClass,
|
|
@@ -325,7 +326,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
325
326
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
326
327
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
327
328
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
328
|
-
wrapMastraAgent: () =>
|
|
329
|
+
wrapMastraAgent: () => _chunkSU6EHKJVjs.wrapMastraAgent,
|
|
329
330
|
wrapMistral: () => wrapMistral,
|
|
330
331
|
wrapOpenAI: () => wrapOpenAI,
|
|
331
332
|
wrapOpenAICodexSDK: () => wrapOpenAICodexSDK,
|
|
@@ -334,7 +335,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
334
335
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
335
336
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
336
337
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
337
|
-
wrapTraced: () =>
|
|
338
|
+
wrapTraced: () => _chunkSU6EHKJVjs.wrapTraced,
|
|
338
339
|
wrapVitest: () => wrapVitest
|
|
339
340
|
});
|
|
340
341
|
|
|
@@ -342,7 +343,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
342
343
|
var _v3 = require('zod/v3');
|
|
343
344
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
344
345
|
async function registerSandbox(options) {
|
|
345
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
346
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )));
|
|
346
347
|
await state.login({
|
|
347
348
|
apiKey: options.apiKey,
|
|
348
349
|
appUrl: options.appUrl,
|
|
@@ -383,7 +384,7 @@ async function registerSandbox(options) {
|
|
|
383
384
|
evaluatorDefinitions
|
|
384
385
|
)) {
|
|
385
386
|
const functionName = evalName;
|
|
386
|
-
const functionSlug =
|
|
387
|
+
const functionSlug = _chunkSU6EHKJVjs.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
387
388
|
const functionDef = {
|
|
388
389
|
project_id: projectId,
|
|
389
390
|
org_name: state.orgName,
|
|
@@ -454,7 +455,7 @@ async function invoke(args) {
|
|
|
454
455
|
projectId,
|
|
455
456
|
...functionIdArgs
|
|
456
457
|
} = args;
|
|
457
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
458
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )));
|
|
458
459
|
await state.login({
|
|
459
460
|
orgName,
|
|
460
461
|
apiKey,
|
|
@@ -462,8 +463,8 @@ async function invoke(args) {
|
|
|
462
463
|
forceLogin,
|
|
463
464
|
fetch
|
|
464
465
|
});
|
|
465
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
466
|
-
const functionId =
|
|
466
|
+
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkSU6EHKJVjs.getSpanParentObject.call(void 0, ).export();
|
|
467
|
+
const functionId = _chunkSU6EHKJVjs.FunctionId.safeParse({
|
|
467
468
|
function_id: functionIdArgs.function_id,
|
|
468
469
|
project_name: functionIdArgs.projectName,
|
|
469
470
|
slug: functionIdArgs.slug,
|
|
@@ -506,7 +507,7 @@ async function invoke(args) {
|
|
|
506
507
|
if (!resp.body) {
|
|
507
508
|
throw new Error("Received empty stream body");
|
|
508
509
|
}
|
|
509
|
-
return new (0,
|
|
510
|
+
return new (0, _chunkSU6EHKJVjs.BraintrustStream)(resp.body);
|
|
510
511
|
} else {
|
|
511
512
|
const data = await resp.json();
|
|
512
513
|
return schema ? schema.parse(data) : data;
|
|
@@ -518,7 +519,7 @@ function initFunction({
|
|
|
518
519
|
version,
|
|
519
520
|
state
|
|
520
521
|
}) {
|
|
521
|
-
const s = _nullishCoalesce(state, () => (
|
|
522
|
+
const s = _nullishCoalesce(state, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )));
|
|
522
523
|
_optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
|
|
523
524
|
const f = async (input) => {
|
|
524
525
|
return await invoke({
|
|
@@ -596,22 +597,22 @@ function responsesProxy(openai) {
|
|
|
596
597
|
if (name === "create" && typeof target.create === "function") {
|
|
597
598
|
return wrapResponsesAsync(
|
|
598
599
|
target.create.bind(target),
|
|
599
|
-
|
|
600
|
+
_chunk7AUY2XWXjs.openAIChannels.responsesCreate
|
|
600
601
|
);
|
|
601
602
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
602
603
|
return wrapResponsesSyncStream(
|
|
603
604
|
target.stream.bind(target),
|
|
604
|
-
|
|
605
|
+
_chunk7AUY2XWXjs.openAIChannels.responsesStream
|
|
605
606
|
);
|
|
606
607
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
607
608
|
return wrapResponsesAsync(
|
|
608
609
|
target.parse.bind(target),
|
|
609
|
-
|
|
610
|
+
_chunk7AUY2XWXjs.openAIChannels.responsesParse
|
|
610
611
|
);
|
|
611
612
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
612
613
|
return wrapResponsesAsync(
|
|
613
614
|
target.compact.bind(target),
|
|
614
|
-
|
|
615
|
+
_chunk7AUY2XWXjs.openAIChannels.responsesCompact
|
|
615
616
|
);
|
|
616
617
|
}
|
|
617
618
|
return Reflect.get(target, name, receiver);
|
|
@@ -755,7 +756,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
755
756
|
const { span_info, params } = splitSpanInfo(
|
|
756
757
|
allParams
|
|
757
758
|
);
|
|
758
|
-
return
|
|
759
|
+
return _chunk7AUY2XWXjs.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
759
760
|
async () => await completion(params),
|
|
760
761
|
{ arguments: [params], span_info }
|
|
761
762
|
);
|
|
@@ -766,7 +767,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
766
767
|
const { span_info, params } = splitSpanInfo(
|
|
767
768
|
allParams
|
|
768
769
|
);
|
|
769
|
-
return
|
|
770
|
+
return _chunk7AUY2XWXjs.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
770
771
|
() => completion(params),
|
|
771
772
|
{ arguments: [params], span_info }
|
|
772
773
|
);
|
|
@@ -782,7 +783,7 @@ function wrapChatCompletion(completion) {
|
|
|
782
783
|
if (!executionPromise) {
|
|
783
784
|
executionPromise = (async () => {
|
|
784
785
|
const traceContext = createChannelContext(
|
|
785
|
-
|
|
786
|
+
_chunk7AUY2XWXjs.openAIChannels.chatCompletionsCreate,
|
|
786
787
|
params,
|
|
787
788
|
span_info
|
|
788
789
|
);
|
|
@@ -792,7 +793,7 @@ function wrapChatCompletion(completion) {
|
|
|
792
793
|
options
|
|
793
794
|
);
|
|
794
795
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
795
|
-
|
|
796
|
+
_chunk7AUY2XWXjs.openAIChannels.chatCompletionsCreate,
|
|
796
797
|
traceContext,
|
|
797
798
|
completionPromise
|
|
798
799
|
);
|
|
@@ -803,7 +804,7 @@ function wrapChatCompletion(completion) {
|
|
|
803
804
|
options
|
|
804
805
|
);
|
|
805
806
|
const { data, response } = await tracePromiseWithResponse(
|
|
806
|
-
|
|
807
|
+
_chunk7AUY2XWXjs.openAIChannels.chatCompletionsCreate,
|
|
807
808
|
traceContext,
|
|
808
809
|
completionResponse
|
|
809
810
|
);
|
|
@@ -846,8 +847,8 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
846
847
|
return createLazyAPIPromise(ensureExecuted);
|
|
847
848
|
};
|
|
848
849
|
}
|
|
849
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
850
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
850
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunk7AUY2XWXjs.openAIChannels.embeddingsCreate);
|
|
851
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunk7AUY2XWXjs.openAIChannels.moderationsCreate);
|
|
851
852
|
|
|
852
853
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
853
854
|
function isModuleNamespace(obj) {
|
|
@@ -905,6 +906,26 @@ function wrapAISDK(aiSDK, options = {}) {
|
|
|
905
906
|
}
|
|
906
907
|
});
|
|
907
908
|
}
|
|
909
|
+
function isHarnessAgentInstance(instance) {
|
|
910
|
+
try {
|
|
911
|
+
const visited = /* @__PURE__ */ new Set();
|
|
912
|
+
let prototype = Object.getPrototypeOf(instance);
|
|
913
|
+
while (prototype !== null && !visited.has(prototype)) {
|
|
914
|
+
visited.add(prototype);
|
|
915
|
+
const constructor = _optionalChain([Object, 'access', _14 => _14.getOwnPropertyDescriptor, 'call', _15 => _15(
|
|
916
|
+
prototype,
|
|
917
|
+
"constructor"
|
|
918
|
+
), 'optionalAccess', _16 => _16.value]);
|
|
919
|
+
const constructorName = typeof constructor === "function" ? _optionalChain([Object, 'access', _17 => _17.getOwnPropertyDescriptor, 'call', _18 => _18(constructor, "name"), 'optionalAccess', _19 => _19.value]) : void 0;
|
|
920
|
+
if (constructorName === "HarnessAgent") {
|
|
921
|
+
return true;
|
|
922
|
+
}
|
|
923
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
924
|
+
}
|
|
925
|
+
} catch (e3) {
|
|
926
|
+
}
|
|
927
|
+
return false;
|
|
928
|
+
}
|
|
908
929
|
var wrapAgentClass = (AgentClass, options = {}) => {
|
|
909
930
|
const typedAgentClass = AgentClass;
|
|
910
931
|
return new Proxy(typedAgentClass, {
|
|
@@ -914,9 +935,46 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
914
935
|
args,
|
|
915
936
|
newTarget
|
|
916
937
|
);
|
|
938
|
+
const harnessAgent = isHarnessAgentInstance(instance) ? instance : null;
|
|
917
939
|
return new Proxy(instance, {
|
|
918
940
|
get(instanceTarget, prop, instanceReceiver) {
|
|
919
941
|
const original = Reflect.get(instanceTarget, prop, instanceTarget);
|
|
942
|
+
if (harnessAgent && typeof original === "function") {
|
|
943
|
+
switch (prop) {
|
|
944
|
+
case "generate":
|
|
945
|
+
return wrapHarnessAgentGenerate(
|
|
946
|
+
original,
|
|
947
|
+
harnessAgent,
|
|
948
|
+
_chunk7AUY2XWXjs.harnessAgentChannels.generate,
|
|
949
|
+
"HarnessAgent.generate",
|
|
950
|
+
options
|
|
951
|
+
);
|
|
952
|
+
case "stream":
|
|
953
|
+
return wrapHarnessAgentStream(
|
|
954
|
+
original,
|
|
955
|
+
harnessAgent,
|
|
956
|
+
_chunk7AUY2XWXjs.harnessAgentChannels.stream,
|
|
957
|
+
"HarnessAgent.stream",
|
|
958
|
+
options
|
|
959
|
+
);
|
|
960
|
+
case "continueGenerate":
|
|
961
|
+
return wrapHarnessAgentGenerate(
|
|
962
|
+
original,
|
|
963
|
+
harnessAgent,
|
|
964
|
+
_chunk7AUY2XWXjs.harnessAgentChannels.continueGenerate,
|
|
965
|
+
"HarnessAgent.continueGenerate",
|
|
966
|
+
options
|
|
967
|
+
);
|
|
968
|
+
case "continueStream":
|
|
969
|
+
return wrapHarnessAgentStream(
|
|
970
|
+
original,
|
|
971
|
+
harnessAgent,
|
|
972
|
+
_chunk7AUY2XWXjs.harnessAgentChannels.continueStream,
|
|
973
|
+
"HarnessAgent.continueStream",
|
|
974
|
+
options
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
920
978
|
if (prop === "generate" && typeof original === "function" && instanceTarget.constructor.name !== "WorkflowAgent") {
|
|
921
979
|
return wrapAgentGenerate(original, instanceTarget, options);
|
|
922
980
|
}
|
|
@@ -932,6 +990,26 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
932
990
|
}
|
|
933
991
|
});
|
|
934
992
|
};
|
|
993
|
+
var wrapHarnessAgentGenerate = (generate, instance, channel, name, options) => makeGenerateTextWrapper(
|
|
994
|
+
channel,
|
|
995
|
+
name,
|
|
996
|
+
generate.bind(instance),
|
|
997
|
+
{
|
|
998
|
+
self: instance,
|
|
999
|
+
spanType: "task" /* TASK */
|
|
1000
|
+
},
|
|
1001
|
+
options
|
|
1002
|
+
);
|
|
1003
|
+
var wrapHarnessAgentStream = (stream, instance, channel, name, options) => makeStreamWrapper(
|
|
1004
|
+
channel,
|
|
1005
|
+
name,
|
|
1006
|
+
stream.bind(instance),
|
|
1007
|
+
{
|
|
1008
|
+
self: instance,
|
|
1009
|
+
spanType: "task" /* TASK */
|
|
1010
|
+
},
|
|
1011
|
+
options
|
|
1012
|
+
);
|
|
935
1013
|
var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
936
1014
|
const defaultName = `${instance.constructor.name}.generate`;
|
|
937
1015
|
return async (params) => makeGenerateTextWrapper(
|
|
@@ -947,15 +1025,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
947
1025
|
};
|
|
948
1026
|
function generateChannelForAgent(agentName) {
|
|
949
1027
|
if (agentName === "ToolLoopAgent") {
|
|
950
|
-
return
|
|
1028
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.toolLoopAgentGenerate;
|
|
951
1029
|
}
|
|
952
|
-
return
|
|
1030
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.agentGenerate;
|
|
953
1031
|
}
|
|
954
1032
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
955
1033
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
956
1034
|
return (params) => {
|
|
957
1035
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
958
|
-
if (workflowAgent &&
|
|
1036
|
+
if (workflowAgent && _chunkSU6EHKJVjs.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
959
1037
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
960
1038
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
961
1039
|
}
|
|
@@ -974,12 +1052,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
974
1052
|
};
|
|
975
1053
|
function streamChannelForAgent(agentName) {
|
|
976
1054
|
if (agentName === "ToolLoopAgent") {
|
|
977
|
-
return
|
|
1055
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.toolLoopAgentStream;
|
|
978
1056
|
}
|
|
979
1057
|
if (agentName === "WorkflowAgent") {
|
|
980
|
-
return
|
|
1058
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.workflowAgentStream;
|
|
981
1059
|
}
|
|
982
|
-
return
|
|
1060
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.agentStream;
|
|
983
1061
|
}
|
|
984
1062
|
var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
|
|
985
1063
|
const wrapper = async function(allParams) {
|
|
@@ -1003,7 +1081,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
1003
1081
|
};
|
|
1004
1082
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
1005
1083
|
return makeGenerateTextWrapper(
|
|
1006
|
-
|
|
1084
|
+
_chunk7AUY2XWXjs.aiSDKChannels.generateText,
|
|
1007
1085
|
"generateText",
|
|
1008
1086
|
generateText,
|
|
1009
1087
|
{ aiSDK },
|
|
@@ -1012,7 +1090,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
1012
1090
|
};
|
|
1013
1091
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
1014
1092
|
return makeGenerateTextWrapper(
|
|
1015
|
-
|
|
1093
|
+
_chunk7AUY2XWXjs.aiSDKChannels.generateObject,
|
|
1016
1094
|
"generateObject",
|
|
1017
1095
|
generateObject,
|
|
1018
1096
|
{ aiSDK },
|
|
@@ -1041,7 +1119,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
1041
1119
|
};
|
|
1042
1120
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
1043
1121
|
return makeEmbedWrapper(
|
|
1044
|
-
|
|
1122
|
+
_chunk7AUY2XWXjs.aiSDKChannels.embed,
|
|
1045
1123
|
"embed",
|
|
1046
1124
|
embed,
|
|
1047
1125
|
{ aiSDK },
|
|
@@ -1050,7 +1128,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
1050
1128
|
};
|
|
1051
1129
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
1052
1130
|
return makeEmbedWrapper(
|
|
1053
|
-
|
|
1131
|
+
_chunk7AUY2XWXjs.aiSDKChannels.embedMany,
|
|
1054
1132
|
"embedMany",
|
|
1055
1133
|
embedMany,
|
|
1056
1134
|
{ aiSDK },
|
|
@@ -1061,7 +1139,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
1061
1139
|
const wrapper = async function(allParams) {
|
|
1062
1140
|
const { span_info, ...params } = allParams;
|
|
1063
1141
|
const tracedParams = { ...params };
|
|
1064
|
-
return
|
|
1142
|
+
return _chunk7AUY2XWXjs.aiSDKChannels.rerank.tracePromise(
|
|
1065
1143
|
() => rerank(tracedParams),
|
|
1066
1144
|
createAISDKChannelContext(tracedParams, {
|
|
1067
1145
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1100,7 +1178,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
1100
1178
|
};
|
|
1101
1179
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
1102
1180
|
return makeStreamWrapper(
|
|
1103
|
-
|
|
1181
|
+
_chunk7AUY2XWXjs.aiSDKChannels.streamText,
|
|
1104
1182
|
"streamText",
|
|
1105
1183
|
streamText,
|
|
1106
1184
|
{ aiSDK },
|
|
@@ -1109,7 +1187,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
1109
1187
|
};
|
|
1110
1188
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
1111
1189
|
return makeStreamWrapper(
|
|
1112
|
-
|
|
1190
|
+
_chunk7AUY2XWXjs.aiSDKChannels.streamObject,
|
|
1113
1191
|
"streamObject",
|
|
1114
1192
|
streamObject,
|
|
1115
1193
|
{ aiSDK },
|
|
@@ -1122,11 +1200,11 @@ function mergeSpanInfo(spanInfo, defaults) {
|
|
|
1122
1200
|
}
|
|
1123
1201
|
return {
|
|
1124
1202
|
...spanInfo,
|
|
1125
|
-
..._optionalChain([spanInfo, 'optionalAccess',
|
|
1126
|
-
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess',
|
|
1203
|
+
..._optionalChain([spanInfo, 'optionalAccess', _20 => _20.name]) ? {} : defaults.name ? { name: defaults.name } : {},
|
|
1204
|
+
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _21 => _21.spanAttributes]) ? {
|
|
1127
1205
|
spanAttributes: {
|
|
1128
1206
|
...defaults.spanType !== void 0 ? { type: defaults.spanType } : {},
|
|
1129
|
-
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess',
|
|
1207
|
+
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _22 => _22.spanAttributes]), () => ( {}))
|
|
1130
1208
|
}
|
|
1131
1209
|
} : {}
|
|
1132
1210
|
};
|
|
@@ -1144,7 +1222,7 @@ function createAISDKChannelContext(params, context = {}) {
|
|
|
1144
1222
|
// src/wrappers/ai-sdk/deprecated/wrapAISDKModel.ts
|
|
1145
1223
|
function wrapAISDKModel(model) {
|
|
1146
1224
|
const m = model;
|
|
1147
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
1225
|
+
if (_optionalChain([m, 'optionalAccess', _23 => _23.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _24 => _24.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _25 => _25.modelId]) === "string") {
|
|
1148
1226
|
return new BraintrustLanguageModelWrapper(m);
|
|
1149
1227
|
} else {
|
|
1150
1228
|
console.warn("Unsupported AI SDK model. Not wrapping.");
|
|
@@ -1159,6 +1237,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1159
1237
|
}
|
|
1160
1238
|
}
|
|
1161
1239
|
|
|
1240
|
+
|
|
1162
1241
|
get specificationVersion() {
|
|
1163
1242
|
return this.model.specificationVersion;
|
|
1164
1243
|
}
|
|
@@ -1180,14 +1259,14 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1180
1259
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1181
1260
|
// propagate those via async local storage
|
|
1182
1261
|
async doGenerate(options) {
|
|
1183
|
-
const span =
|
|
1262
|
+
const span = _chunkSU6EHKJVjs.startSpan.call(void 0, {
|
|
1184
1263
|
name: "Chat Completion",
|
|
1185
1264
|
spanAttributes: {
|
|
1186
1265
|
type: "llm"
|
|
1187
1266
|
}
|
|
1188
1267
|
});
|
|
1189
1268
|
const { prompt, mode, ...rest } = options;
|
|
1190
|
-
const startTime =
|
|
1269
|
+
const startTime = _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1191
1270
|
try {
|
|
1192
1271
|
const ret = await this.model.doGenerate(options);
|
|
1193
1272
|
span.log({
|
|
@@ -1199,12 +1278,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1199
1278
|
},
|
|
1200
1279
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1201
1280
|
metrics: {
|
|
1202
|
-
time_to_first_token:
|
|
1203
|
-
tokens: !
|
|
1204
|
-
prompt_tokens: _optionalChain([ret, 'access',
|
|
1205
|
-
completion_tokens: _optionalChain([ret, 'access',
|
|
1206
|
-
cached:
|
|
1207
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
1281
|
+
time_to_first_token: _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, ) - startTime,
|
|
1282
|
+
tokens: !_chunkSU6EHKJVjs.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
1283
|
+
prompt_tokens: _optionalChain([ret, 'access', _26 => _26.usage, 'optionalAccess', _27 => _27.promptTokens]),
|
|
1284
|
+
completion_tokens: _optionalChain([ret, 'access', _28 => _28.usage, 'optionalAccess', _29 => _29.completionTokens]),
|
|
1285
|
+
cached: _chunkSU6EHKJVjs.parseCachedHeader.call(void 0,
|
|
1286
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _30 => _30.rawResponse, 'optionalAccess', _31 => _31.headers, 'optionalAccess', _32 => _32[_chunkSU6EHKJVjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _33 => _33.rawResponse, 'optionalAccess', _34 => _34.headers, 'optionalAccess', _35 => _35[_chunkSU6EHKJVjs.LEGACY_CACHED_HEADER]])))
|
|
1208
1287
|
)
|
|
1209
1288
|
}
|
|
1210
1289
|
});
|
|
@@ -1215,8 +1294,8 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1215
1294
|
}
|
|
1216
1295
|
async doStream(options) {
|
|
1217
1296
|
const { prompt, mode, ...rest } = options;
|
|
1218
|
-
const startTime =
|
|
1219
|
-
const span =
|
|
1297
|
+
const startTime = _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, );
|
|
1298
|
+
const span = _chunkSU6EHKJVjs.startSpan.call(void 0, {
|
|
1220
1299
|
name: "Chat Completion",
|
|
1221
1300
|
spanAttributes: {
|
|
1222
1301
|
type: "llm"
|
|
@@ -1250,7 +1329,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1250
1329
|
new TransformStream({
|
|
1251
1330
|
transform(chunk, controller) {
|
|
1252
1331
|
if (time_to_first_token === void 0) {
|
|
1253
|
-
time_to_first_token =
|
|
1332
|
+
time_to_first_token = _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1254
1333
|
span.log({ metrics: { time_to_first_token } });
|
|
1255
1334
|
}
|
|
1256
1335
|
switch (chunk.type) {
|
|
@@ -1295,11 +1374,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1295
1374
|
),
|
|
1296
1375
|
metrics: {
|
|
1297
1376
|
time_to_first_token,
|
|
1298
|
-
tokens: !
|
|
1299
|
-
prompt_tokens: _optionalChain([usage, 'optionalAccess',
|
|
1300
|
-
completion_tokens: _optionalChain([usage, 'optionalAccess',
|
|
1301
|
-
cached:
|
|
1302
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
1377
|
+
tokens: !_chunkSU6EHKJVjs.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1378
|
+
prompt_tokens: _optionalChain([usage, 'optionalAccess', _36 => _36.promptTokens]),
|
|
1379
|
+
completion_tokens: _optionalChain([usage, 'optionalAccess', _37 => _37.completionTokens]),
|
|
1380
|
+
cached: _chunkSU6EHKJVjs.parseCachedHeader.call(void 0,
|
|
1381
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _38 => _38.rawResponse, 'optionalAccess', _39 => _39.headers, 'optionalAccess', _40 => _40[_chunkSU6EHKJVjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _41 => _41.rawResponse, 'optionalAccess', _42 => _42.headers, 'optionalAccess', _43 => _43[_chunkSU6EHKJVjs.LEGACY_CACHED_HEADER]])))
|
|
1303
1382
|
)
|
|
1304
1383
|
}
|
|
1305
1384
|
});
|
|
@@ -1343,7 +1422,7 @@ function postProcessPrompt(prompt) {
|
|
|
1343
1422
|
return [
|
|
1344
1423
|
{
|
|
1345
1424
|
role: "assistant",
|
|
1346
|
-
content: _optionalChain([textPart, 'optionalAccess',
|
|
1425
|
+
content: _optionalChain([textPart, 'optionalAccess', _44 => _44.text]),
|
|
1347
1426
|
...toolCallParts.length > 0 ? {
|
|
1348
1427
|
tool_calls: toolCallParts.map((part) => ({
|
|
1349
1428
|
id: part.toolCallId,
|
|
@@ -1416,23 +1495,23 @@ function postProcessOutput(text, toolCalls2, finishReason) {
|
|
|
1416
1495
|
|
|
1417
1496
|
// src/wrappers/ai-sdk/deprecated/BraintrustMiddleware.ts
|
|
1418
1497
|
function detectProviderFromResult(result) {
|
|
1419
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1498
|
+
if (!_optionalChain([result, 'optionalAccess', _45 => _45.providerMetadata])) {
|
|
1420
1499
|
return void 0;
|
|
1421
1500
|
}
|
|
1422
1501
|
const keys = Object.keys(result.providerMetadata);
|
|
1423
|
-
return _optionalChain([keys, 'optionalAccess',
|
|
1502
|
+
return _optionalChain([keys, 'optionalAccess', _46 => _46.at, 'call', _47 => _47(0)]);
|
|
1424
1503
|
}
|
|
1425
1504
|
function extractModelFromResult(result) {
|
|
1426
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
1505
|
+
if (_optionalChain([result, 'optionalAccess', _48 => _48.response, 'optionalAccess', _49 => _49.modelId])) {
|
|
1427
1506
|
return result.response.modelId;
|
|
1428
1507
|
}
|
|
1429
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
1508
|
+
if (_optionalChain([result, 'optionalAccess', _50 => _50.request, 'optionalAccess', _51 => _51.body, 'optionalAccess', _52 => _52.model])) {
|
|
1430
1509
|
return result.request.body.model;
|
|
1431
1510
|
}
|
|
1432
1511
|
return void 0;
|
|
1433
1512
|
}
|
|
1434
1513
|
function extractModelFromWrapGenerateCallback(model) {
|
|
1435
|
-
return _optionalChain([model, 'optionalAccess',
|
|
1514
|
+
return _optionalChain([model, 'optionalAccess', _53 => _53.modelId]);
|
|
1436
1515
|
}
|
|
1437
1516
|
function camelToSnake(str) {
|
|
1438
1517
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
@@ -1477,19 +1556,19 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1477
1556
|
metrics.prompt_cached_tokens = cachedInputTokens;
|
|
1478
1557
|
}
|
|
1479
1558
|
if (provider === "anthropic") {
|
|
1480
|
-
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess',
|
|
1559
|
+
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _54 => _54.anthropic]);
|
|
1481
1560
|
if (anthropicMetadata) {
|
|
1482
1561
|
const cacheReadTokens = getNumberProperty(anthropicMetadata.usage, "cache_read_input_tokens") || 0;
|
|
1483
1562
|
const cacheCreationTokens = getNumberProperty(
|
|
1484
1563
|
anthropicMetadata.usage,
|
|
1485
1564
|
"cache_creation_input_tokens"
|
|
1486
1565
|
) || 0;
|
|
1487
|
-
const cacheTokens =
|
|
1566
|
+
const cacheTokens = _chunkSU6EHKJVjs.extractAnthropicCacheTokens.call(void 0,
|
|
1488
1567
|
cacheReadTokens,
|
|
1489
1568
|
cacheCreationTokens
|
|
1490
1569
|
);
|
|
1491
1570
|
Object.assign(metrics, cacheTokens);
|
|
1492
|
-
Object.assign(metrics,
|
|
1571
|
+
Object.assign(metrics, _chunkSU6EHKJVjs.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1493
1572
|
}
|
|
1494
1573
|
}
|
|
1495
1574
|
return metrics;
|
|
@@ -1503,7 +1582,7 @@ function buildAssistantOutputWithToolCalls(result, toolCalls2) {
|
|
|
1503
1582
|
{
|
|
1504
1583
|
index: 0,
|
|
1505
1584
|
logprobs: null,
|
|
1506
|
-
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess',
|
|
1585
|
+
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _55 => _55.finishReason])), () => ( (toolCalls2.length ? "tool_calls" : void 0))),
|
|
1507
1586
|
message: {
|
|
1508
1587
|
role: "assistant",
|
|
1509
1588
|
tool_calls: toolCalls2.length > 0 ? toolCalls2 : void 0
|
|
@@ -1516,7 +1595,7 @@ function extractToolCallsFromSteps(steps) {
|
|
|
1516
1595
|
if (!Array.isArray(steps)) return toolCalls2;
|
|
1517
1596
|
let idx = 0;
|
|
1518
1597
|
for (const step of steps) {
|
|
1519
|
-
const blocks = _optionalChain([step, 'optionalAccess',
|
|
1598
|
+
const blocks = _optionalChain([step, 'optionalAccess', _56 => _56.content]);
|
|
1520
1599
|
if (!Array.isArray(blocks)) continue;
|
|
1521
1600
|
for (const block of blocks) {
|
|
1522
1601
|
if (block && typeof block === "object" && block.type === "tool-call") {
|
|
@@ -1539,7 +1618,7 @@ function extractToolCallsFromBlocks(blocks) {
|
|
|
1539
1618
|
return extractToolCallsFromSteps([{ content: blocks }]);
|
|
1540
1619
|
}
|
|
1541
1620
|
function extractInput(params) {
|
|
1542
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
1621
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _57 => _57.prompt]), () => ( _optionalChain([params, 'optionalAccess', _58 => _58.messages]))), () => ( _optionalChain([params, 'optionalAccess', _59 => _59.system])));
|
|
1543
1622
|
}
|
|
1544
1623
|
var V2_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
|
|
1545
1624
|
"prompt",
|
|
@@ -1561,22 +1640,22 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1561
1640
|
model: modelFromWrapGenerate
|
|
1562
1641
|
}) => {
|
|
1563
1642
|
const rawInput = extractInput(params);
|
|
1564
|
-
const processedInput =
|
|
1643
|
+
const processedInput = _chunkSU6EHKJVjs.processInputAttachments.call(void 0, rawInput);
|
|
1565
1644
|
const spanArgs = {
|
|
1566
|
-
name: _optionalChain([config, 'access',
|
|
1645
|
+
name: _optionalChain([config, 'access', _60 => _60.spanInfo, 'optionalAccess', _61 => _61.name]) || "ai-sdk.doGenerate",
|
|
1567
1646
|
spanAttributes: {
|
|
1568
1647
|
type: "llm" /* LLM */,
|
|
1569
|
-
..._optionalChain([config, 'access',
|
|
1648
|
+
..._optionalChain([config, 'access', _62 => _62.spanInfo, 'optionalAccess', _63 => _63.spanAttributes]) || {}
|
|
1570
1649
|
},
|
|
1571
1650
|
event: {
|
|
1572
1651
|
input: processedInput,
|
|
1573
1652
|
metadata: {
|
|
1574
1653
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
1575
|
-
..._optionalChain([config, 'access',
|
|
1654
|
+
..._optionalChain([config, 'access', _64 => _64.spanInfo, 'optionalAccess', _65 => _65.metadata]) || {}
|
|
1576
1655
|
}
|
|
1577
1656
|
}
|
|
1578
1657
|
};
|
|
1579
|
-
const span =
|
|
1658
|
+
const span = _chunkSU6EHKJVjs.startSpan.call(void 0, spanArgs);
|
|
1580
1659
|
try {
|
|
1581
1660
|
const result = await doGenerate();
|
|
1582
1661
|
const metadata = {};
|
|
@@ -1598,12 +1677,12 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1598
1677
|
metadata.model = modelId;
|
|
1599
1678
|
}
|
|
1600
1679
|
}
|
|
1601
|
-
let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess',
|
|
1680
|
+
let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _66 => _66.steps]));
|
|
1602
1681
|
if (!toolCalls2 || toolCalls2.length === 0) {
|
|
1603
|
-
toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess',
|
|
1682
|
+
toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _67 => _67.content]));
|
|
1604
1683
|
}
|
|
1605
1684
|
span.log({
|
|
1606
|
-
output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess',
|
|
1685
|
+
output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess', _68 => _68.content]),
|
|
1607
1686
|
metadata,
|
|
1608
1687
|
metrics: normalizeUsageMetrics(
|
|
1609
1688
|
result.usage,
|
|
@@ -1623,22 +1702,22 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1623
1702
|
},
|
|
1624
1703
|
wrapStream: async ({ doStream, params }) => {
|
|
1625
1704
|
const rawInput = extractInput(params);
|
|
1626
|
-
const processedInput =
|
|
1705
|
+
const processedInput = _chunkSU6EHKJVjs.processInputAttachments.call(void 0, rawInput);
|
|
1627
1706
|
const spanArgs = {
|
|
1628
|
-
name: _optionalChain([config, 'access',
|
|
1707
|
+
name: _optionalChain([config, 'access', _69 => _69.spanInfo, 'optionalAccess', _70 => _70.name]) || "ai-sdk.doStream",
|
|
1629
1708
|
spanAttributes: {
|
|
1630
1709
|
type: "llm" /* LLM */,
|
|
1631
|
-
..._optionalChain([config, 'access',
|
|
1710
|
+
..._optionalChain([config, 'access', _71 => _71.spanInfo, 'optionalAccess', _72 => _72.spanAttributes]) || {}
|
|
1632
1711
|
},
|
|
1633
1712
|
event: {
|
|
1634
1713
|
input: processedInput,
|
|
1635
1714
|
metadata: {
|
|
1636
1715
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
1637
|
-
..._optionalChain([config, 'access',
|
|
1716
|
+
..._optionalChain([config, 'access', _73 => _73.spanInfo, 'optionalAccess', _74 => _74.metadata]) || {}
|
|
1638
1717
|
}
|
|
1639
1718
|
}
|
|
1640
1719
|
};
|
|
1641
|
-
const span =
|
|
1720
|
+
const span = _chunkSU6EHKJVjs.startSpan.call(void 0, spanArgs);
|
|
1642
1721
|
try {
|
|
1643
1722
|
const { stream, ...rest } = await doStream();
|
|
1644
1723
|
const textChunks = [];
|
|
@@ -1740,6 +1819,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1740
1819
|
var EVE_TRACE_STATE_KEY = "braintrust.eve.tracing";
|
|
1741
1820
|
var MAX_EVE_CACHE_ENTRIES = 1e4;
|
|
1742
1821
|
var MAX_STORED_LLM_INPUTS = 100;
|
|
1822
|
+
var MAX_STORED_REASONING_BLOCKS = 100;
|
|
1743
1823
|
var MAX_STORED_SPAN_REFERENCES = 1e4;
|
|
1744
1824
|
var MAX_STORED_STEP_STARTS = 1e4;
|
|
1745
1825
|
function braintrustEveHook(options) {
|
|
@@ -1761,7 +1841,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1761
1841
|
try {
|
|
1762
1842
|
captureEveModelInput(state, input);
|
|
1763
1843
|
} catch (error) {
|
|
1764
|
-
|
|
1844
|
+
_chunkSU6EHKJVjs.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
1765
1845
|
}
|
|
1766
1846
|
}
|
|
1767
1847
|
},
|
|
@@ -1771,7 +1851,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1771
1851
|
};
|
|
1772
1852
|
}
|
|
1773
1853
|
function isEveHandleMessageStreamEvent(event) {
|
|
1774
|
-
return
|
|
1854
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
1775
1855
|
}
|
|
1776
1856
|
var ResumedEveSpan = class {
|
|
1777
1857
|
constructor(reference) {
|
|
@@ -1779,6 +1859,7 @@ var ResumedEveSpan = class {
|
|
|
1779
1859
|
this.endTime = reference.endTime;
|
|
1780
1860
|
}
|
|
1781
1861
|
|
|
1862
|
+
|
|
1782
1863
|
get rootSpanId() {
|
|
1783
1864
|
return this.reference.rootSpanId;
|
|
1784
1865
|
}
|
|
@@ -1787,11 +1868,11 @@ var ResumedEveSpan = class {
|
|
|
1787
1868
|
}
|
|
1788
1869
|
log(event) {
|
|
1789
1870
|
const metrics = {
|
|
1790
|
-
..._optionalChain([this, 'access',
|
|
1871
|
+
..._optionalChain([this, 'access', _75 => _75.reference, 'access', _76 => _76.startEvent, 'optionalAccess', _77 => _77.metrics]),
|
|
1791
1872
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
1792
1873
|
...event.metrics
|
|
1793
1874
|
};
|
|
1794
|
-
|
|
1875
|
+
_chunkSU6EHKJVjs.updateSpan.call(void 0, {
|
|
1795
1876
|
exported: this.reference.exported,
|
|
1796
1877
|
...this.reference.startEvent,
|
|
1797
1878
|
...event,
|
|
@@ -1800,7 +1881,7 @@ var ResumedEveSpan = class {
|
|
|
1800
1881
|
}
|
|
1801
1882
|
end(args) {
|
|
1802
1883
|
if (this.endTime === void 0) {
|
|
1803
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
1884
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => ( _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1804
1885
|
this.log({ metrics: { end: this.endTime } });
|
|
1805
1886
|
}
|
|
1806
1887
|
return this.endTime;
|
|
@@ -1810,39 +1891,40 @@ var EveBridge = (_class = class {
|
|
|
1810
1891
|
constructor(state) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);
|
|
1811
1892
|
this.state = state;
|
|
1812
1893
|
}
|
|
1894
|
+
|
|
1813
1895
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
1814
|
-
__init2() {this.completedToolKeys = new (0,
|
|
1896
|
+
__init2() {this.completedToolKeys = new (0, _chunkSU6EHKJVjs.LRUCache)({
|
|
1815
1897
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1816
1898
|
})}
|
|
1817
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
1899
|
+
__init3() {this.toolsByCallKey = new (0, _chunkSU6EHKJVjs.LRUCache)({
|
|
1818
1900
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1819
1901
|
})}
|
|
1820
|
-
__init4() {this.turnsByKey = new (0,
|
|
1902
|
+
__init4() {this.turnsByKey = new (0, _chunkSU6EHKJVjs.LRUCache)({
|
|
1821
1903
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1822
1904
|
})}
|
|
1823
1905
|
async startEveSpan(args) {
|
|
1824
|
-
const rowId = _optionalChain([args, 'optionalAccess',
|
|
1906
|
+
const rowId = _optionalChain([args, 'optionalAccess', _79 => _79.event, 'optionalAccess', _80 => _80.id]);
|
|
1825
1907
|
const reference = typeof rowId === "string" && readEveTraceState(this.state).spanReferences.find(
|
|
1826
1908
|
(candidate) => candidate.rowId === rowId
|
|
1827
1909
|
);
|
|
1828
1910
|
if (reference) {
|
|
1829
1911
|
return new ResumedEveSpan(reference);
|
|
1830
1912
|
}
|
|
1831
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
1832
|
-
const parentSpanIds = _optionalChain([args, 'optionalAccess',
|
|
1913
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => ( _chunkSU6EHKJVjs.getCurrentUnixTimestamp.call(void 0, )));
|
|
1914
|
+
const parentSpanIds = _optionalChain([args, 'optionalAccess', _82 => _82.parentSpanIds]);
|
|
1833
1915
|
const startEvent = {
|
|
1834
1916
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1835
1917
|
metrics: { start: startTime },
|
|
1836
1918
|
span_attributes: {
|
|
1837
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1838
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1839
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1919
|
+
..._optionalChain([args, 'optionalAccess', _83 => _83.name]) ? { name: args.name } : {},
|
|
1920
|
+
..._optionalChain([args, 'optionalAccess', _84 => _84.type]) ? { type: args.type } : {},
|
|
1921
|
+
..._optionalChain([args, 'optionalAccess', _85 => _85.spanAttributes])
|
|
1840
1922
|
},
|
|
1841
1923
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
1842
1924
|
};
|
|
1843
|
-
const span =
|
|
1844
|
-
|
|
1845
|
-
() =>
|
|
1925
|
+
const span = _chunkSU6EHKJVjs.withCurrent.call(void 0,
|
|
1926
|
+
_chunkSU6EHKJVjs.NOOP_SPAN,
|
|
1927
|
+
() => _chunkSU6EHKJVjs._internalStartSpanWithInitialMerge.call(void 0, { ...args, startTime })
|
|
1846
1928
|
);
|
|
1847
1929
|
if (typeof rowId !== "string") {
|
|
1848
1930
|
return span;
|
|
@@ -1868,7 +1950,7 @@ var EveBridge = (_class = class {
|
|
|
1868
1950
|
};
|
|
1869
1951
|
});
|
|
1870
1952
|
} catch (error) {
|
|
1871
|
-
|
|
1953
|
+
_chunkSU6EHKJVjs.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
1872
1954
|
}
|
|
1873
1955
|
return span;
|
|
1874
1956
|
}
|
|
@@ -1888,7 +1970,7 @@ var EveBridge = (_class = class {
|
|
|
1888
1970
|
const previous = state.stepStarts.filter(
|
|
1889
1971
|
(entry) => entry.turnId === event.data.turnId && entry.stepIndex === event.data.stepIndex
|
|
1890
1972
|
).at(-1);
|
|
1891
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
1973
|
+
if (_optionalChain([previous, 'optionalAccess', _86 => _86.open])) {
|
|
1892
1974
|
ordinal = previous.ordinal;
|
|
1893
1975
|
return state;
|
|
1894
1976
|
}
|
|
@@ -1916,12 +1998,12 @@ var EveBridge = (_class = class {
|
|
|
1916
1998
|
let index = -1;
|
|
1917
1999
|
for (let i = state.stepStarts.length - 1; i >= 0; i--) {
|
|
1918
2000
|
const entry = state.stepStarts[i];
|
|
1919
|
-
if (_optionalChain([entry, 'optionalAccess',
|
|
2001
|
+
if (_optionalChain([entry, 'optionalAccess', _87 => _87.turnId]) === turnId && entry.stepIndex === stepIndex) {
|
|
1920
2002
|
index = i;
|
|
1921
2003
|
break;
|
|
1922
2004
|
}
|
|
1923
2005
|
}
|
|
1924
|
-
if (index < 0 || !_optionalChain([state, 'access',
|
|
2006
|
+
if (index < 0 || !_optionalChain([state, 'access', _88 => _88.stepStarts, 'access', _89 => _89[index], 'optionalAccess', _90 => _90.open])) {
|
|
1925
2007
|
return state;
|
|
1926
2008
|
}
|
|
1927
2009
|
return {
|
|
@@ -1955,7 +2037,7 @@ var EveBridge = (_class = class {
|
|
|
1955
2037
|
}
|
|
1956
2038
|
}
|
|
1957
2039
|
} catch (error) {
|
|
1958
|
-
|
|
2040
|
+
_chunkSU6EHKJVjs.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
1959
2041
|
}
|
|
1960
2042
|
};
|
|
1961
2043
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -1988,6 +2070,9 @@ var EveBridge = (_class = class {
|
|
|
1988
2070
|
case "step.started":
|
|
1989
2071
|
await this.handleStepStarted(event, ctx, hookMetadata);
|
|
1990
2072
|
return true;
|
|
2073
|
+
case "reasoning.completed":
|
|
2074
|
+
this.handleReasoningCompleted(event, ctx);
|
|
2075
|
+
return true;
|
|
1991
2076
|
case "message.completed":
|
|
1992
2077
|
this.handleMessageCompleted(event, ctx);
|
|
1993
2078
|
return true;
|
|
@@ -2079,6 +2164,7 @@ var EveBridge = (_class = class {
|
|
|
2079
2164
|
key,
|
|
2080
2165
|
metadata,
|
|
2081
2166
|
metrics: {},
|
|
2167
|
+
sessionId,
|
|
2082
2168
|
span,
|
|
2083
2169
|
stepsByIndex: /* @__PURE__ */ new Map(),
|
|
2084
2170
|
turnId: event.data.turnId
|
|
@@ -2109,6 +2195,12 @@ var EveBridge = (_class = class {
|
|
|
2109
2195
|
const endTime = eventTime(event);
|
|
2110
2196
|
existing.span.end(endTime === void 0 ? void 0 : { endTime });
|
|
2111
2197
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2198
|
+
clearStoredEveReasoning(
|
|
2199
|
+
this.state,
|
|
2200
|
+
sessionId,
|
|
2201
|
+
event.data.turnId,
|
|
2202
|
+
event.data.stepIndex
|
|
2203
|
+
);
|
|
2112
2204
|
}
|
|
2113
2205
|
const stepOrdinal = this.stepOrdinal(event);
|
|
2114
2206
|
const metadata = { ...turn.metadata };
|
|
@@ -2118,6 +2210,13 @@ var EveBridge = (_class = class {
|
|
|
2118
2210
|
event.data.turnId,
|
|
2119
2211
|
event.data.stepIndex
|
|
2120
2212
|
);
|
|
2213
|
+
const reasoning = readStoredEveReasoning(
|
|
2214
|
+
this.state,
|
|
2215
|
+
sessionId,
|
|
2216
|
+
event.data.turnId,
|
|
2217
|
+
event.data.stepIndex
|
|
2218
|
+
);
|
|
2219
|
+
const output = mergeEveReasoning(void 0, reasoning);
|
|
2121
2220
|
const { rowId: eventId, spanId } = await generateEveIds(
|
|
2122
2221
|
"step",
|
|
2123
2222
|
sessionId,
|
|
@@ -2135,32 +2234,52 @@ var EveBridge = (_class = class {
|
|
|
2135
2234
|
spanId,
|
|
2136
2235
|
startTime: eventTime(event)
|
|
2137
2236
|
});
|
|
2138
|
-
span.log({
|
|
2237
|
+
span.log({
|
|
2238
|
+
...input !== void 0 ? { input } : {},
|
|
2239
|
+
metadata
|
|
2240
|
+
});
|
|
2139
2241
|
turn.stepsByIndex.set(event.data.stepIndex, {
|
|
2140
2242
|
...input !== void 0 ? { input } : {},
|
|
2141
2243
|
metadata,
|
|
2142
2244
|
metrics: {},
|
|
2245
|
+
...output !== void 0 ? { output } : {},
|
|
2246
|
+
reasoning,
|
|
2143
2247
|
span
|
|
2144
2248
|
});
|
|
2145
2249
|
}
|
|
2250
|
+
handleReasoningCompleted(event, ctx) {
|
|
2251
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2252
|
+
if (!sessionId) {
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
const reasoning = storeEveReasoning(this.state, sessionId, event);
|
|
2256
|
+
const step = this.stepForEvent(event, ctx);
|
|
2257
|
+
if (step) {
|
|
2258
|
+
step.reasoning = reasoning;
|
|
2259
|
+
step.output = mergeEveReasoning(step.output, reasoning);
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2146
2262
|
handleMessageCompleted(event, ctx) {
|
|
2147
2263
|
const step = this.stepForEvent(event, ctx);
|
|
2148
2264
|
if (!step) {
|
|
2149
2265
|
return;
|
|
2150
2266
|
}
|
|
2151
|
-
const existingMessage =
|
|
2152
|
-
const existingToolCalls =
|
|
2153
|
-
step.output =
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2267
|
+
const existingMessage = eveOutputMessage(step.output);
|
|
2268
|
+
const existingToolCalls = _chunkSU6EHKJVjs.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2269
|
+
step.output = mergeEveReasoning(
|
|
2270
|
+
[
|
|
2271
|
+
{
|
|
2272
|
+
finish_reason: normalizedFinishReason(event.data.finishReason),
|
|
2273
|
+
index: 0,
|
|
2274
|
+
message: {
|
|
2275
|
+
content: event.data.message,
|
|
2276
|
+
role: "assistant",
|
|
2277
|
+
...Array.isArray(existingToolCalls) ? { tool_calls: existingToolCalls } : {}
|
|
2278
|
+
}
|
|
2161
2279
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2280
|
+
],
|
|
2281
|
+
step.reasoning
|
|
2282
|
+
);
|
|
2164
2283
|
const turn = this.turnForEvent(event, ctx);
|
|
2165
2284
|
if (turn && event.data.finishReason !== "tool-calls") {
|
|
2166
2285
|
turn.output = event.data.message;
|
|
@@ -2169,16 +2288,19 @@ var EveBridge = (_class = class {
|
|
|
2169
2288
|
handleResultCompleted(event, ctx) {
|
|
2170
2289
|
const step = this.stepForEvent(event, ctx);
|
|
2171
2290
|
if (step) {
|
|
2172
|
-
step.output =
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2291
|
+
step.output = mergeEveReasoning(
|
|
2292
|
+
[
|
|
2293
|
+
{
|
|
2294
|
+
finish_reason: "stop",
|
|
2295
|
+
index: 0,
|
|
2296
|
+
message: {
|
|
2297
|
+
content: event.data.result,
|
|
2298
|
+
role: "assistant"
|
|
2299
|
+
}
|
|
2179
2300
|
}
|
|
2180
|
-
|
|
2181
|
-
|
|
2301
|
+
],
|
|
2302
|
+
step.reasoning
|
|
2303
|
+
);
|
|
2182
2304
|
}
|
|
2183
2305
|
const turn = this.turnForEvent(event, ctx);
|
|
2184
2306
|
if (turn) {
|
|
@@ -2207,11 +2329,11 @@ var EveBridge = (_class = class {
|
|
|
2207
2329
|
return;
|
|
2208
2330
|
}
|
|
2209
2331
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2210
|
-
if (Array.isArray(step.output) &&
|
|
2332
|
+
if (Array.isArray(step.output) && _chunkSU6EHKJVjs.isObject.call(void 0, step.output[0])) {
|
|
2211
2333
|
const message = step.output[0]["message"];
|
|
2212
|
-
if (
|
|
2334
|
+
if (_chunkSU6EHKJVjs.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2213
2335
|
for (const toolCall of message["tool_calls"]) {
|
|
2214
|
-
if (
|
|
2336
|
+
if (_chunkSU6EHKJVjs.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2215
2337
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2216
2338
|
}
|
|
2217
2339
|
}
|
|
@@ -2228,18 +2350,20 @@ var EveBridge = (_class = class {
|
|
|
2228
2350
|
type: "function"
|
|
2229
2351
|
});
|
|
2230
2352
|
}
|
|
2231
|
-
step.output =
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2353
|
+
step.output = mergeEveReasoning(
|
|
2354
|
+
[
|
|
2355
|
+
{
|
|
2356
|
+
finish_reason: "tool_calls",
|
|
2357
|
+
index: 0,
|
|
2358
|
+
message: {
|
|
2359
|
+
content: null,
|
|
2360
|
+
role: "assistant",
|
|
2361
|
+
tool_calls: [...toolCallsById.values()]
|
|
2362
|
+
}
|
|
2239
2363
|
}
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2364
|
+
],
|
|
2365
|
+
step.reasoning
|
|
2366
|
+
);
|
|
2243
2367
|
}
|
|
2244
2368
|
async handleActionResult(event, ctx, hookMetadata) {
|
|
2245
2369
|
if (isToolResult(event.data.result)) {
|
|
@@ -2282,7 +2406,7 @@ var EveBridge = (_class = class {
|
|
|
2282
2406
|
this.completedToolKeys.set(key, true);
|
|
2283
2407
|
}
|
|
2284
2408
|
async handleSubagentCalled(event, ctx, hookMetadata) {
|
|
2285
|
-
if (_optionalChain([event, 'access',
|
|
2409
|
+
if (_optionalChain([event, 'access', _91 => _91.data, 'access', _92 => _92.remote, 'optionalAccess', _93 => _93.url])) {
|
|
2286
2410
|
return;
|
|
2287
2411
|
}
|
|
2288
2412
|
const turn = await this.ensureTurn(event, ctx, hookMetadata);
|
|
@@ -2402,11 +2526,11 @@ var EveBridge = (_class = class {
|
|
|
2402
2526
|
return;
|
|
2403
2527
|
}
|
|
2404
2528
|
const usage = event.data.usage;
|
|
2405
|
-
const inputTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2406
|
-
const outputTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2407
|
-
const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2408
|
-
const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2409
|
-
const costUsd = typeof _optionalChain([usage, 'optionalAccess',
|
|
2529
|
+
const inputTokens = typeof _optionalChain([usage, 'optionalAccess', _94 => _94.inputTokens]) === "number" && Number.isFinite(usage.inputTokens) && usage.inputTokens >= 0 ? usage.inputTokens : void 0;
|
|
2530
|
+
const outputTokens = typeof _optionalChain([usage, 'optionalAccess', _95 => _95.outputTokens]) === "number" && Number.isFinite(usage.outputTokens) && usage.outputTokens >= 0 ? usage.outputTokens : void 0;
|
|
2531
|
+
const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess', _96 => _96.cacheReadTokens]) === "number" && Number.isFinite(usage.cacheReadTokens) && usage.cacheReadTokens >= 0 ? usage.cacheReadTokens : void 0;
|
|
2532
|
+
const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess', _97 => _97.cacheWriteTokens]) === "number" && Number.isFinite(usage.cacheWriteTokens) && usage.cacheWriteTokens >= 0 ? usage.cacheWriteTokens : void 0;
|
|
2533
|
+
const costUsd = typeof _optionalChain([usage, 'optionalAccess', _98 => _98.costUsd]) === "number" && Number.isFinite(usage.costUsd) && usage.costUsd >= 0 ? usage.costUsd : void 0;
|
|
2410
2534
|
const total = inputTokens !== void 0 && outputTokens !== void 0 ? inputTokens + outputTokens : void 0;
|
|
2411
2535
|
const metrics = {
|
|
2412
2536
|
...inputTokens !== void 0 ? { prompt_tokens: inputTokens } : {},
|
|
@@ -2417,7 +2541,8 @@ var EveBridge = (_class = class {
|
|
|
2417
2541
|
...costUsd !== void 0 ? { estimated_cost: costUsd } : {}
|
|
2418
2542
|
};
|
|
2419
2543
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2420
|
-
|
|
2544
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2545
|
+
if (Array.isArray(step.output) && _chunkSU6EHKJVjs.isObject.call(void 0, step.output[0])) {
|
|
2421
2546
|
const finishReason = step.output[0].finish_reason;
|
|
2422
2547
|
if (typeof finishReason !== "string") {
|
|
2423
2548
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -2441,6 +2566,14 @@ var EveBridge = (_class = class {
|
|
|
2441
2566
|
turn.stepsByIndex.delete(event.data.stepIndex);
|
|
2442
2567
|
}
|
|
2443
2568
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2569
|
+
if (sessionId) {
|
|
2570
|
+
clearStoredEveReasoning(
|
|
2571
|
+
this.state,
|
|
2572
|
+
sessionId,
|
|
2573
|
+
event.data.turnId,
|
|
2574
|
+
event.data.stepIndex
|
|
2575
|
+
);
|
|
2576
|
+
}
|
|
2444
2577
|
}
|
|
2445
2578
|
handleStepFailed(event, ctx) {
|
|
2446
2579
|
const step = this.stepForEvent(event, ctx);
|
|
@@ -2456,8 +2589,17 @@ var EveBridge = (_class = class {
|
|
|
2456
2589
|
step.span.end(endTime === void 0 ? void 0 : { endTime });
|
|
2457
2590
|
}
|
|
2458
2591
|
const turn = this.turnForEvent(event, ctx);
|
|
2459
|
-
_optionalChain([turn, 'optionalAccess',
|
|
2592
|
+
_optionalChain([turn, 'optionalAccess', _99 => _99.stepsByIndex, 'access', _100 => _100.delete, 'call', _101 => _101(event.data.stepIndex)]);
|
|
2460
2593
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2594
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2595
|
+
if (sessionId) {
|
|
2596
|
+
clearStoredEveReasoning(
|
|
2597
|
+
this.state,
|
|
2598
|
+
sessionId,
|
|
2599
|
+
event.data.turnId,
|
|
2600
|
+
event.data.stepIndex
|
|
2601
|
+
);
|
|
2602
|
+
}
|
|
2461
2603
|
}
|
|
2462
2604
|
handleTurnCompleted(event, ctx) {
|
|
2463
2605
|
const turn = this.turnForEvent(event, ctx);
|
|
@@ -2555,6 +2697,7 @@ var EveBridge = (_class = class {
|
|
|
2555
2697
|
key,
|
|
2556
2698
|
metadata,
|
|
2557
2699
|
metrics: {},
|
|
2700
|
+
sessionId,
|
|
2558
2701
|
span,
|
|
2559
2702
|
stepsByIndex: /* @__PURE__ */ new Map(),
|
|
2560
2703
|
turnId: event.data.turnId
|
|
@@ -2737,10 +2880,10 @@ var EveBridge = (_class = class {
|
|
|
2737
2880
|
return state;
|
|
2738
2881
|
}
|
|
2739
2882
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
2740
|
-
const session =
|
|
2741
|
-
const parent =
|
|
2742
|
-
const parentTurn =
|
|
2743
|
-
const parentLineage =
|
|
2883
|
+
const session = _chunkSU6EHKJVjs.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
|
|
2884
|
+
const parent = _chunkSU6EHKJVjs.isObject.call(void 0, session) ? session["parent"] : void 0;
|
|
2885
|
+
const parentTurn = _chunkSU6EHKJVjs.isObject.call(void 0, parent) ? parent["turn"] : void 0;
|
|
2886
|
+
const parentLineage = _chunkSU6EHKJVjs.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkSU6EHKJVjs.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
|
|
2744
2887
|
callId: parent["callId"],
|
|
2745
2888
|
sessionId: parent["sessionId"],
|
|
2746
2889
|
turnId: parentTurn["id"]
|
|
@@ -2749,8 +2892,8 @@ var EveBridge = (_class = class {
|
|
|
2749
2892
|
generateEveIds("turn", sessionId, event.data.turnId),
|
|
2750
2893
|
deterministicEveId(
|
|
2751
2894
|
"eve:root",
|
|
2752
|
-
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess',
|
|
2753
|
-
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess',
|
|
2895
|
+
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _102 => _102.sessionId]), () => ( sessionId)),
|
|
2896
|
+
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _103 => _103.turnId]), () => ( event.data.turnId))
|
|
2754
2897
|
),
|
|
2755
2898
|
parentLineage ? deterministicEveId(
|
|
2756
2899
|
"eve:subagent",
|
|
@@ -2775,7 +2918,7 @@ var EveBridge = (_class = class {
|
|
|
2775
2918
|
return sessionId ? this.turnsByKey.get(turnKey(sessionId, event.data.turnId)) : void 0;
|
|
2776
2919
|
}
|
|
2777
2920
|
stepForEvent(event, ctx) {
|
|
2778
|
-
return _optionalChain([this, 'access',
|
|
2921
|
+
return _optionalChain([this, 'access', _104 => _104.turnForEvent, 'call', _105 => _105(event, ctx), 'optionalAccess', _106 => _106.stepsByIndex, 'access', _107 => _107.get, 'call', _108 => _108(
|
|
2779
2922
|
event.data.stepIndex
|
|
2780
2923
|
)]);
|
|
2781
2924
|
}
|
|
@@ -2817,6 +2960,9 @@ var EveBridge = (_class = class {
|
|
|
2817
2960
|
const normalized = normalizeEveTraceState(current);
|
|
2818
2961
|
return {
|
|
2819
2962
|
...normalized,
|
|
2963
|
+
reasoningBlocks: normalized.reasoningBlocks.filter(
|
|
2964
|
+
(entry) => !entry.key.startsWith(`${turn.sessionId}\0${turn.turnId}\0`)
|
|
2965
|
+
),
|
|
2820
2966
|
stepStarts: normalized.stepStarts.filter(
|
|
2821
2967
|
(entry) => entry.turnId !== turn.turnId
|
|
2822
2968
|
)
|
|
@@ -2844,10 +2990,10 @@ var EveBridge = (_class = class {
|
|
|
2844
2990
|
}
|
|
2845
2991
|
async flushInstrumentation() {
|
|
2846
2992
|
try {
|
|
2847
|
-
await
|
|
2993
|
+
await _chunkSU6EHKJVjs.flush.call(void 0, );
|
|
2848
2994
|
return true;
|
|
2849
2995
|
} catch (error) {
|
|
2850
|
-
|
|
2996
|
+
_chunkSU6EHKJVjs.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
2851
2997
|
return false;
|
|
2852
2998
|
}
|
|
2853
2999
|
}
|
|
@@ -2856,17 +3002,18 @@ function emptyEveTraceState() {
|
|
|
2856
3002
|
return {
|
|
2857
3003
|
llmInputs: [],
|
|
2858
3004
|
metadata: {},
|
|
3005
|
+
reasoningBlocks: [],
|
|
2859
3006
|
spanReferences: [],
|
|
2860
3007
|
stepStarts: []
|
|
2861
3008
|
};
|
|
2862
3009
|
}
|
|
2863
3010
|
function normalizeEveTraceState(state) {
|
|
2864
|
-
if (!
|
|
3011
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, state)) {
|
|
2865
3012
|
return emptyEveTraceState();
|
|
2866
3013
|
}
|
|
2867
|
-
const metadata =
|
|
3014
|
+
const metadata = _chunkSU6EHKJVjs.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
2868
3015
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
2869
|
-
if (!
|
|
3016
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, entry)) {
|
|
2870
3017
|
return [];
|
|
2871
3018
|
}
|
|
2872
3019
|
const exported = entry["exported"];
|
|
@@ -2875,11 +3022,11 @@ function normalizeEveTraceState(state) {
|
|
|
2875
3022
|
const rowId = entry["rowId"];
|
|
2876
3023
|
const spanId = entry["spanId"];
|
|
2877
3024
|
const startEvent = entry["startEvent"];
|
|
2878
|
-
const startEventCreated =
|
|
2879
|
-
const startEventMetrics =
|
|
2880
|
-
const startEventSpanAttributes =
|
|
2881
|
-
const startEventSpanParents =
|
|
2882
|
-
const normalizedStartEvent = typeof startEventCreated === "string" &&
|
|
3025
|
+
const startEventCreated = _chunkSU6EHKJVjs.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
|
|
3026
|
+
const startEventMetrics = _chunkSU6EHKJVjs.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
|
|
3027
|
+
const startEventSpanAttributes = _chunkSU6EHKJVjs.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
|
|
3028
|
+
const startEventSpanParents = _chunkSU6EHKJVjs.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
|
|
3029
|
+
const normalizedStartEvent = typeof startEventCreated === "string" && _chunkSU6EHKJVjs.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkSU6EHKJVjs.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
|
|
2883
3030
|
(parent) => typeof parent === "string"
|
|
2884
3031
|
) ? {
|
|
2885
3032
|
created: startEventCreated,
|
|
@@ -2899,15 +3046,30 @@ function normalizeEveTraceState(state) {
|
|
|
2899
3046
|
] : [];
|
|
2900
3047
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
2901
3048
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
2902
|
-
if (!
|
|
3049
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, entry)) {
|
|
2903
3050
|
return [];
|
|
2904
3051
|
}
|
|
2905
3052
|
const key = entry["key"];
|
|
2906
3053
|
const input = entry["input"];
|
|
2907
3054
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
2908
3055
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
3056
|
+
const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
|
|
3057
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, entry)) {
|
|
3058
|
+
return [];
|
|
3059
|
+
}
|
|
3060
|
+
const content = entry["content"];
|
|
3061
|
+
const eventAt = entry["eventAt"];
|
|
3062
|
+
const key = entry["key"];
|
|
3063
|
+
return typeof content === "string" && (eventAt === void 0 || typeof eventAt === "string") && typeof key === "string" ? [
|
|
3064
|
+
{
|
|
3065
|
+
content,
|
|
3066
|
+
...typeof eventAt === "string" ? { eventAt } : {},
|
|
3067
|
+
key
|
|
3068
|
+
}
|
|
3069
|
+
] : [];
|
|
3070
|
+
}).slice(-MAX_STORED_REASONING_BLOCKS) : [];
|
|
2909
3071
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
2910
|
-
if (!
|
|
3072
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, entry)) {
|
|
2911
3073
|
return [];
|
|
2912
3074
|
}
|
|
2913
3075
|
const ordinal = entry["ordinal"];
|
|
@@ -2916,32 +3078,100 @@ function normalizeEveTraceState(state) {
|
|
|
2916
3078
|
const turnId = entry["turnId"];
|
|
2917
3079
|
return typeof ordinal === "number" && Number.isInteger(ordinal) && ordinal >= 0 && typeof open === "boolean" && typeof stepIndex === "number" && Number.isInteger(stepIndex) && typeof turnId === "string" ? [{ open, ordinal, stepIndex, turnId }] : [];
|
|
2918
3080
|
}).slice(-MAX_STORED_STEP_STARTS) : [];
|
|
2919
|
-
return {
|
|
3081
|
+
return {
|
|
3082
|
+
llmInputs,
|
|
3083
|
+
metadata: { ...metadata },
|
|
3084
|
+
reasoningBlocks,
|
|
3085
|
+
spanReferences,
|
|
3086
|
+
stepStarts
|
|
3087
|
+
};
|
|
2920
3088
|
}
|
|
2921
3089
|
function readEveTraceState(state) {
|
|
2922
3090
|
try {
|
|
2923
3091
|
return normalizeEveTraceState(state.get());
|
|
2924
|
-
} catch (
|
|
3092
|
+
} catch (e4) {
|
|
2925
3093
|
return emptyEveTraceState();
|
|
2926
3094
|
}
|
|
2927
3095
|
}
|
|
2928
|
-
function
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
3096
|
+
function storeEveReasoning(state, sessionId, event) {
|
|
3097
|
+
const eventAt = _optionalChain([event, 'access', _109 => _109.meta, 'optionalAccess', _110 => _110.at]);
|
|
3098
|
+
const key = llmInputKey(sessionId, event.data.turnId, event.data.stepIndex);
|
|
3099
|
+
let stored = [];
|
|
3100
|
+
state.update((current) => {
|
|
3101
|
+
const normalized = normalizeEveTraceState(current);
|
|
3102
|
+
const alreadyStored = normalized.reasoningBlocks.some(
|
|
3103
|
+
(entry) => entry.content === event.data.reasoning && entry.eventAt === eventAt && entry.key === key
|
|
3104
|
+
);
|
|
3105
|
+
const reasoningBlocks = alreadyStored ? normalized.reasoningBlocks : [
|
|
3106
|
+
...normalized.reasoningBlocks,
|
|
3107
|
+
{
|
|
3108
|
+
content: event.data.reasoning,
|
|
3109
|
+
...eventAt ? { eventAt } : {},
|
|
3110
|
+
key
|
|
3111
|
+
}
|
|
3112
|
+
].slice(-MAX_STORED_REASONING_BLOCKS);
|
|
3113
|
+
stored = reasoningBlocks.flatMap(
|
|
3114
|
+
(entry) => entry.key === key ? [
|
|
3115
|
+
{
|
|
3116
|
+
content: entry.content,
|
|
3117
|
+
...entry.eventAt ? { eventAt: entry.eventAt } : {}
|
|
3118
|
+
}
|
|
3119
|
+
] : []
|
|
3120
|
+
);
|
|
3121
|
+
return alreadyStored ? normalized : { ...normalized, reasoningBlocks };
|
|
3122
|
+
});
|
|
3123
|
+
return stored;
|
|
3124
|
+
}
|
|
3125
|
+
function readStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
3126
|
+
const key = llmInputKey(sessionId, turnId, stepIndex);
|
|
3127
|
+
return readEveTraceState(state).reasoningBlocks.flatMap(
|
|
3128
|
+
(entry) => entry.key === key ? [
|
|
3129
|
+
{
|
|
3130
|
+
content: entry.content,
|
|
3131
|
+
...entry.eventAt ? { eventAt: entry.eventAt } : {}
|
|
3132
|
+
}
|
|
3133
|
+
] : []
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3136
|
+
function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
3137
|
+
const key = llmInputKey(sessionId, turnId, stepIndex);
|
|
3138
|
+
state.update((current) => {
|
|
3139
|
+
const normalized = normalizeEveTraceState(current);
|
|
3140
|
+
return {
|
|
3141
|
+
...normalized,
|
|
3142
|
+
reasoningBlocks: normalized.reasoningBlocks.filter(
|
|
3143
|
+
(entry) => entry.key !== key
|
|
3144
|
+
)
|
|
3145
|
+
};
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
function eveOutputMessage(output) {
|
|
3149
|
+
return Array.isArray(output) && _chunkSU6EHKJVjs.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
|
|
3150
|
+
}
|
|
3151
|
+
function mergeEveReasoning(output, reasoning) {
|
|
3152
|
+
if (reasoning.length === 0) {
|
|
3153
|
+
return output;
|
|
2943
3154
|
}
|
|
2944
|
-
const
|
|
3155
|
+
const choice = Array.isArray(output) && _chunkSU6EHKJVjs.isObject.call(void 0, output[0]) ? output[0] : {};
|
|
3156
|
+
const message = _chunkSU6EHKJVjs.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
|
|
3157
|
+
return [
|
|
3158
|
+
{
|
|
3159
|
+
...choice,
|
|
3160
|
+
index: typeof choice["index"] === "number" ? choice["index"] : 0,
|
|
3161
|
+
message: {
|
|
3162
|
+
...message,
|
|
3163
|
+
content: "content" in message ? message["content"] : null,
|
|
3164
|
+
reasoning: reasoning.map((block) => ({ content: block.content })),
|
|
3165
|
+
role: typeof message["role"] === "string" ? message["role"] : "assistant"
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
];
|
|
3169
|
+
}
|
|
3170
|
+
function captureEveModelInput(state, input) {
|
|
3171
|
+
const sessionId = input.session.id;
|
|
3172
|
+
const turnId = input.turn.id;
|
|
3173
|
+
const stepIndex = input.step.index;
|
|
3174
|
+
const captured = capturedModelInput(input.modelInput);
|
|
2945
3175
|
if (!captured) {
|
|
2946
3176
|
return;
|
|
2947
3177
|
}
|
|
@@ -2967,7 +3197,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
2967
3197
|
if (index < 0) {
|
|
2968
3198
|
return normalized;
|
|
2969
3199
|
}
|
|
2970
|
-
input = _optionalChain([normalized, 'access',
|
|
3200
|
+
input = _optionalChain([normalized, 'access', _111 => _111.llmInputs, 'access', _112 => _112[index], 'optionalAccess', _113 => _113.input]);
|
|
2971
3201
|
return {
|
|
2972
3202
|
...normalized,
|
|
2973
3203
|
llmInputs: normalized.llmInputs.filter(
|
|
@@ -2977,41 +3207,152 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
2977
3207
|
});
|
|
2978
3208
|
return input;
|
|
2979
3209
|
} catch (error) {
|
|
2980
|
-
|
|
3210
|
+
_chunkSU6EHKJVjs.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
2981
3211
|
return void 0;
|
|
2982
3212
|
}
|
|
2983
3213
|
}
|
|
2984
3214
|
function capturedModelInput(modelInput) {
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
if (
|
|
2990
|
-
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
const value = [
|
|
2994
|
-
...instructions !== void 0 ? [{ content: instructions, role: "system" }] : [],
|
|
2995
|
-
...messages
|
|
2996
|
-
];
|
|
3215
|
+
const { instructions, messages } = modelInput;
|
|
3216
|
+
const value = [];
|
|
3217
|
+
if (typeof instructions === "string") {
|
|
3218
|
+
value.push({ content: instructions, role: "system" });
|
|
3219
|
+
} else if (instructions) {
|
|
3220
|
+
value.push(...instructions.map(capturedEveModelMessage));
|
|
3221
|
+
}
|
|
3222
|
+
value.push(...messages.map(capturedEveModelMessage));
|
|
2997
3223
|
try {
|
|
2998
3224
|
const cloned = JSON.parse(JSON.stringify(value));
|
|
2999
3225
|
if (!Array.isArray(cloned)) {
|
|
3000
3226
|
return void 0;
|
|
3001
3227
|
}
|
|
3002
3228
|
return cloned;
|
|
3003
|
-
} catch (
|
|
3229
|
+
} catch (e5) {
|
|
3004
3230
|
return void 0;
|
|
3005
3231
|
}
|
|
3006
3232
|
}
|
|
3233
|
+
function capturedEveModelMessage(message) {
|
|
3234
|
+
const { content, role } = message;
|
|
3235
|
+
if (typeof content === "string") {
|
|
3236
|
+
return { content, role };
|
|
3237
|
+
}
|
|
3238
|
+
return { content: content.map(capturedEveModelContentPart), role };
|
|
3239
|
+
}
|
|
3240
|
+
function capturedEveModelContentPart(part) {
|
|
3241
|
+
switch (part.type) {
|
|
3242
|
+
case "text":
|
|
3243
|
+
case "reasoning":
|
|
3244
|
+
return { text: part.text, type: part.type };
|
|
3245
|
+
case "image":
|
|
3246
|
+
return {
|
|
3247
|
+
image: part.image,
|
|
3248
|
+
...part.mediaType !== void 0 ? { mediaType: part.mediaType } : {},
|
|
3249
|
+
type: "image"
|
|
3250
|
+
};
|
|
3251
|
+
case "file":
|
|
3252
|
+
case "reasoning-file":
|
|
3253
|
+
return {
|
|
3254
|
+
data: part.data,
|
|
3255
|
+
...part.type === "file" && part.filename !== void 0 ? { filename: part.filename } : {},
|
|
3256
|
+
mediaType: part.mediaType,
|
|
3257
|
+
type: part.type
|
|
3258
|
+
};
|
|
3259
|
+
case "custom":
|
|
3260
|
+
return {
|
|
3261
|
+
..."kind" in part ? { kind: part.kind } : {},
|
|
3262
|
+
type: "custom"
|
|
3263
|
+
};
|
|
3264
|
+
case "tool-call":
|
|
3265
|
+
return {
|
|
3266
|
+
input: part.input,
|
|
3267
|
+
...part.providerExecuted !== void 0 ? { providerExecuted: part.providerExecuted } : {},
|
|
3268
|
+
toolCallId: part.toolCallId,
|
|
3269
|
+
toolName: part.toolName,
|
|
3270
|
+
type: "tool-call"
|
|
3271
|
+
};
|
|
3272
|
+
case "tool-result": {
|
|
3273
|
+
const output = part.output;
|
|
3274
|
+
let capturedOutput;
|
|
3275
|
+
switch (output.type) {
|
|
3276
|
+
case "text":
|
|
3277
|
+
case "error-text":
|
|
3278
|
+
capturedOutput = { type: output.type, value: output.value };
|
|
3279
|
+
break;
|
|
3280
|
+
case "json":
|
|
3281
|
+
case "error-json":
|
|
3282
|
+
capturedOutput = { type: output.type, value: output.value };
|
|
3283
|
+
break;
|
|
3284
|
+
case "execution-denied":
|
|
3285
|
+
capturedOutput = {
|
|
3286
|
+
...output.reason !== void 0 ? { reason: output.reason } : {},
|
|
3287
|
+
type: "execution-denied"
|
|
3288
|
+
};
|
|
3289
|
+
break;
|
|
3290
|
+
case "content":
|
|
3291
|
+
capturedOutput = {
|
|
3292
|
+
type: "content",
|
|
3293
|
+
value: output.value.map(capturedEveModelContentPart)
|
|
3294
|
+
};
|
|
3295
|
+
break;
|
|
3296
|
+
}
|
|
3297
|
+
return {
|
|
3298
|
+
output: capturedOutput,
|
|
3299
|
+
toolCallId: part.toolCallId,
|
|
3300
|
+
toolName: part.toolName,
|
|
3301
|
+
type: "tool-result"
|
|
3302
|
+
};
|
|
3303
|
+
}
|
|
3304
|
+
case "tool-approval-request":
|
|
3305
|
+
return {
|
|
3306
|
+
approvalId: part.approvalId,
|
|
3307
|
+
...part.isAutomatic !== void 0 ? { isAutomatic: part.isAutomatic } : {},
|
|
3308
|
+
...part.signature !== void 0 ? { signature: part.signature } : {},
|
|
3309
|
+
toolCallId: part.toolCallId,
|
|
3310
|
+
type: "tool-approval-request"
|
|
3311
|
+
};
|
|
3312
|
+
case "tool-approval-response":
|
|
3313
|
+
return {
|
|
3314
|
+
approvalId: part.approvalId,
|
|
3315
|
+
approved: part.approved,
|
|
3316
|
+
...part.providerExecuted !== void 0 ? { providerExecuted: part.providerExecuted } : {},
|
|
3317
|
+
...part.reason !== void 0 ? { reason: part.reason } : {},
|
|
3318
|
+
type: "tool-approval-response"
|
|
3319
|
+
};
|
|
3320
|
+
case "file-data":
|
|
3321
|
+
case "image-data":
|
|
3322
|
+
return {
|
|
3323
|
+
data: part.data,
|
|
3324
|
+
...part.type === "file-data" && part.filename !== void 0 ? { filename: part.filename } : {},
|
|
3325
|
+
mediaType: part.mediaType,
|
|
3326
|
+
type: part.type
|
|
3327
|
+
};
|
|
3328
|
+
case "file-url":
|
|
3329
|
+
case "image-url":
|
|
3330
|
+
return {
|
|
3331
|
+
...part.type === "file-url" && part.mediaType !== void 0 ? { mediaType: part.mediaType } : {},
|
|
3332
|
+
type: part.type,
|
|
3333
|
+
url: part.url
|
|
3334
|
+
};
|
|
3335
|
+
case "file-id":
|
|
3336
|
+
case "image-file-id":
|
|
3337
|
+
return { fileId: part.fileId, type: part.type };
|
|
3338
|
+
case "file-reference":
|
|
3339
|
+
case "image-file-reference":
|
|
3340
|
+
return {
|
|
3341
|
+
providerReference: part.providerReference,
|
|
3342
|
+
type: part.type
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3007
3346
|
function isCapturedModelInput(input) {
|
|
3008
|
-
return Array.isArray(input)
|
|
3347
|
+
return Array.isArray(input) && input.every(
|
|
3348
|
+
(message) => _chunkSU6EHKJVjs.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(_chunkSU6EHKJVjs.isObject))
|
|
3349
|
+
);
|
|
3009
3350
|
}
|
|
3010
3351
|
function llmInputKey(sessionId, turnId, stepIndex) {
|
|
3011
3352
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3012
3353
|
}
|
|
3013
3354
|
function modelMetadataFromRuntime(runtime) {
|
|
3014
|
-
if (!
|
|
3355
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, runtime)) {
|
|
3015
3356
|
return {};
|
|
3016
3357
|
}
|
|
3017
3358
|
const modelId = runtime["modelId"];
|
|
@@ -3034,11 +3375,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3034
3375
|
};
|
|
3035
3376
|
}
|
|
3036
3377
|
function sessionIdFromContext(ctx) {
|
|
3037
|
-
if (!
|
|
3378
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, ctx)) {
|
|
3038
3379
|
return void 0;
|
|
3039
3380
|
}
|
|
3040
3381
|
const session = ctx["session"];
|
|
3041
|
-
if (!
|
|
3382
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, session)) {
|
|
3042
3383
|
return void 0;
|
|
3043
3384
|
}
|
|
3044
3385
|
const id = session["id"];
|
|
@@ -3049,19 +3390,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3049
3390
|
return metadata;
|
|
3050
3391
|
}
|
|
3051
3392
|
function isToolCallAction(action) {
|
|
3052
|
-
return
|
|
3393
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkSU6EHKJVjs.isObject.call(void 0, action["input"]);
|
|
3053
3394
|
}
|
|
3054
3395
|
function isLocalSubagentCallAction(action) {
|
|
3055
|
-
return
|
|
3396
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkSU6EHKJVjs.isObject.call(void 0, action["input"]);
|
|
3056
3397
|
}
|
|
3057
3398
|
function isTraceableActionRequest(action) {
|
|
3058
3399
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3059
3400
|
}
|
|
3060
3401
|
function isToolResult(result) {
|
|
3061
|
-
return
|
|
3402
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3062
3403
|
}
|
|
3063
3404
|
function isSubagentResult(result) {
|
|
3064
|
-
return
|
|
3405
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3065
3406
|
}
|
|
3066
3407
|
function normalizedFinishReason(finishReason) {
|
|
3067
3408
|
switch (finishReason) {
|
|
@@ -3091,7 +3432,7 @@ function actionResultError(error, output) {
|
|
|
3091
3432
|
return result;
|
|
3092
3433
|
}
|
|
3093
3434
|
function eventTime(event) {
|
|
3094
|
-
if (!_optionalChain([event, 'access',
|
|
3435
|
+
if (!_optionalChain([event, 'access', _114 => _114.meta, 'optionalAccess', _115 => _115.at])) {
|
|
3095
3436
|
return void 0;
|
|
3096
3437
|
}
|
|
3097
3438
|
const timestamp = Date.parse(event.meta.at);
|
|
@@ -3161,7 +3502,7 @@ function messagesProxy(messages) {
|
|
|
3161
3502
|
return new Proxy(messages, {
|
|
3162
3503
|
get(target, prop, receiver) {
|
|
3163
3504
|
if (prop === "create") {
|
|
3164
|
-
return createProxy(target.create,
|
|
3505
|
+
return createProxy(target.create, _chunk7AUY2XWXjs.anthropicChannels.messagesCreate);
|
|
3165
3506
|
}
|
|
3166
3507
|
return Reflect.get(target, prop, receiver);
|
|
3167
3508
|
}
|
|
@@ -3171,7 +3512,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3171
3512
|
return new Proxy(messages, {
|
|
3172
3513
|
get(target, prop, receiver) {
|
|
3173
3514
|
if (prop === "create") {
|
|
3174
|
-
return createProxy(target.create,
|
|
3515
|
+
return createProxy(target.create, _chunk7AUY2XWXjs.anthropicChannels.betaMessagesCreate);
|
|
3175
3516
|
}
|
|
3176
3517
|
if (prop === "toolRunner") {
|
|
3177
3518
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -3180,7 +3521,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3180
3521
|
return toolRunnerProxy(
|
|
3181
3522
|
target.toolRunner,
|
|
3182
3523
|
anthropic,
|
|
3183
|
-
|
|
3524
|
+
_chunk7AUY2XWXjs.anthropicChannels.betaMessagesToolRunner
|
|
3184
3525
|
);
|
|
3185
3526
|
}
|
|
3186
3527
|
return Reflect.get(target, prop, receiver);
|
|
@@ -3237,11 +3578,11 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
3237
3578
|
...params,
|
|
3238
3579
|
options: {
|
|
3239
3580
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
3240
|
-
[
|
|
3581
|
+
[_chunkSU6EHKJVjs.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
3241
3582
|
}
|
|
3242
3583
|
};
|
|
3243
3584
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3244
|
-
return
|
|
3585
|
+
return _chunk7AUY2XWXjs.claudeAgentSDKChannels.query.traceSync(
|
|
3245
3586
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
3246
3587
|
// The channel carries no extra context fields, but the generated
|
|
3247
3588
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -3269,7 +3610,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
3269
3610
|
}
|
|
3270
3611
|
const localToolMetadata = { toolName };
|
|
3271
3612
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
3272
|
-
wrappedArgs[handlerIndex] =
|
|
3613
|
+
wrappedArgs[handlerIndex] = _chunkSU6EHKJVjs.wrapLocalClaudeToolHandler.call(void 0,
|
|
3273
3614
|
originalHandler,
|
|
3274
3615
|
() => localToolMetadata
|
|
3275
3616
|
);
|
|
@@ -3287,8 +3628,8 @@ function wrapCreateSdkMcpServer(createSdkMcpServerFn, localToolMetadataByTool, d
|
|
|
3287
3628
|
apply(target, thisArg, argArray) {
|
|
3288
3629
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3289
3630
|
const config = argArray[0];
|
|
3290
|
-
const serverName = _optionalChain([config, 'optionalAccess',
|
|
3291
|
-
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
3631
|
+
const serverName = _optionalChain([config, 'optionalAccess', _116 => _116.name]);
|
|
3632
|
+
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _117 => _117.tools]))) {
|
|
3292
3633
|
for (const tool of config.tools) {
|
|
3293
3634
|
if (!tool || typeof tool !== "object") {
|
|
3294
3635
|
continue;
|
|
@@ -3382,7 +3723,7 @@ function isModuleNamespace2(obj) {
|
|
|
3382
3723
|
if (!obj || typeof obj !== "object") {
|
|
3383
3724
|
return false;
|
|
3384
3725
|
}
|
|
3385
|
-
if (_optionalChain([obj, 'access',
|
|
3726
|
+
if (_optionalChain([obj, 'access', _118 => _118.constructor, 'optionalAccess', _119 => _119.name]) === "Module") {
|
|
3386
3727
|
return true;
|
|
3387
3728
|
}
|
|
3388
3729
|
const keys = Object.keys(obj);
|
|
@@ -3452,7 +3793,7 @@ function wrapCodexThread(thread) {
|
|
|
3452
3793
|
if (prop === "run" && typeof value === "function") {
|
|
3453
3794
|
return function(input, turnOptions) {
|
|
3454
3795
|
const args = [input, turnOptions];
|
|
3455
|
-
return
|
|
3796
|
+
return _chunk7AUY2XWXjs.openAICodexChannels.run.tracePromise(
|
|
3456
3797
|
() => Reflect.apply(value, target, args),
|
|
3457
3798
|
{
|
|
3458
3799
|
arguments: args,
|
|
@@ -3465,7 +3806,7 @@ function wrapCodexThread(thread) {
|
|
|
3465
3806
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
3466
3807
|
return function(input, turnOptions) {
|
|
3467
3808
|
const args = [input, turnOptions];
|
|
3468
|
-
return
|
|
3809
|
+
return _chunk7AUY2XWXjs.openAICodexChannels.runStreamed.tracePromise(
|
|
3469
3810
|
() => Reflect.apply(value, target, args),
|
|
3470
3811
|
{
|
|
3471
3812
|
arguments: args,
|
|
@@ -3512,7 +3853,7 @@ function isModuleNamespace3(obj) {
|
|
|
3512
3853
|
if (!obj || typeof obj !== "object") {
|
|
3513
3854
|
return false;
|
|
3514
3855
|
}
|
|
3515
|
-
if (_optionalChain([obj, 'access',
|
|
3856
|
+
if (_optionalChain([obj, 'access', _120 => _120.constructor, 'optionalAccess', _121 => _121.name]) === "Module") {
|
|
3516
3857
|
return true;
|
|
3517
3858
|
}
|
|
3518
3859
|
const keys = Object.keys(obj);
|
|
@@ -3533,7 +3874,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3533
3874
|
if (prop === "create" && typeof value === "function") {
|
|
3534
3875
|
const wrapped = async function(options) {
|
|
3535
3876
|
const args = [options];
|
|
3536
|
-
return
|
|
3877
|
+
return _chunk7AUY2XWXjs.cursorSDKChannels.create.tracePromise(
|
|
3537
3878
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3538
3879
|
{ arguments: args }
|
|
3539
3880
|
);
|
|
@@ -3544,7 +3885,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3544
3885
|
if (prop === "resume" && typeof value === "function") {
|
|
3545
3886
|
const wrapped = async function(agentId, options) {
|
|
3546
3887
|
const args = [agentId, options];
|
|
3547
|
-
return
|
|
3888
|
+
return _chunk7AUY2XWXjs.cursorSDKChannels.resume.tracePromise(
|
|
3548
3889
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3549
3890
|
{ arguments: args }
|
|
3550
3891
|
);
|
|
@@ -3555,7 +3896,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3555
3896
|
if (prop === "prompt" && typeof value === "function") {
|
|
3556
3897
|
const wrapped = async function(message, options) {
|
|
3557
3898
|
const args = [message, options];
|
|
3558
|
-
return
|
|
3899
|
+
return _chunk7AUY2XWXjs.cursorSDKChannels.prompt.tracePromise(
|
|
3559
3900
|
() => Reflect.apply(value, target, args),
|
|
3560
3901
|
{ arguments: args }
|
|
3561
3902
|
);
|
|
@@ -3588,7 +3929,7 @@ function wrapCursorAgent(agent) {
|
|
|
3588
3929
|
if (prop === "send" && typeof value === "function") {
|
|
3589
3930
|
return function(message, options) {
|
|
3590
3931
|
const args = [message, options];
|
|
3591
|
-
return
|
|
3932
|
+
return _chunk7AUY2XWXjs.cursorSDKChannels.send.tracePromise(
|
|
3592
3933
|
() => Reflect.apply(value, target, args),
|
|
3593
3934
|
{
|
|
3594
3935
|
agent: target,
|
|
@@ -3638,7 +3979,7 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
3638
3979
|
...descriptor,
|
|
3639
3980
|
value: function wrappedPiCodingAgentPrompt(text, options) {
|
|
3640
3981
|
const args = [text, options];
|
|
3641
|
-
return
|
|
3982
|
+
return _chunk7AUY2XWXjs.piCodingAgentChannels.prompt.tracePromise(
|
|
3642
3983
|
() => Reflect.apply(originalPrompt, this, args),
|
|
3643
3984
|
{
|
|
3644
3985
|
arguments: args,
|
|
@@ -3696,7 +4037,7 @@ function isModuleNamespace4(obj) {
|
|
|
3696
4037
|
if (!obj || typeof obj !== "object") {
|
|
3697
4038
|
return false;
|
|
3698
4039
|
}
|
|
3699
|
-
if (_optionalChain([obj, 'access',
|
|
4040
|
+
if (_optionalChain([obj, 'access', _122 => _122.constructor, 'optionalAccess', _123 => _123.name]) === "Module") {
|
|
3700
4041
|
return true;
|
|
3701
4042
|
}
|
|
3702
4043
|
const keys = Object.keys(obj);
|
|
@@ -3758,7 +4099,7 @@ function wrapAgentInstance(agent) {
|
|
|
3758
4099
|
if (prop === "stream" && typeof value === "function") {
|
|
3759
4100
|
return function(args, options) {
|
|
3760
4101
|
const callArgs = [args, options];
|
|
3761
|
-
return
|
|
4102
|
+
return _chunk7AUY2XWXjs.strandsAgentSDKChannels.agentStream.traceSync(
|
|
3762
4103
|
() => Reflect.apply(value, target, callArgs),
|
|
3763
4104
|
{
|
|
3764
4105
|
agent: proxy,
|
|
@@ -3794,7 +4135,7 @@ function wrapMultiAgentInstance(orchestrator, kind) {
|
|
|
3794
4135
|
if (prop === "stream" && typeof value === "function") {
|
|
3795
4136
|
return function(input, options) {
|
|
3796
4137
|
const callArgs = [input, options];
|
|
3797
|
-
const channel = kind === "graph" ?
|
|
4138
|
+
const channel = kind === "graph" ? _chunk7AUY2XWXjs.strandsAgentSDKChannels.graphStream : _chunk7AUY2XWXjs.strandsAgentSDKChannels.swarmStream;
|
|
3798
4139
|
return channel.traceSync(
|
|
3799
4140
|
() => Reflect.apply(value, target, callArgs),
|
|
3800
4141
|
{
|
|
@@ -3869,7 +4210,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3869
4210
|
}
|
|
3870
4211
|
if (prop === "interactions") {
|
|
3871
4212
|
const interactions = Reflect.get(target, prop, receiver);
|
|
3872
|
-
if (!
|
|
4213
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
3873
4214
|
return interactions;
|
|
3874
4215
|
}
|
|
3875
4216
|
if (interactions !== originalInteractions) {
|
|
@@ -3883,7 +4224,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3883
4224
|
});
|
|
3884
4225
|
}
|
|
3885
4226
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
3886
|
-
if (!
|
|
4227
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
3887
4228
|
return;
|
|
3888
4229
|
}
|
|
3889
4230
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -3916,7 +4257,7 @@ function wrapInteractions(interactions) {
|
|
|
3916
4257
|
}
|
|
3917
4258
|
function wrapGenerateContent(original) {
|
|
3918
4259
|
return function(params) {
|
|
3919
|
-
return
|
|
4260
|
+
return _chunk7AUY2XWXjs.googleGenAIChannels.generateContent.tracePromise(
|
|
3920
4261
|
() => original(params),
|
|
3921
4262
|
{ arguments: [params] }
|
|
3922
4263
|
);
|
|
@@ -3924,7 +4265,7 @@ function wrapGenerateContent(original) {
|
|
|
3924
4265
|
}
|
|
3925
4266
|
function wrapGenerateContentStream(original) {
|
|
3926
4267
|
return function(params) {
|
|
3927
|
-
return
|
|
4268
|
+
return _chunk7AUY2XWXjs.googleGenAIChannels.generateContentStream.tracePromise(
|
|
3928
4269
|
() => original(params),
|
|
3929
4270
|
{ arguments: [params] }
|
|
3930
4271
|
);
|
|
@@ -3932,7 +4273,7 @@ function wrapGenerateContentStream(original) {
|
|
|
3932
4273
|
}
|
|
3933
4274
|
function wrapEmbedContent(original) {
|
|
3934
4275
|
return function(params) {
|
|
3935
|
-
return
|
|
4276
|
+
return _chunk7AUY2XWXjs.googleGenAIChannels.embedContent.tracePromise(
|
|
3936
4277
|
() => original(params),
|
|
3937
4278
|
{ arguments: [params] }
|
|
3938
4279
|
);
|
|
@@ -3944,7 +4285,7 @@ function wrapInteractionCreate(original) {
|
|
|
3944
4285
|
return options === void 0 ? original(params) : original(params, options);
|
|
3945
4286
|
}
|
|
3946
4287
|
const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
|
|
3947
|
-
return
|
|
4288
|
+
return _chunk7AUY2XWXjs.googleGenAIChannels.interactionsCreate.tracePromise(
|
|
3948
4289
|
() => options === void 0 ? original(params) : original(params, options),
|
|
3949
4290
|
traceContext
|
|
3950
4291
|
);
|
|
@@ -4005,7 +4346,7 @@ function wrapRunnerInstance(runner) {
|
|
|
4005
4346
|
function wrapRunnerRunAsync(runner) {
|
|
4006
4347
|
const original = runner.runAsync.bind(runner);
|
|
4007
4348
|
return function(params) {
|
|
4008
|
-
return
|
|
4349
|
+
return _chunk7AUY2XWXjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
4009
4350
|
arguments: [params],
|
|
4010
4351
|
self: runner
|
|
4011
4352
|
});
|
|
@@ -4032,7 +4373,7 @@ function wrapAgentInstance2(agent) {
|
|
|
4032
4373
|
function wrapAgentRunAsync(agent) {
|
|
4033
4374
|
const original = agent.runAsync.bind(agent);
|
|
4034
4375
|
return function(parentContext) {
|
|
4035
|
-
return
|
|
4376
|
+
return _chunk7AUY2XWXjs.googleADKChannels.agentRunAsync.traceSync(
|
|
4036
4377
|
() => original(parentContext),
|
|
4037
4378
|
{ arguments: [parentContext], self: agent }
|
|
4038
4379
|
);
|
|
@@ -4059,7 +4400,7 @@ function wrapToolInstance(tool) {
|
|
|
4059
4400
|
function wrapToolRunAsync(tool) {
|
|
4060
4401
|
const original = tool.runAsync.bind(tool);
|
|
4061
4402
|
return function(req) {
|
|
4062
|
-
return
|
|
4403
|
+
return _chunk7AUY2XWXjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
4063
4404
|
arguments: [req],
|
|
4064
4405
|
self: tool
|
|
4065
4406
|
});
|
|
@@ -4171,7 +4512,7 @@ function patchGenkitRegistryLookup(registry) {
|
|
|
4171
4512
|
Object.defineProperty(registry, PATCHED_GENKIT_REGISTRY, {
|
|
4172
4513
|
value: true
|
|
4173
4514
|
});
|
|
4174
|
-
} catch (
|
|
4515
|
+
} catch (e6) {
|
|
4175
4516
|
}
|
|
4176
4517
|
}
|
|
4177
4518
|
function patchGenkitRegistryConstructor(registry) {
|
|
@@ -4202,31 +4543,31 @@ function patchGenkitRegistryConstructor(registry) {
|
|
|
4202
4543
|
Object.defineProperty(constructor, PATCHED_GENKIT_REGISTRY_CONSTRUCTOR, {
|
|
4203
4544
|
value: true
|
|
4204
4545
|
});
|
|
4205
|
-
} catch (
|
|
4546
|
+
} catch (e7) {
|
|
4206
4547
|
}
|
|
4207
4548
|
}
|
|
4208
4549
|
function wrapGenerate(generate) {
|
|
4209
|
-
return (input) =>
|
|
4550
|
+
return (input) => _chunk7AUY2XWXjs.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
4210
4551
|
arguments: [input]
|
|
4211
4552
|
});
|
|
4212
4553
|
}
|
|
4213
4554
|
function wrapGenerateStream(generateStream) {
|
|
4214
|
-
return (input) =>
|
|
4555
|
+
return (input) => _chunk7AUY2XWXjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
4215
4556
|
arguments: [input]
|
|
4216
4557
|
});
|
|
4217
4558
|
}
|
|
4218
4559
|
function wrapEmbed2(embed) {
|
|
4219
|
-
return (params) =>
|
|
4560
|
+
return (params) => _chunk7AUY2XWXjs.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
4220
4561
|
arguments: [params]
|
|
4221
4562
|
});
|
|
4222
4563
|
}
|
|
4223
4564
|
function wrapEmbedMany2(embedMany) {
|
|
4224
|
-
return (params) =>
|
|
4565
|
+
return (params) => _chunk7AUY2XWXjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
4225
4566
|
arguments: [params]
|
|
4226
4567
|
});
|
|
4227
4568
|
}
|
|
4228
4569
|
function wrapRun(run) {
|
|
4229
|
-
return (name, inputOrFn, maybeFn) =>
|
|
4570
|
+
return (name, inputOrFn, maybeFn) => _chunk7AUY2XWXjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
4230
4571
|
arguments: [name, inputOrFn, maybeFn]
|
|
4231
4572
|
});
|
|
4232
4573
|
}
|
|
@@ -4265,13 +4606,13 @@ function isGenkitAction(value) {
|
|
|
4265
4606
|
return typeof value === "function" && "__action" in value;
|
|
4266
4607
|
}
|
|
4267
4608
|
function traceActionRun(action, run) {
|
|
4268
|
-
return (input, options) =>
|
|
4609
|
+
return (input, options) => _chunk7AUY2XWXjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
4269
4610
|
arguments: [input, options],
|
|
4270
4611
|
self: action
|
|
4271
4612
|
});
|
|
4272
4613
|
}
|
|
4273
4614
|
function traceActionStream(action, stream) {
|
|
4274
|
-
return (input, options) =>
|
|
4615
|
+
return (input, options) => _chunk7AUY2XWXjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
4275
4616
|
arguments: [input, options],
|
|
4276
4617
|
self: action
|
|
4277
4618
|
});
|
|
@@ -4317,10 +4658,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
4317
4658
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
4318
4659
|
}
|
|
4319
4660
|
function hasFunction2(value, methodName) {
|
|
4320
|
-
return
|
|
4661
|
+
return _chunkSU6EHKJVjs.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
4321
4662
|
}
|
|
4322
4663
|
function isSupportedHuggingFaceModule(value) {
|
|
4323
|
-
if (!
|
|
4664
|
+
if (!_chunkSU6EHKJVjs.isObject.call(void 0, value)) {
|
|
4324
4665
|
return false;
|
|
4325
4666
|
}
|
|
4326
4667
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -4428,14 +4769,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
4428
4769
|
const context = {
|
|
4429
4770
|
arguments: [traceParams]
|
|
4430
4771
|
};
|
|
4431
|
-
return
|
|
4772
|
+
return _chunk7AUY2XWXjs.huggingFaceChannels.chatCompletion.tracePromise(
|
|
4432
4773
|
() => original(params, options),
|
|
4433
4774
|
context
|
|
4434
4775
|
);
|
|
4435
4776
|
};
|
|
4436
4777
|
}
|
|
4437
4778
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
4438
|
-
return (params, options) =>
|
|
4779
|
+
return (params, options) => _chunk7AUY2XWXjs.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
4439
4780
|
() => original(params, options),
|
|
4440
4781
|
{
|
|
4441
4782
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4448,14 +4789,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
4448
4789
|
const context = {
|
|
4449
4790
|
arguments: [traceParams]
|
|
4450
4791
|
};
|
|
4451
|
-
return
|
|
4792
|
+
return _chunk7AUY2XWXjs.huggingFaceChannels.textGeneration.tracePromise(
|
|
4452
4793
|
() => original(params, options),
|
|
4453
4794
|
context
|
|
4454
4795
|
);
|
|
4455
4796
|
};
|
|
4456
4797
|
}
|
|
4457
4798
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
4458
|
-
return (params, options) =>
|
|
4799
|
+
return (params, options) => _chunk7AUY2XWXjs.huggingFaceChannels.textGenerationStream.traceSync(
|
|
4459
4800
|
() => original(params, options),
|
|
4460
4801
|
{
|
|
4461
4802
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4468,7 +4809,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
4468
4809
|
const context = {
|
|
4469
4810
|
arguments: [traceParams]
|
|
4470
4811
|
};
|
|
4471
|
-
return
|
|
4812
|
+
return _chunk7AUY2XWXjs.huggingFaceChannels.featureExtraction.tracePromise(
|
|
4472
4813
|
() => original(params, options),
|
|
4473
4814
|
context
|
|
4474
4815
|
);
|
|
@@ -4515,7 +4856,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
4515
4856
|
const request = cloneCallModelRequest(argArray[0]);
|
|
4516
4857
|
const options = argArray[1];
|
|
4517
4858
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
4518
|
-
return
|
|
4859
|
+
return _chunk7AUY2XWXjs.openRouterAgentChannels.callModel.traceSync(
|
|
4519
4860
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
4520
4861
|
{
|
|
4521
4862
|
arguments: [request]
|
|
@@ -4611,24 +4952,24 @@ function rerankProxy(rerank) {
|
|
|
4611
4952
|
});
|
|
4612
4953
|
}
|
|
4613
4954
|
function wrapChatSend(send) {
|
|
4614
|
-
return (request, options) =>
|
|
4955
|
+
return (request, options) => _chunk7AUY2XWXjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
4615
4956
|
arguments: [request]
|
|
4616
4957
|
});
|
|
4617
4958
|
}
|
|
4618
4959
|
function wrapEmbeddingsGenerate(generate) {
|
|
4619
|
-
return (request, options) =>
|
|
4960
|
+
return (request, options) => _chunk7AUY2XWXjs.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
4620
4961
|
() => generate(request, options),
|
|
4621
4962
|
{ arguments: [request] }
|
|
4622
4963
|
);
|
|
4623
4964
|
}
|
|
4624
4965
|
function wrapResponsesSend(send) {
|
|
4625
|
-
return (request, options) =>
|
|
4966
|
+
return (request, options) => _chunk7AUY2XWXjs.openRouterChannels.betaResponsesSend.tracePromise(
|
|
4626
4967
|
() => send(request, options),
|
|
4627
4968
|
{ arguments: [request] }
|
|
4628
4969
|
);
|
|
4629
4970
|
}
|
|
4630
4971
|
function wrapRerank2(rerank) {
|
|
4631
|
-
return (request, options) =>
|
|
4972
|
+
return (request, options) => _chunk7AUY2XWXjs.openRouterChannels.rerankRerank.tracePromise(
|
|
4632
4973
|
() => rerank(request, options),
|
|
4633
4974
|
{ arguments: [request] }
|
|
4634
4975
|
);
|
|
@@ -4636,7 +4977,7 @@ function wrapRerank2(rerank) {
|
|
|
4636
4977
|
function wrapCallModel2(callModel) {
|
|
4637
4978
|
return (request, options) => {
|
|
4638
4979
|
const tracedRequest = { ...request };
|
|
4639
|
-
return
|
|
4980
|
+
return _chunk7AUY2XWXjs.openRouterChannels.callModel.traceSync(
|
|
4640
4981
|
() => callModel(tracedRequest, options),
|
|
4641
4982
|
{
|
|
4642
4983
|
arguments: [tracedRequest]
|
|
@@ -4769,7 +5110,7 @@ function classifiersProxy(classifiers) {
|
|
|
4769
5110
|
});
|
|
4770
5111
|
}
|
|
4771
5112
|
function wrapChatComplete(complete) {
|
|
4772
|
-
return (request, options) =>
|
|
5113
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.chatComplete.tracePromise(
|
|
4773
5114
|
() => complete(request, options),
|
|
4774
5115
|
{
|
|
4775
5116
|
arguments: [request]
|
|
@@ -4777,52 +5118,52 @@ function wrapChatComplete(complete) {
|
|
|
4777
5118
|
);
|
|
4778
5119
|
}
|
|
4779
5120
|
function wrapChatStream(stream) {
|
|
4780
|
-
return (request, options) =>
|
|
5121
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
4781
5122
|
arguments: [request]
|
|
4782
5123
|
});
|
|
4783
5124
|
}
|
|
4784
5125
|
function wrapEmbeddingsCreate(create) {
|
|
4785
|
-
return (request, options) =>
|
|
5126
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.embeddingsCreate.tracePromise(
|
|
4786
5127
|
() => create(request, options),
|
|
4787
5128
|
{ arguments: [request] }
|
|
4788
5129
|
);
|
|
4789
5130
|
}
|
|
4790
5131
|
function wrapClassifiersModerate(moderate) {
|
|
4791
|
-
return (request, options) =>
|
|
5132
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.classifiersModerate.tracePromise(
|
|
4792
5133
|
() => moderate(request, options),
|
|
4793
5134
|
{ arguments: [request] }
|
|
4794
5135
|
);
|
|
4795
5136
|
}
|
|
4796
5137
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
4797
|
-
return (request, options) =>
|
|
5138
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.classifiersModerateChat.tracePromise(
|
|
4798
5139
|
() => moderateChat(request, options),
|
|
4799
5140
|
{ arguments: [request] }
|
|
4800
5141
|
);
|
|
4801
5142
|
}
|
|
4802
5143
|
function wrapClassifiersClassify(classify) {
|
|
4803
|
-
return (request, options) =>
|
|
5144
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.classifiersClassify.tracePromise(
|
|
4804
5145
|
() => classify(request, options),
|
|
4805
5146
|
{ arguments: [request] }
|
|
4806
5147
|
);
|
|
4807
5148
|
}
|
|
4808
5149
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
4809
|
-
return (request, options) =>
|
|
5150
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
4810
5151
|
() => classifyChat(request, options),
|
|
4811
5152
|
{ arguments: [request] }
|
|
4812
5153
|
);
|
|
4813
5154
|
}
|
|
4814
5155
|
function wrapFimComplete(complete) {
|
|
4815
|
-
return (request, options) =>
|
|
5156
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
4816
5157
|
arguments: [request]
|
|
4817
5158
|
});
|
|
4818
5159
|
}
|
|
4819
5160
|
function wrapFimStream(stream) {
|
|
4820
|
-
return (request, options) =>
|
|
5161
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
4821
5162
|
arguments: [request]
|
|
4822
5163
|
});
|
|
4823
5164
|
}
|
|
4824
5165
|
function wrapAgentsComplete(complete) {
|
|
4825
|
-
return (request, options) =>
|
|
5166
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.agentsComplete.tracePromise(
|
|
4826
5167
|
() => complete(request, options),
|
|
4827
5168
|
{
|
|
4828
5169
|
arguments: [request]
|
|
@@ -4830,7 +5171,7 @@ function wrapAgentsComplete(complete) {
|
|
|
4830
5171
|
);
|
|
4831
5172
|
}
|
|
4832
5173
|
function wrapAgentsStream(stream) {
|
|
4833
|
-
return (request, options) =>
|
|
5174
|
+
return (request, options) => _chunk7AUY2XWXjs.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
4834
5175
|
arguments: [request]
|
|
4835
5176
|
});
|
|
4836
5177
|
}
|
|
@@ -4883,22 +5224,22 @@ function cohereProxy(cohere) {
|
|
|
4883
5224
|
return proxy;
|
|
4884
5225
|
}
|
|
4885
5226
|
function wrapChat(chat) {
|
|
4886
|
-
return (request, options) =>
|
|
5227
|
+
return (request, options) => _chunk7AUY2XWXjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
4887
5228
|
arguments: [request]
|
|
4888
5229
|
});
|
|
4889
5230
|
}
|
|
4890
5231
|
function wrapChatStream2(chatStream) {
|
|
4891
|
-
return (request, options) =>
|
|
5232
|
+
return (request, options) => _chunk7AUY2XWXjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
4892
5233
|
arguments: [request]
|
|
4893
5234
|
});
|
|
4894
5235
|
}
|
|
4895
5236
|
function wrapEmbed3(embed) {
|
|
4896
|
-
return (request, options) =>
|
|
5237
|
+
return (request, options) => _chunk7AUY2XWXjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
4897
5238
|
arguments: [request]
|
|
4898
5239
|
});
|
|
4899
5240
|
}
|
|
4900
5241
|
function wrapRerank3(rerank) {
|
|
4901
|
-
return (request, options) =>
|
|
5242
|
+
return (request, options) => _chunk7AUY2XWXjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
4902
5243
|
arguments: [request]
|
|
4903
5244
|
});
|
|
4904
5245
|
}
|
|
@@ -4928,7 +5269,7 @@ function isSupportedGroqClient(value) {
|
|
|
4928
5269
|
}
|
|
4929
5270
|
function groqProxy(groq) {
|
|
4930
5271
|
const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
|
|
4931
|
-
const completionProxy = _optionalChain([groq, 'access',
|
|
5272
|
+
const completionProxy = _optionalChain([groq, 'access', _124 => _124.chat, 'optionalAccess', _125 => _125.completions]) ? new Proxy(groq.chat.completions, {
|
|
4932
5273
|
get(target, prop, receiver) {
|
|
4933
5274
|
if (prop === "create") {
|
|
4934
5275
|
return wrapChatCompletionsCreate(target.create.bind(target));
|
|
@@ -4980,13 +5321,13 @@ function groqProxy(groq) {
|
|
|
4980
5321
|
return topLevelProxy;
|
|
4981
5322
|
}
|
|
4982
5323
|
function wrapChatCompletionsCreate(create) {
|
|
4983
|
-
return (request, options) =>
|
|
5324
|
+
return (request, options) => _chunk7AUY2XWXjs.groqChannels.chatCompletionsCreate.tracePromise(
|
|
4984
5325
|
() => create(request, options),
|
|
4985
5326
|
{ arguments: [request] }
|
|
4986
5327
|
);
|
|
4987
5328
|
}
|
|
4988
5329
|
function wrapEmbeddingsCreate2(create) {
|
|
4989
|
-
return (request, options) =>
|
|
5330
|
+
return (request, options) => _chunk7AUY2XWXjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
4990
5331
|
arguments: [request]
|
|
4991
5332
|
});
|
|
4992
5333
|
}
|
|
@@ -5060,16 +5401,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
5060
5401
|
}
|
|
5061
5402
|
function wrapSend(send) {
|
|
5062
5403
|
return (command, optionsOrCb, cb) => {
|
|
5063
|
-
if (
|
|
5404
|
+
if (_chunkSU6EHKJVjs.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
5064
5405
|
return send(command, optionsOrCb, cb);
|
|
5065
5406
|
}
|
|
5066
|
-
return
|
|
5067
|
-
() =>
|
|
5407
|
+
return _chunk7AUY2XWXjs.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
5408
|
+
() => _chunkSU6EHKJVjs.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
5068
5409
|
() => send(command, optionsOrCb)
|
|
5069
5410
|
),
|
|
5070
5411
|
{
|
|
5071
5412
|
arguments: [command, optionsOrCb],
|
|
5072
|
-
span_info:
|
|
5413
|
+
span_info: _chunkSU6EHKJVjs.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
5073
5414
|
}
|
|
5074
5415
|
);
|
|
5075
5416
|
};
|
|
@@ -5118,13 +5459,13 @@ function copilotClientProxy(client) {
|
|
|
5118
5459
|
return proxy;
|
|
5119
5460
|
}
|
|
5120
5461
|
function wrappedCreateSession(client) {
|
|
5121
|
-
return (config) =>
|
|
5462
|
+
return (config) => _chunk7AUY2XWXjs.gitHubCopilotChannels.createSession.tracePromise(
|
|
5122
5463
|
() => client.createSession(config),
|
|
5123
5464
|
{ arguments: [config] }
|
|
5124
5465
|
);
|
|
5125
5466
|
}
|
|
5126
5467
|
function wrappedResumeSession(client) {
|
|
5127
|
-
return (sessionId, config) =>
|
|
5468
|
+
return (sessionId, config) => _chunk7AUY2XWXjs.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
5128
5469
|
() => client.resumeSession(sessionId, config),
|
|
5129
5470
|
{ arguments: [sessionId, config] }
|
|
5130
5471
|
);
|
|
@@ -5229,7 +5570,7 @@ function isModuleNamespace5(value) {
|
|
|
5229
5570
|
if (!value || typeof value !== "object") {
|
|
5230
5571
|
return false;
|
|
5231
5572
|
}
|
|
5232
|
-
if (_optionalChain([value, 'access',
|
|
5573
|
+
if (_optionalChain([value, 'access', _126 => _126.constructor, 'optionalAccess', _127 => _127.name]) === "Module") {
|
|
5233
5574
|
return true;
|
|
5234
5575
|
}
|
|
5235
5576
|
const firstKey = Object.keys(value)[0];
|
|
@@ -5253,7 +5594,7 @@ function wrapTraceable(traceable2) {
|
|
|
5253
5594
|
apply(target, thisArg, argArray) {
|
|
5254
5595
|
const [fn, rawConfig] = argArray;
|
|
5255
5596
|
const config = rawConfig && typeof rawConfig === "object" ? rawConfig : void 0;
|
|
5256
|
-
const originalOnEnd = _optionalChain([config, 'optionalAccess',
|
|
5597
|
+
const originalOnEnd = _optionalChain([config, 'optionalAccess', _128 => _128.on_end]);
|
|
5257
5598
|
const wrappedConfig = {
|
|
5258
5599
|
...config,
|
|
5259
5600
|
on_end(runTree) {
|
|
@@ -5302,13 +5643,13 @@ function wrapRunTreeInstance(runTree) {
|
|
|
5302
5643
|
wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
|
|
5303
5644
|
} else if (prop === "postRun") {
|
|
5304
5645
|
const method = value;
|
|
5305
|
-
wrapped = (...args) =>
|
|
5646
|
+
wrapped = (...args) => _chunk7AUY2XWXjs.langSmithChannels.createRun.tracePromise(
|
|
5306
5647
|
() => Reflect.apply(method, target, args),
|
|
5307
5648
|
{ arguments: [target] }
|
|
5308
5649
|
);
|
|
5309
5650
|
} else if (prop === "patchRun") {
|
|
5310
5651
|
const method = value;
|
|
5311
|
-
wrapped = (...args) =>
|
|
5652
|
+
wrapped = (...args) => _chunk7AUY2XWXjs.langSmithChannels.updateRun.tracePromise(
|
|
5312
5653
|
() => Reflect.apply(method, target, args),
|
|
5313
5654
|
{
|
|
5314
5655
|
arguments: [
|
|
@@ -5357,19 +5698,19 @@ function wrapClientInstance(client) {
|
|
|
5357
5698
|
let wrapped;
|
|
5358
5699
|
if (prop === "createRun") {
|
|
5359
5700
|
const method = value;
|
|
5360
|
-
wrapped = (...args) =>
|
|
5701
|
+
wrapped = (...args) => _chunk7AUY2XWXjs.langSmithChannels.createRun.tracePromise(
|
|
5361
5702
|
() => Reflect.apply(method, target, args),
|
|
5362
5703
|
{ arguments: args }
|
|
5363
5704
|
);
|
|
5364
5705
|
} else if (prop === "updateRun") {
|
|
5365
5706
|
const method = value;
|
|
5366
|
-
wrapped = (...args) =>
|
|
5707
|
+
wrapped = (...args) => _chunk7AUY2XWXjs.langSmithChannels.updateRun.tracePromise(
|
|
5367
5708
|
() => Reflect.apply(method, target, args),
|
|
5368
5709
|
{ arguments: args }
|
|
5369
5710
|
);
|
|
5370
5711
|
} else if (prop === "batchIngestRuns") {
|
|
5371
5712
|
const method = value;
|
|
5372
|
-
wrapped = (...args) =>
|
|
5713
|
+
wrapped = (...args) => _chunk7AUY2XWXjs.langSmithChannels.batchIngestRuns.tracePromise(
|
|
5373
5714
|
() => Reflect.apply(method, target, args),
|
|
5374
5715
|
{ arguments: args }
|
|
5375
5716
|
);
|
|
@@ -5385,13 +5726,13 @@ function publishRunUpdate(runTree) {
|
|
|
5385
5726
|
return;
|
|
5386
5727
|
}
|
|
5387
5728
|
try {
|
|
5388
|
-
void
|
|
5729
|
+
void _chunk7AUY2XWXjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
5389
5730
|
arguments: [runTree.id, runTree]
|
|
5390
5731
|
}).catch((error) => {
|
|
5391
|
-
|
|
5732
|
+
_chunkSU6EHKJVjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5392
5733
|
});
|
|
5393
5734
|
} catch (error) {
|
|
5394
|
-
|
|
5735
|
+
_chunkSU6EHKJVjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5395
5736
|
}
|
|
5396
5737
|
}
|
|
5397
5738
|
|
|
@@ -5403,7 +5744,7 @@ var VitestContextManager = class {
|
|
|
5403
5744
|
*/
|
|
5404
5745
|
|
|
5405
5746
|
constructor() {
|
|
5406
|
-
this.contextStorage =
|
|
5747
|
+
this.contextStorage = _chunk7AUY2XWXjs.isomorph_default.newAsyncLocalStorage();
|
|
5407
5748
|
}
|
|
5408
5749
|
getCurrentContext() {
|
|
5409
5750
|
return this.contextStorage.getStore();
|
|
@@ -5444,7 +5785,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
|
|
|
5444
5785
|
if (this.activeFlushes.has(experimentId)) {
|
|
5445
5786
|
return this.activeFlushes.get(experimentId);
|
|
5446
5787
|
}
|
|
5447
|
-
const flushPromise =
|
|
5788
|
+
const flushPromise = _chunkSU6EHKJVjs.summarizeAndFlush.call(void 0, context.experiment, {
|
|
5448
5789
|
displaySummary: config.displaySummary
|
|
5449
5790
|
});
|
|
5450
5791
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -5542,7 +5883,7 @@ async function runTracedEval(args) {
|
|
|
5542
5883
|
}
|
|
5543
5884
|
if (testError) {
|
|
5544
5885
|
span.log({ scores: { pass: 0 } });
|
|
5545
|
-
|
|
5886
|
+
_chunkSU6EHKJVjs.logError.call(void 0, span, testError);
|
|
5546
5887
|
throw testError;
|
|
5547
5888
|
}
|
|
5548
5889
|
span.log({
|
|
@@ -5575,7 +5916,7 @@ function wrapTest(originalTest, config) {
|
|
|
5575
5916
|
const wrapped = function(name, configOrFn, maybeFn) {
|
|
5576
5917
|
const isEnhanced = typeof configOrFn !== "function";
|
|
5577
5918
|
const testConfig = isEnhanced ? configOrFn : void 0;
|
|
5578
|
-
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess',
|
|
5919
|
+
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _129 => _129.data]) && Array.isArray(testConfig.data)) {
|
|
5579
5920
|
const dataRecords = testConfig.data;
|
|
5580
5921
|
const testFn2 = maybeFn;
|
|
5581
5922
|
if (!testFn2) {
|
|
@@ -5613,7 +5954,7 @@ function wrapTest(originalTest, config) {
|
|
|
5613
5954
|
const registrationContext = getExperimentContext();
|
|
5614
5955
|
const testImplementation = async (vitestContext) => {
|
|
5615
5956
|
const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
|
|
5616
|
-
const experiment = _optionalChain([experimentContext, 'optionalAccess',
|
|
5957
|
+
const experiment = _optionalChain([experimentContext, 'optionalAccess', _130 => _130.experiment]);
|
|
5617
5958
|
if (config.onProgress) {
|
|
5618
5959
|
config.onProgress({ type: "test_start", testName: name });
|
|
5619
5960
|
}
|
|
@@ -5645,11 +5986,11 @@ function wrapTest(originalTest, config) {
|
|
|
5645
5986
|
const result = await runTracedEval({
|
|
5646
5987
|
experiment,
|
|
5647
5988
|
spanName: name,
|
|
5648
|
-
input: _optionalChain([testConfig, 'optionalAccess',
|
|
5649
|
-
expected: _optionalChain([testConfig, 'optionalAccess',
|
|
5650
|
-
metadata: _optionalChain([testConfig, 'optionalAccess',
|
|
5651
|
-
tags: _optionalChain([testConfig, 'optionalAccess',
|
|
5652
|
-
scorers: _optionalChain([testConfig, 'optionalAccess',
|
|
5989
|
+
input: _optionalChain([testConfig, 'optionalAccess', _131 => _131.input]),
|
|
5990
|
+
expected: _optionalChain([testConfig, 'optionalAccess', _132 => _132.expected]),
|
|
5991
|
+
metadata: _optionalChain([testConfig, 'optionalAccess', _133 => _133.metadata]),
|
|
5992
|
+
tags: _optionalChain([testConfig, 'optionalAccess', _134 => _134.tags]),
|
|
5993
|
+
scorers: _optionalChain([testConfig, 'optionalAccess', _135 => _135.scorers]),
|
|
5653
5994
|
fn: async () => {
|
|
5654
5995
|
if (testConfig && maybeFn) {
|
|
5655
5996
|
const params = {
|
|
@@ -5716,10 +6057,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
5716
6057
|
const getOrCreateContext = () => {
|
|
5717
6058
|
if (!context) {
|
|
5718
6059
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5719
|
-
const experiment = config.projectId ?
|
|
6060
|
+
const experiment = config.projectId ? _chunkSU6EHKJVjs.initExperiment.call(void 0, {
|
|
5720
6061
|
projectId: config.projectId,
|
|
5721
6062
|
experiment: experimentName
|
|
5722
|
-
}) :
|
|
6063
|
+
}) : _chunkSU6EHKJVjs.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
5723
6064
|
experiment: experimentName
|
|
5724
6065
|
});
|
|
5725
6066
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -5764,8 +6105,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
5764
6105
|
config.onProgress({
|
|
5765
6106
|
type: "suite_complete",
|
|
5766
6107
|
suiteName,
|
|
5767
|
-
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
5768
|
-
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
6108
|
+
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _136 => _136.passed]), () => ( 0)),
|
|
6109
|
+
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _137 => _137.failed]), () => ( 0))
|
|
5769
6110
|
});
|
|
5770
6111
|
}
|
|
5771
6112
|
});
|
|
@@ -5827,7 +6168,7 @@ function wrapExpect(originalExpect) {
|
|
|
5827
6168
|
return originalExpect(value);
|
|
5828
6169
|
}
|
|
5829
6170
|
const assertion = originalExpect(value, message);
|
|
5830
|
-
const span =
|
|
6171
|
+
const span = _chunkSU6EHKJVjs.currentSpan.call(void 0, );
|
|
5831
6172
|
if (!span) {
|
|
5832
6173
|
return assertion;
|
|
5833
6174
|
}
|
|
@@ -5839,16 +6180,16 @@ function wrapExpect(originalExpect) {
|
|
|
5839
6180
|
|
|
5840
6181
|
// src/wrappers/shared/logging.ts
|
|
5841
6182
|
function logOutputs(outputs) {
|
|
5842
|
-
|
|
6183
|
+
_chunkSU6EHKJVjs.currentSpan.call(void 0, ).log({ output: outputs });
|
|
5843
6184
|
}
|
|
5844
6185
|
function logFeedback(feedback) {
|
|
5845
|
-
|
|
6186
|
+
_chunkSU6EHKJVjs.currentSpan.call(void 0, ).log({
|
|
5846
6187
|
scores: { [feedback.name]: feedback.score },
|
|
5847
6188
|
metadata: feedback.metadata
|
|
5848
6189
|
});
|
|
5849
6190
|
}
|
|
5850
6191
|
function getCurrentSpan() {
|
|
5851
|
-
return
|
|
6192
|
+
return _chunkSU6EHKJVjs.currentSpan.call(void 0, );
|
|
5852
6193
|
}
|
|
5853
6194
|
|
|
5854
6195
|
// src/wrappers/vitest/index.ts
|
|
@@ -5896,8 +6237,8 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
5896
6237
|
);
|
|
5897
6238
|
return;
|
|
5898
6239
|
}
|
|
5899
|
-
await
|
|
5900
|
-
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6240
|
+
await _chunkSU6EHKJVjs.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
6241
|
+
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _138 => _138.displaySummary]), () => ( config.displaySummary))
|
|
5901
6242
|
});
|
|
5902
6243
|
}
|
|
5903
6244
|
};
|
|
@@ -5911,7 +6252,7 @@ function initNodeTestSuite(config) {
|
|
|
5911
6252
|
return experiment;
|
|
5912
6253
|
}
|
|
5913
6254
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5914
|
-
experiment =
|
|
6255
|
+
experiment = _chunkSU6EHKJVjs.initExperiment.call(void 0, config.projectName, {
|
|
5915
6256
|
experiment: experimentName
|
|
5916
6257
|
});
|
|
5917
6258
|
return experiment;
|
|
@@ -5960,7 +6301,7 @@ function initNodeTestSuite(config) {
|
|
|
5960
6301
|
if (!experiment) {
|
|
5961
6302
|
return;
|
|
5962
6303
|
}
|
|
5963
|
-
await
|
|
6304
|
+
await _chunkSU6EHKJVjs.summarizeAndFlush.call(void 0, experiment, {
|
|
5964
6305
|
displaySummary: config.displaySummary
|
|
5965
6306
|
});
|
|
5966
6307
|
experiment = void 0;
|
|
@@ -5977,7 +6318,7 @@ function initNodeTestSuite(config) {
|
|
|
5977
6318
|
|
|
5978
6319
|
// src/graph-framework.ts
|
|
5979
6320
|
var graph_framework_exports = {};
|
|
5980
|
-
|
|
6321
|
+
_chunk7AUY2XWXjs.__export.call(void 0, graph_framework_exports, {
|
|
5981
6322
|
AggregatorNode: () => AggregatorNode,
|
|
5982
6323
|
GateNode: () => GateNode,
|
|
5983
6324
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -6051,7 +6392,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6051
6392
|
};
|
|
6052
6393
|
}
|
|
6053
6394
|
resolveNode(node) {
|
|
6054
|
-
if (node instanceof
|
|
6395
|
+
if (node instanceof _chunkSU6EHKJVjs.Prompt) {
|
|
6055
6396
|
const cached = this.nodeLikeNodes.get(node);
|
|
6056
6397
|
if (cached) {
|
|
6057
6398
|
return [cached, []];
|
|
@@ -6101,7 +6442,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6101
6442
|
// }
|
|
6102
6443
|
// Helper to generate node IDs
|
|
6103
6444
|
generateId(name) {
|
|
6104
|
-
const uuid =
|
|
6445
|
+
const uuid = _chunkSU6EHKJVjs.newId.call(void 0, );
|
|
6105
6446
|
if (name) {
|
|
6106
6447
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
6107
6448
|
} else {
|
|
@@ -6142,6 +6483,8 @@ var BaseNode = (_class4 = class {
|
|
|
6142
6483
|
this.graph = graph;
|
|
6143
6484
|
this.id = id;
|
|
6144
6485
|
}
|
|
6486
|
+
|
|
6487
|
+
|
|
6145
6488
|
__init9() {this.__type = "node"}
|
|
6146
6489
|
__init10() {this.dependencies = []}
|
|
6147
6490
|
addDependency(dependency) {
|
|
@@ -6175,6 +6518,7 @@ var PromptNode = class extends BaseNode {
|
|
|
6175
6518
|
super(graph, id);
|
|
6176
6519
|
this.prompt = prompt;
|
|
6177
6520
|
}
|
|
6521
|
+
|
|
6178
6522
|
async build(context) {
|
|
6179
6523
|
return {
|
|
6180
6524
|
type: "function",
|
|
@@ -6187,6 +6531,7 @@ var GateNode = class extends BaseNode {
|
|
|
6187
6531
|
super(graph, id);
|
|
6188
6532
|
this.condition = condition;
|
|
6189
6533
|
}
|
|
6534
|
+
|
|
6190
6535
|
async build(context) {
|
|
6191
6536
|
return {
|
|
6192
6537
|
type: "gate",
|
|
@@ -6211,6 +6556,7 @@ var PromptTemplateNode = class extends BaseNode {
|
|
|
6211
6556
|
super(graph, id);
|
|
6212
6557
|
this.prompt = prompt;
|
|
6213
6558
|
}
|
|
6559
|
+
|
|
6214
6560
|
async build(context) {
|
|
6215
6561
|
return {
|
|
6216
6562
|
type: "prompt_template",
|
|
@@ -6223,6 +6569,7 @@ var LiteralNode = class extends BaseNode {
|
|
|
6223
6569
|
super(graph, id);
|
|
6224
6570
|
this.value = value;
|
|
6225
6571
|
}
|
|
6572
|
+
|
|
6226
6573
|
async build(context) {
|
|
6227
6574
|
return {
|
|
6228
6575
|
type: "literal",
|
|
@@ -7295,7 +7642,7 @@ function waterfall(tasks, callback) {
|
|
|
7295
7642
|
var waterfall$1 = awaitify(waterfall);
|
|
7296
7643
|
|
|
7297
7644
|
// src/trace.ts
|
|
7298
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
7645
|
+
var SpanFetcher = class _SpanFetcher extends _chunkSU6EHKJVjs.ObjectFetcher {
|
|
7299
7646
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
7300
7647
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
7301
7648
|
rootSpanId,
|
|
@@ -7316,6 +7663,10 @@ var SpanFetcher = class _SpanFetcher extends _chunkB6ZQIAK3js.ObjectFetcher {
|
|
|
7316
7663
|
this._state = _state;
|
|
7317
7664
|
this.spanTypeFilter = spanTypeFilter;
|
|
7318
7665
|
}
|
|
7666
|
+
|
|
7667
|
+
|
|
7668
|
+
|
|
7669
|
+
|
|
7319
7670
|
static buildFilter(rootSpanId, spanTypeFilter, includeScorers = false) {
|
|
7320
7671
|
const children = [
|
|
7321
7672
|
// Base filter: root_span_id = 'value'
|
|
@@ -7428,7 +7779,7 @@ var CachedSpanFetcher = (_class5 = class {
|
|
|
7428
7779
|
async fetchSpans(spanType) {
|
|
7429
7780
|
const spans = await this.fetchFn(spanType, false);
|
|
7430
7781
|
for (const span of spans) {
|
|
7431
|
-
const type = _nullishCoalesce(_optionalChain([span, 'access',
|
|
7782
|
+
const type = _nullishCoalesce(_optionalChain([span, 'access', _139 => _139.span_attributes, 'optionalAccess', _140 => _140.type]), () => ( ""));
|
|
7432
7783
|
const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
|
|
7433
7784
|
existing.push(span);
|
|
7434
7785
|
this.spanCache.set(type, existing);
|
|
@@ -7511,11 +7862,11 @@ var LocalTrace = (_class6 = class {
|
|
|
7511
7862
|
const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
|
|
7512
7863
|
if (cachedSpans && cachedSpans.length > 0) {
|
|
7513
7864
|
let spans = includeScorers ? cachedSpans : cachedSpans.filter(
|
|
7514
|
-
(span) => _optionalChain([span, 'access',
|
|
7865
|
+
(span) => _optionalChain([span, 'access', _141 => _141.span_attributes, 'optionalAccess', _142 => _142.purpose]) !== "scorer"
|
|
7515
7866
|
);
|
|
7516
7867
|
if (spanType && spanType.length > 0) {
|
|
7517
7868
|
spans = spans.filter(
|
|
7518
|
-
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access',
|
|
7869
|
+
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _143 => _143.span_attributes, 'optionalAccess', _144 => _144.type]), () => ( "")))
|
|
7519
7870
|
);
|
|
7520
7871
|
}
|
|
7521
7872
|
return spans.map((span) => ({
|
|
@@ -7540,7 +7891,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7540
7891
|
* Calls the API with the project_default preprocessor (which falls back to "thread").
|
|
7541
7892
|
*/
|
|
7542
7893
|
async getThread(options) {
|
|
7543
|
-
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7894
|
+
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _145 => _145.preprocessor]), () => ( "project_default"));
|
|
7544
7895
|
if (!this.threadCache.has(cacheKey)) {
|
|
7545
7896
|
const promise = this.fetchThread(options);
|
|
7546
7897
|
this.threadCache.set(cacheKey, promise);
|
|
@@ -7551,7 +7902,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7551
7902
|
await this.ensureSpansReady();
|
|
7552
7903
|
await this.state.login({});
|
|
7553
7904
|
const result = await invoke({
|
|
7554
|
-
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7905
|
+
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.preprocessor]), () => ( "project_default")),
|
|
7555
7906
|
functionType: "preprocessor",
|
|
7556
7907
|
input: {
|
|
7557
7908
|
trace_ref: {
|
|
@@ -7608,20 +7959,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
7608
7959
|
prompt: _v3.z.string()
|
|
7609
7960
|
}),
|
|
7610
7961
|
_v3.z.object({
|
|
7611
|
-
messages: _v3.z.array(
|
|
7962
|
+
messages: _v3.z.array(_chunkSU6EHKJVjs.ChatCompletionMessageParam)
|
|
7612
7963
|
})
|
|
7613
7964
|
]);
|
|
7614
7965
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
7615
7966
|
_v3.z.object({
|
|
7616
7967
|
model: _v3.z.string(),
|
|
7617
|
-
params:
|
|
7968
|
+
params: _chunkSU6EHKJVjs.ModelParams.optional(),
|
|
7618
7969
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
7619
7970
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
7620
7971
|
})
|
|
7621
7972
|
);
|
|
7622
7973
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
7623
7974
|
_v3.z.object({
|
|
7624
|
-
tools: _v3.z.array(
|
|
7975
|
+
tools: _v3.z.array(_chunkSU6EHKJVjs.ToolFunctionDefinition).optional()
|
|
7625
7976
|
})
|
|
7626
7977
|
);
|
|
7627
7978
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -7669,7 +8020,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
7669
8020
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
7670
8021
|
return parameters;
|
|
7671
8022
|
}
|
|
7672
|
-
if (
|
|
8023
|
+
if (_chunkSU6EHKJVjs.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
7673
8024
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
7674
8025
|
...resolvedSchema.data,
|
|
7675
8026
|
...parameters
|
|
@@ -7691,14 +8042,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
7691
8042
|
const value = parameters[name];
|
|
7692
8043
|
try {
|
|
7693
8044
|
if ("type" in schema && schema.type === "prompt") {
|
|
7694
|
-
const promptData = value ?
|
|
8045
|
+
const promptData = value ? _chunkSU6EHKJVjs.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
7695
8046
|
schema.default,
|
|
7696
8047
|
schema.default.tools
|
|
7697
8048
|
) : void 0;
|
|
7698
8049
|
if (!promptData) {
|
|
7699
8050
|
throw new Error(`Parameter '${name}' is required`);
|
|
7700
8051
|
}
|
|
7701
|
-
return [name,
|
|
8052
|
+
return [name, _chunkSU6EHKJVjs.Prompt.fromPromptData(name, promptData)];
|
|
7702
8053
|
} else if ("type" in schema && schema.type === "model") {
|
|
7703
8054
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
7704
8055
|
if (model === void 0) {
|
|
@@ -7727,10 +8078,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
|
|
|
7727
8078
|
const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
|
|
7728
8079
|
const validate = ajv.compile(schema);
|
|
7729
8080
|
if (!validate(parameters)) {
|
|
7730
|
-
const errorMessages = _optionalChain([validate, 'access',
|
|
8081
|
+
const errorMessages = _optionalChain([validate, 'access', _147 => _147.errors, 'optionalAccess', _148 => _148.map, 'call', _149 => _149((err) => {
|
|
7731
8082
|
const path = err.instancePath || "root";
|
|
7732
8083
|
return `${path}: ${err.message}`;
|
|
7733
|
-
}), 'access',
|
|
8084
|
+
}), 'access', _150 => _150.join, 'call', _151 => _151(", ")]);
|
|
7734
8085
|
throw Error(`Invalid parameters: ${errorMessages}`);
|
|
7735
8086
|
}
|
|
7736
8087
|
return rehydrateRemoteParameters(parameters, schema);
|
|
@@ -7749,7 +8100,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
7749
8100
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
7750
8101
|
return [
|
|
7751
8102
|
name,
|
|
7752
|
-
|
|
8103
|
+
_chunkSU6EHKJVjs.Prompt.fromPromptData(name, _chunkSU6EHKJVjs.PromptData.parse(value))
|
|
7753
8104
|
];
|
|
7754
8105
|
}
|
|
7755
8106
|
return [name, value];
|
|
@@ -7766,6 +8117,8 @@ var EvalResultWithSummary = class {
|
|
|
7766
8117
|
this.summary = summary;
|
|
7767
8118
|
this.results = results;
|
|
7768
8119
|
}
|
|
8120
|
+
|
|
8121
|
+
|
|
7769
8122
|
/**
|
|
7770
8123
|
* @deprecated Use `summary` instead.
|
|
7771
8124
|
*/
|
|
@@ -7785,7 +8138,7 @@ var EvalResultWithSummary = class {
|
|
|
7785
8138
|
async function getPersistedBaseExperimentId(experiment) {
|
|
7786
8139
|
try {
|
|
7787
8140
|
return await experiment._getBaseExperimentId();
|
|
7788
|
-
} catch (
|
|
8141
|
+
} catch (e8) {
|
|
7789
8142
|
return void 0;
|
|
7790
8143
|
}
|
|
7791
8144
|
}
|
|
@@ -7797,7 +8150,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
7797
8150
|
return out;
|
|
7798
8151
|
}
|
|
7799
8152
|
function initExperiment2(state, options = {}) {
|
|
7800
|
-
return
|
|
8153
|
+
return _chunkSU6EHKJVjs.init.call(void 0, {
|
|
7801
8154
|
state,
|
|
7802
8155
|
...options,
|
|
7803
8156
|
setCurrent: false
|
|
@@ -7808,7 +8161,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
7808
8161
|
return void 0;
|
|
7809
8162
|
}
|
|
7810
8163
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
7811
|
-
if (!
|
|
8164
|
+
if (!_chunkSU6EHKJVjs.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
7812
8165
|
return void 0;
|
|
7813
8166
|
}
|
|
7814
8167
|
if (resolvedParameters.id === void 0) {
|
|
@@ -7844,10 +8197,10 @@ globalThis._evals = {
|
|
|
7844
8197
|
reporters: {}
|
|
7845
8198
|
};
|
|
7846
8199
|
function _initializeSpanContext() {
|
|
7847
|
-
globalThis._spanContext = { currentSpan:
|
|
8200
|
+
globalThis._spanContext = { currentSpan: _chunkSU6EHKJVjs.currentSpan, withCurrent: _chunkSU6EHKJVjs.withCurrent, startSpan: _chunkSU6EHKJVjs.startSpan, NOOP_SPAN: _chunkSU6EHKJVjs.NOOP_SPAN };
|
|
7848
8201
|
}
|
|
7849
8202
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
7850
|
-
const options =
|
|
8203
|
+
const options = _chunkSU6EHKJVjs.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
7851
8204
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
7852
8205
|
if (globalThis._evals.evaluators[evalName]) {
|
|
7853
8206
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -7898,7 +8251,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7898
8251
|
baseExperimentId: evaluator.baseExperimentId,
|
|
7899
8252
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
7900
8253
|
repoInfo: evaluator.repoInfo,
|
|
7901
|
-
dataset:
|
|
8254
|
+
dataset: _chunkSU6EHKJVjs.Dataset.isDataset(data) ? data : void 0,
|
|
7902
8255
|
parameters
|
|
7903
8256
|
});
|
|
7904
8257
|
if (experiment && typeof process !== "undefined" && globalThis.BRAINTRUST_CONTEXT_MANAGER !== void 0) {
|
|
@@ -7918,7 +8271,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7918
8271
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
7919
8272
|
let ret;
|
|
7920
8273
|
if (options.parent) {
|
|
7921
|
-
ret = await
|
|
8274
|
+
ret = await _chunkSU6EHKJVjs.withParent.call(void 0,
|
|
7922
8275
|
options.parent,
|
|
7923
8276
|
() => runEvaluator(
|
|
7924
8277
|
null,
|
|
@@ -7954,7 +8307,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7954
8307
|
if (experiment) {
|
|
7955
8308
|
await experiment.flush().catch(console.error);
|
|
7956
8309
|
} else if (options.parent) {
|
|
7957
|
-
await
|
|
8310
|
+
await _chunkSU6EHKJVjs.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
7958
8311
|
}
|
|
7959
8312
|
}
|
|
7960
8313
|
} finally {
|
|
@@ -8000,13 +8353,13 @@ function classifierName(classifier, classifier_idx) {
|
|
|
8000
8353
|
}
|
|
8001
8354
|
function buildSpanMetadata(results) {
|
|
8002
8355
|
return results.length === 1 ? results[0].metadata : results.reduce(
|
|
8003
|
-
(prev, s) =>
|
|
8356
|
+
(prev, s) => _chunkSU6EHKJVjs.mergeDicts.call(void 0, prev, { [s.name]: s.metadata }),
|
|
8004
8357
|
{}
|
|
8005
8358
|
);
|
|
8006
8359
|
}
|
|
8007
8360
|
function buildSpanScores(results) {
|
|
8008
8361
|
const scoresRecord = results.reduce(
|
|
8009
|
-
(prev, s) =>
|
|
8362
|
+
(prev, s) => _chunkSU6EHKJVjs.mergeDicts.call(void 0, prev, { [s.name]: s.score }),
|
|
8010
8363
|
{}
|
|
8011
8364
|
);
|
|
8012
8365
|
return { resultMetadata: buildSpanMetadata(results), scoresRecord };
|
|
@@ -8036,7 +8389,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
8036
8389
|
return failing;
|
|
8037
8390
|
}
|
|
8038
8391
|
function validateClassificationResult(value, scorerName2) {
|
|
8039
|
-
if (!(typeof value === "object" && value !== null && !
|
|
8392
|
+
if (!(typeof value === "object" && value !== null && !_chunkSU6EHKJVjs.isEmpty.call(void 0, value))) {
|
|
8040
8393
|
throw new Error(
|
|
8041
8394
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
8042
8395
|
);
|
|
@@ -8065,7 +8418,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
8065
8418
|
);
|
|
8066
8419
|
metadata[`${kind}_errors`] = errorMap;
|
|
8067
8420
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
8068
|
-
|
|
8421
|
+
_chunkSU6EHKJVjs.debugLogger.forState(state).warn(
|
|
8069
8422
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
8070
8423
|
failures.map((f) => f.error)
|
|
8071
8424
|
);
|
|
@@ -8099,7 +8452,7 @@ var defaultErrorScoreHandler = ({
|
|
|
8099
8452
|
};
|
|
8100
8453
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
8101
8454
|
if (enableCache) {
|
|
8102
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8455
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _152 => _152.spanCache, 'optionalAccess', _153 => _153.start, 'call', _154 => _154()]);
|
|
8103
8456
|
}
|
|
8104
8457
|
try {
|
|
8105
8458
|
if (typeof evaluator.data === "string") {
|
|
@@ -8120,7 +8473,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8120
8473
|
);
|
|
8121
8474
|
}
|
|
8122
8475
|
let name = dataResult.name;
|
|
8123
|
-
if (
|
|
8476
|
+
if (_chunkSU6EHKJVjs.isEmpty.call(void 0, name)) {
|
|
8124
8477
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
8125
8478
|
if (!baseExperiment) {
|
|
8126
8479
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -8154,7 +8507,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8154
8507
|
const experimentIdPromise = experiment ? (async () => {
|
|
8155
8508
|
try {
|
|
8156
8509
|
return await experiment.id;
|
|
8157
|
-
} catch (
|
|
8510
|
+
} catch (e9) {
|
|
8158
8511
|
return void 0;
|
|
8159
8512
|
}
|
|
8160
8513
|
})() : void 0;
|
|
@@ -8170,7 +8523,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8170
8523
|
if (cancelled) {
|
|
8171
8524
|
return;
|
|
8172
8525
|
}
|
|
8173
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
8526
|
+
const eventDataset = experiment ? experiment.dataset : _chunkSU6EHKJVjs.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
8174
8527
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
8175
8528
|
object_type: "dataset",
|
|
8176
8529
|
object_id: await eventDataset.id,
|
|
@@ -8178,8 +8531,8 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8178
8531
|
created: datum.created,
|
|
8179
8532
|
_xact_id: datum._xact_id
|
|
8180
8533
|
} : void 0;
|
|
8181
|
-
const parsedDatumOrigin =
|
|
8182
|
-
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess',
|
|
8534
|
+
const parsedDatumOrigin = _chunkSU6EHKJVjs.ObjectReference.safeParse(datum.origin);
|
|
8535
|
+
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _155 => _155.success]) ? parsedDatumOrigin.data : void 0)));
|
|
8183
8536
|
const baseEvent = {
|
|
8184
8537
|
name: "eval",
|
|
8185
8538
|
spanAttributes: {
|
|
@@ -8194,26 +8547,26 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8194
8547
|
}
|
|
8195
8548
|
};
|
|
8196
8549
|
const callback = async (rootSpan) => {
|
|
8197
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
8550
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )));
|
|
8198
8551
|
const ensureSpansFlushed = async () => {
|
|
8199
8552
|
if (experiment) {
|
|
8200
|
-
await
|
|
8553
|
+
await _chunkSU6EHKJVjs.flush.call(void 0, { state: experiment.loggingState });
|
|
8201
8554
|
} else if (state) {
|
|
8202
|
-
await
|
|
8555
|
+
await _chunkSU6EHKJVjs.flush.call(void 0, { state });
|
|
8203
8556
|
} else {
|
|
8204
|
-
await
|
|
8557
|
+
await _chunkSU6EHKJVjs.flush.call(void 0, );
|
|
8205
8558
|
}
|
|
8206
8559
|
if (state) {
|
|
8207
8560
|
await state.flushOtel();
|
|
8208
8561
|
}
|
|
8209
8562
|
};
|
|
8210
8563
|
const parentStr = state.currentParent.getStore();
|
|
8211
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
8564
|
+
const parentComponents = typeof parentStr === "string" ? _chunkSU6EHKJVjs.SpanComponentsV4.fromStr(parentStr) : null;
|
|
8212
8565
|
const trace = state ? new LocalTrace({
|
|
8213
|
-
objectType: parentComponents ?
|
|
8566
|
+
objectType: parentComponents ? _chunkSU6EHKJVjs.spanObjectTypeV3ToTypedString.call(void 0,
|
|
8214
8567
|
parentComponents.data.object_type
|
|
8215
8568
|
) : "experiment",
|
|
8216
|
-
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async
|
|
8569
|
+
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _156 => _156.data, 'access', async _157 => _157.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
8217
8570
|
rootSpanId: rootSpan.rootSpanId,
|
|
8218
8571
|
ensureSpansFlushed,
|
|
8219
8572
|
state
|
|
@@ -8243,10 +8596,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8243
8596
|
span,
|
|
8244
8597
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
8245
8598
|
reportProgress: (event) => {
|
|
8246
|
-
_optionalChain([stream, 'optionalCall',
|
|
8599
|
+
_optionalChain([stream, 'optionalCall', _158 => _158({
|
|
8247
8600
|
...event,
|
|
8248
8601
|
id: rootSpan.id,
|
|
8249
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
8602
|
+
origin: _optionalChain([baseEvent, 'access', _159 => _159.event, 'optionalAccess', _160 => _160.origin]),
|
|
8250
8603
|
name: evaluator.evalName,
|
|
8251
8604
|
object_type: "task"
|
|
8252
8605
|
})]);
|
|
@@ -8285,7 +8638,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8285
8638
|
trace
|
|
8286
8639
|
};
|
|
8287
8640
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
8288
|
-
const propagatedEvent =
|
|
8641
|
+
const propagatedEvent = _chunkSU6EHKJVjs.makeScorerPropagatedEvent.call(void 0,
|
|
8289
8642
|
await rootSpan.export()
|
|
8290
8643
|
);
|
|
8291
8644
|
const getOtherFields = (s) => {
|
|
@@ -8308,14 +8661,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8308
8661
|
if (scoreValue === null) return null;
|
|
8309
8662
|
if (Array.isArray(scoreValue)) {
|
|
8310
8663
|
for (const s of scoreValue) {
|
|
8311
|
-
if (!(typeof s === "object" && !
|
|
8664
|
+
if (!(typeof s === "object" && !_chunkSU6EHKJVjs.isEmpty.call(void 0, s))) {
|
|
8312
8665
|
throw new Error(
|
|
8313
8666
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(s)}`
|
|
8314
8667
|
);
|
|
8315
8668
|
}
|
|
8316
8669
|
}
|
|
8317
8670
|
}
|
|
8318
|
-
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !
|
|
8671
|
+
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !_chunkSU6EHKJVjs.isEmpty.call(void 0, scoreValue) ? [scoreValue] : [
|
|
8319
8672
|
{
|
|
8320
8673
|
name: scorerNames[score_idx],
|
|
8321
8674
|
score: scoreValue
|
|
@@ -8323,7 +8676,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8323
8676
|
];
|
|
8324
8677
|
const { resultMetadata, scoresRecord } = buildSpanScores(results);
|
|
8325
8678
|
const resultOutput = results.length === 1 ? getOtherFields(results[0]) : results.reduce(
|
|
8326
|
-
(prev, s) =>
|
|
8679
|
+
(prev, s) => _chunkSU6EHKJVjs.mergeDicts.call(void 0, prev, {
|
|
8327
8680
|
[s.name]: getOtherFields(s)
|
|
8328
8681
|
}),
|
|
8329
8682
|
{}
|
|
@@ -8358,7 +8711,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8358
8711
|
)
|
|
8359
8712
|
);
|
|
8360
8713
|
const resultOutput = rawResults.length === 1 ? toClassificationItem(rawResults[0]) : rawResults.reduce(
|
|
8361
|
-
(prev, r) =>
|
|
8714
|
+
(prev, r) => _chunkSU6EHKJVjs.mergeDicts.call(void 0, prev, {
|
|
8362
8715
|
[r.name]: toClassificationItem(r)
|
|
8363
8716
|
}),
|
|
8364
8717
|
{}
|
|
@@ -8410,7 +8763,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8410
8763
|
evaluator.state
|
|
8411
8764
|
);
|
|
8412
8765
|
} catch (e) {
|
|
8413
|
-
|
|
8766
|
+
_chunkSU6EHKJVjs.logError.call(void 0, rootSpan, e);
|
|
8414
8767
|
error = e;
|
|
8415
8768
|
} finally {
|
|
8416
8769
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -8434,7 +8787,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8434
8787
|
tags: tags.length ? tags : void 0,
|
|
8435
8788
|
metadata,
|
|
8436
8789
|
error,
|
|
8437
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
8790
|
+
origin: _optionalChain([baseEvent, 'access', _161 => _161.event, 'optionalAccess', _162 => _162.origin])
|
|
8438
8791
|
};
|
|
8439
8792
|
collectedResults.push({
|
|
8440
8793
|
...baseResult,
|
|
@@ -8444,7 +8797,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8444
8797
|
}
|
|
8445
8798
|
};
|
|
8446
8799
|
if (!experiment) {
|
|
8447
|
-
return await
|
|
8800
|
+
return await _chunkSU6EHKJVjs.traced.call(void 0, callback, {
|
|
8448
8801
|
...baseEvent,
|
|
8449
8802
|
state: evaluator.state
|
|
8450
8803
|
});
|
|
@@ -8474,7 +8827,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8474
8827
|
break;
|
|
8475
8828
|
}
|
|
8476
8829
|
scheduledTrials++;
|
|
8477
|
-
_optionalChain([progressReporter, 'access',
|
|
8830
|
+
_optionalChain([progressReporter, 'access', _163 => _163.setTotal, 'optionalCall', _164 => _164(evaluator.evalName, scheduledTrials)]);
|
|
8478
8831
|
q.pushAsync({ datum, trialIndex }).catch((e) => {
|
|
8479
8832
|
if (queueErrors.length < 5) {
|
|
8480
8833
|
queueErrors.push(e);
|
|
@@ -8486,7 +8839,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8486
8839
|
const cancel = async () => {
|
|
8487
8840
|
await new Promise((_, reject2) => {
|
|
8488
8841
|
if (cancelled) {
|
|
8489
|
-
reject2(new (0,
|
|
8842
|
+
reject2(new (0, _chunkSU6EHKJVjs.InternalAbortError)("Evaluator already cancelled"));
|
|
8490
8843
|
return;
|
|
8491
8844
|
}
|
|
8492
8845
|
let timeoutId;
|
|
@@ -8507,12 +8860,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8507
8860
|
};
|
|
8508
8861
|
if (evaluator.timeout) {
|
|
8509
8862
|
timeoutId = setTimeout(() => {
|
|
8510
|
-
rejectOnce(new (0,
|
|
8863
|
+
rejectOnce(new (0, _chunkSU6EHKJVjs.InternalAbortError)("Evaluator timed out"));
|
|
8511
8864
|
}, evaluator.timeout);
|
|
8512
8865
|
}
|
|
8513
8866
|
if (evaluator.signal) {
|
|
8514
8867
|
abortHandler = () => {
|
|
8515
|
-
rejectOnce(new (0,
|
|
8868
|
+
rejectOnce(new (0, _chunkSU6EHKJVjs.InternalAbortError)("Evaluator aborted"));
|
|
8516
8869
|
};
|
|
8517
8870
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
8518
8871
|
}
|
|
@@ -8535,9 +8888,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8535
8888
|
}
|
|
8536
8889
|
} catch (e) {
|
|
8537
8890
|
q.kill();
|
|
8538
|
-
if (e instanceof
|
|
8539
|
-
if (
|
|
8540
|
-
|
|
8891
|
+
if (e instanceof _chunkSU6EHKJVjs.InternalAbortError) {
|
|
8892
|
+
if (_chunk7AUY2XWXjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
8893
|
+
_chunkSU6EHKJVjs.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
8541
8894
|
}
|
|
8542
8895
|
}
|
|
8543
8896
|
throw e;
|
|
@@ -8561,9 +8914,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8561
8914
|
);
|
|
8562
8915
|
} finally {
|
|
8563
8916
|
if (enableCache) {
|
|
8564
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8565
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
8566
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
8917
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _165 => _165.spanCache]);
|
|
8918
|
+
_optionalChain([spanCache, 'optionalAccess', _166 => _166.dispose, 'call', _167 => _167()]);
|
|
8919
|
+
_optionalChain([spanCache, 'optionalAccess', _168 => _168.stop, 'call', _169 => _169()]);
|
|
8567
8920
|
}
|
|
8568
8921
|
}
|
|
8569
8922
|
}
|
|
@@ -8656,25 +9009,25 @@ var defaultReporter = {
|
|
|
8656
9009
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
8657
9010
|
}
|
|
8658
9011
|
if (jsonl) {
|
|
8659
|
-
|
|
9012
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(JSON.stringify(summary));
|
|
8660
9013
|
} else {
|
|
8661
|
-
|
|
8662
|
-
|
|
9014
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln("Experiment summary");
|
|
9015
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln("==================");
|
|
8663
9016
|
if (summary.comparisonExperimentName) {
|
|
8664
|
-
|
|
9017
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8665
9018
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
8666
9019
|
);
|
|
8667
|
-
|
|
9020
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln("");
|
|
8668
9021
|
}
|
|
8669
9022
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
8670
9023
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
8671
9024
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
8672
9025
|
if (hasScores || hasMetrics) {
|
|
8673
9026
|
if (hasComparison) {
|
|
8674
|
-
|
|
9027
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8675
9028
|
"Name Value Change Improvements Regressions"
|
|
8676
9029
|
);
|
|
8677
|
-
|
|
9030
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8678
9031
|
"----------------------------------------------------------------"
|
|
8679
9032
|
);
|
|
8680
9033
|
}
|
|
@@ -8683,18 +9036,18 @@ var defaultReporter = {
|
|
|
8683
9036
|
const scoreValue = `${scorePercent}%`;
|
|
8684
9037
|
if (hasComparison) {
|
|
8685
9038
|
let diffString = "-";
|
|
8686
|
-
if (!
|
|
9039
|
+
if (!_chunkSU6EHKJVjs.isEmpty.call(void 0, score.diff)) {
|
|
8687
9040
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
8688
9041
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
8689
9042
|
diffString = `${diffSign}${diffPercent}%`;
|
|
8690
9043
|
}
|
|
8691
9044
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
8692
9045
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
8693
|
-
|
|
9046
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8694
9047
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
8695
9048
|
);
|
|
8696
9049
|
} else {
|
|
8697
|
-
|
|
9050
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
8698
9051
|
}
|
|
8699
9052
|
}
|
|
8700
9053
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -8703,30 +9056,30 @@ var defaultReporter = {
|
|
|
8703
9056
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
8704
9057
|
if (hasComparison) {
|
|
8705
9058
|
let diffString = "-";
|
|
8706
|
-
if (!
|
|
9059
|
+
if (!_chunkSU6EHKJVjs.isEmpty.call(void 0, metric.diff)) {
|
|
8707
9060
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
8708
9061
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
8709
9062
|
diffString = `${diffSign}${diffPercent}%`;
|
|
8710
9063
|
}
|
|
8711
9064
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
8712
9065
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
8713
|
-
|
|
9066
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8714
9067
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
8715
9068
|
);
|
|
8716
9069
|
} else {
|
|
8717
|
-
|
|
9070
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(
|
|
8718
9071
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
8719
9072
|
);
|
|
8720
9073
|
}
|
|
8721
9074
|
}
|
|
8722
9075
|
}
|
|
8723
9076
|
if (summary.experimentUrl) {
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
9077
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln("");
|
|
9078
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
9079
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
8727
9080
|
}
|
|
8728
9081
|
}
|
|
8729
|
-
|
|
9082
|
+
_chunk7AUY2XWXjs.isomorph_default.writeln("");
|
|
8730
9083
|
return failingResults.length === 0;
|
|
8731
9084
|
},
|
|
8732
9085
|
async reportRun(evalReports) {
|
|
@@ -8746,7 +9099,7 @@ function agentAssertionScorer(callback, options = {}) {
|
|
|
8746
9099
|
});
|
|
8747
9100
|
const resources = {};
|
|
8748
9101
|
if (assertions.some((assertion) => assertion.requiresTrace)) {
|
|
8749
|
-
resources.spans = await _optionalChain([args, 'access',
|
|
9102
|
+
resources.spans = await _optionalChain([args, 'access', _170 => _170.trace, 'optionalAccess', _171 => _171.getSpans, 'call', _172 => _172({ spanType: ["tool"] })]);
|
|
8750
9103
|
}
|
|
8751
9104
|
const results = await Promise.all(
|
|
8752
9105
|
assertions.map(async (assertion) => {
|
|
@@ -8904,7 +9257,7 @@ async function validateSchema(schema, value) {
|
|
|
8904
9257
|
}
|
|
8905
9258
|
}
|
|
8906
9259
|
function toolCalls(spans) {
|
|
8907
|
-
return spans.filter((span) => _optionalChain([span, 'access',
|
|
9260
|
+
return spans.filter((span) => _optionalChain([span, 'access', _173 => _173.span_attributes, 'optionalAccess', _174 => _174.type]) === "tool");
|
|
8908
9261
|
}
|
|
8909
9262
|
function matchingToolCalls(spans, toolName, options) {
|
|
8910
9263
|
return toolCalls(spans).filter((span) => {
|
|
@@ -8922,17 +9275,17 @@ function matchingToolCalls(spans, toolName, options) {
|
|
|
8922
9275
|
});
|
|
8923
9276
|
}
|
|
8924
9277
|
function getToolName(span) {
|
|
8925
|
-
const spanName = [_optionalChain([span, 'access',
|
|
8926
|
-
if (_optionalChain([spanName, 'optionalAccess',
|
|
9278
|
+
const spanName = [_optionalChain([span, 'access', _175 => _175.span_attributes, 'optionalAccess', _176 => _176.name]), span.name].map(normalizeToolName).find((value) => value !== void 0);
|
|
9279
|
+
if (_optionalChain([spanName, 'optionalAccess', _177 => _177.includes, 'call', _178 => _178("/")])) {
|
|
8927
9280
|
return spanName;
|
|
8928
9281
|
}
|
|
8929
9282
|
const metadataName = [
|
|
8930
|
-
_optionalChain([span, 'access',
|
|
8931
|
-
_optionalChain([span, 'access',
|
|
9283
|
+
_optionalChain([span, 'access', _179 => _179.metadata, 'optionalAccess', _180 => _180.tool_name]),
|
|
9284
|
+
_optionalChain([span, 'access', _181 => _181.metadata, 'optionalAccess', _182 => _182["gen_ai.tool.name"]])
|
|
8932
9285
|
].map(normalizeToolName).find((value) => value !== void 0);
|
|
8933
9286
|
const mcpServer = [
|
|
8934
|
-
_optionalChain([span, 'access',
|
|
8935
|
-
_optionalChain([span, 'access',
|
|
9287
|
+
_optionalChain([span, 'access', _183 => _183.metadata, 'optionalAccess', _184 => _184["mcp.server"]]),
|
|
9288
|
+
_optionalChain([span, 'access', _185 => _185.metadata, 'optionalAccess', _186 => _186["openai_codex.mcp.server"]])
|
|
8936
9289
|
].find((value) => typeof value === "string" && value !== "");
|
|
8937
9290
|
if (metadataName && mcpServer) {
|
|
8938
9291
|
return `${mcpServer}/${metadataName}`;
|
|
@@ -9002,7 +9355,7 @@ function formatValue(value) {
|
|
|
9002
9355
|
return serialized;
|
|
9003
9356
|
}
|
|
9004
9357
|
return formatValueWithUndefined(value, /* @__PURE__ */ new Set());
|
|
9005
|
-
} catch (
|
|
9358
|
+
} catch (e10) {
|
|
9006
9359
|
return String(value);
|
|
9007
9360
|
}
|
|
9008
9361
|
}
|
|
@@ -9161,7 +9514,7 @@ var Project2 = (_class7 = class {
|
|
|
9161
9514
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
9162
9515
|
return;
|
|
9163
9516
|
}
|
|
9164
|
-
await
|
|
9517
|
+
await _chunkSU6EHKJVjs.login.call(void 0, );
|
|
9165
9518
|
const projectMap = new ProjectNameIdMap();
|
|
9166
9519
|
const functionDefinitions = [];
|
|
9167
9520
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -9175,7 +9528,7 @@ var Project2 = (_class7 = class {
|
|
|
9175
9528
|
functionDefinitions.push(functionDefinition);
|
|
9176
9529
|
}
|
|
9177
9530
|
}
|
|
9178
|
-
await
|
|
9531
|
+
await _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
9179
9532
|
functions: functionDefinitions
|
|
9180
9533
|
});
|
|
9181
9534
|
}
|
|
@@ -9184,6 +9537,7 @@ var ToolBuilder = (_class8 = class {
|
|
|
9184
9537
|
constructor(project) {;_class8.prototype.__init19.call(this);
|
|
9185
9538
|
this.project = project;
|
|
9186
9539
|
}
|
|
9540
|
+
|
|
9187
9541
|
__init19() {this.taskCounter = 0}
|
|
9188
9542
|
// This type definition is just a catch all so that the implementation can be
|
|
9189
9543
|
// less specific than the two more specific declarations above.
|
|
@@ -9193,12 +9547,12 @@ var ToolBuilder = (_class8 = class {
|
|
|
9193
9547
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
9194
9548
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
9195
9549
|
if (resolvedName.trim().length === 0) {
|
|
9196
|
-
resolvedName = `Tool ${
|
|
9550
|
+
resolvedName = `Tool ${_chunk7AUY2XWXjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9197
9551
|
}
|
|
9198
9552
|
const tool = new CodeFunction(this.project, {
|
|
9199
9553
|
handler,
|
|
9200
9554
|
name: resolvedName,
|
|
9201
|
-
slug: _nullishCoalesce(slug, () => (
|
|
9555
|
+
slug: _nullishCoalesce(slug, () => ( _chunkSU6EHKJVjs.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
9202
9556
|
type: "tool",
|
|
9203
9557
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
9204
9558
|
parameters,
|
|
@@ -9214,6 +9568,7 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9214
9568
|
constructor(project) {;_class9.prototype.__init20.call(this);
|
|
9215
9569
|
this.project = project;
|
|
9216
9570
|
}
|
|
9571
|
+
|
|
9217
9572
|
__init20() {this.taskCounter = 0}
|
|
9218
9573
|
create(opts) {
|
|
9219
9574
|
this.taskCounter++;
|
|
@@ -9222,9 +9577,9 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9222
9577
|
resolvedName = opts.handler.name;
|
|
9223
9578
|
}
|
|
9224
9579
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9225
|
-
resolvedName = `Scorer ${
|
|
9580
|
+
resolvedName = `Scorer ${_chunk7AUY2XWXjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9226
9581
|
}
|
|
9227
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9582
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkSU6EHKJVjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9228
9583
|
if ("handler" in opts) {
|
|
9229
9584
|
const scorer = new CodeFunction(this.project, {
|
|
9230
9585
|
...opts,
|
|
@@ -9273,14 +9628,15 @@ var ClassifierBuilder = (_class10 = class {
|
|
|
9273
9628
|
constructor(project) {;_class10.prototype.__init21.call(this);
|
|
9274
9629
|
this.project = project;
|
|
9275
9630
|
}
|
|
9631
|
+
|
|
9276
9632
|
__init21() {this.taskCounter = 0}
|
|
9277
9633
|
create(opts) {
|
|
9278
9634
|
this.taskCounter++;
|
|
9279
9635
|
let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
|
|
9280
9636
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9281
|
-
resolvedName = `Classifier ${
|
|
9637
|
+
resolvedName = `Classifier ${_chunk7AUY2XWXjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9282
9638
|
}
|
|
9283
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9639
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkSU6EHKJVjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9284
9640
|
const classifier = new CodeFunction(this.project, {
|
|
9285
9641
|
...opts,
|
|
9286
9642
|
name: resolvedName,
|
|
@@ -9318,6 +9674,7 @@ var CodeFunction = class {
|
|
|
9318
9674
|
|
|
9319
9675
|
|
|
9320
9676
|
|
|
9677
|
+
|
|
9321
9678
|
key() {
|
|
9322
9679
|
return JSON.stringify([
|
|
9323
9680
|
_nullishCoalesce(this.project.id, () => ( "")),
|
|
@@ -9395,6 +9752,7 @@ var PromptBuilder = class {
|
|
|
9395
9752
|
constructor(project) {
|
|
9396
9753
|
this.project = project;
|
|
9397
9754
|
}
|
|
9755
|
+
|
|
9398
9756
|
create(opts) {
|
|
9399
9757
|
const toolFunctions = [];
|
|
9400
9758
|
const rawTools = [];
|
|
@@ -9407,18 +9765,18 @@ var PromptBuilder = class {
|
|
|
9407
9765
|
rawTools.push(tool);
|
|
9408
9766
|
}
|
|
9409
9767
|
}
|
|
9410
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9768
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkSU6EHKJVjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9411
9769
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
9412
9770
|
const promptRow = {
|
|
9413
9771
|
id: opts.id,
|
|
9414
|
-
_xact_id: opts.version ?
|
|
9772
|
+
_xact_id: opts.version ? _chunkSU6EHKJVjs.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
9415
9773
|
name: opts.name,
|
|
9416
9774
|
slug,
|
|
9417
9775
|
prompt_data: promptData,
|
|
9418
9776
|
tags: opts.tags,
|
|
9419
9777
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
9420
9778
|
};
|
|
9421
|
-
const prompt = new (0,
|
|
9779
|
+
const prompt = new (0, _chunkSU6EHKJVjs.Prompt)(
|
|
9422
9780
|
promptRow,
|
|
9423
9781
|
{},
|
|
9424
9782
|
// It doesn't make sense to specify defaults here.
|
|
@@ -9471,8 +9829,9 @@ var ParametersBuilder = class {
|
|
|
9471
9829
|
constructor(project) {
|
|
9472
9830
|
this.project = project;
|
|
9473
9831
|
}
|
|
9832
|
+
|
|
9474
9833
|
create(opts) {
|
|
9475
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9834
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkSU6EHKJVjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9476
9835
|
const codeParameters = new CodeParameters(this.project, {
|
|
9477
9836
|
name: opts.name,
|
|
9478
9837
|
slug,
|
|
@@ -9511,7 +9870,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
9511
9870
|
required.push(name);
|
|
9512
9871
|
}
|
|
9513
9872
|
} else {
|
|
9514
|
-
const schemaObj =
|
|
9873
|
+
const schemaObj = _chunkSU6EHKJVjs.zodToJsonSchema.call(void 0, value);
|
|
9515
9874
|
properties[name] = schemaObj;
|
|
9516
9875
|
if (!("default" in schemaObj)) {
|
|
9517
9876
|
required.push(name);
|
|
@@ -9540,11 +9899,11 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9540
9899
|
__init23() {this.idToName = {}}
|
|
9541
9900
|
async getId(projectName) {
|
|
9542
9901
|
if (!(projectName in this.nameToId)) {
|
|
9543
|
-
const response = await
|
|
9902
|
+
const response = await _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
9544
9903
|
project_name: projectName
|
|
9545
9904
|
});
|
|
9546
9905
|
const result = _v3.z.object({
|
|
9547
|
-
project:
|
|
9906
|
+
project: _chunkSU6EHKJVjs.Project
|
|
9548
9907
|
}).parse(response);
|
|
9549
9908
|
const projectId = result.project.id;
|
|
9550
9909
|
this.nameToId[projectName] = projectId;
|
|
@@ -9554,10 +9913,10 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9554
9913
|
}
|
|
9555
9914
|
async getName(projectId) {
|
|
9556
9915
|
if (!(projectId in this.idToName)) {
|
|
9557
|
-
const response = await
|
|
9916
|
+
const response = await _chunkSU6EHKJVjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
9558
9917
|
id: projectId
|
|
9559
9918
|
});
|
|
9560
|
-
const result = _v3.z.array(
|
|
9919
|
+
const result = _v3.z.array(_chunkSU6EHKJVjs.Project).nonempty().parse(response);
|
|
9561
9920
|
const projectName = result[0].name;
|
|
9562
9921
|
this.idToName[projectId] = projectName;
|
|
9563
9922
|
this.nameToId[projectName] = projectId;
|
|
@@ -9577,16 +9936,16 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9577
9936
|
var evalBodySchema = _v3.z.object({
|
|
9578
9937
|
name: _v3.z.string(),
|
|
9579
9938
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
9580
|
-
data:
|
|
9939
|
+
data: _chunkSU6EHKJVjs.RunEval.shape.data,
|
|
9581
9940
|
scores: _v3.z.array(
|
|
9582
9941
|
_v3.z.object({
|
|
9583
|
-
function_id:
|
|
9942
|
+
function_id: _chunkSU6EHKJVjs.FunctionId,
|
|
9584
9943
|
name: _v3.z.string()
|
|
9585
9944
|
})
|
|
9586
9945
|
).nullish(),
|
|
9587
9946
|
experiment_name: _v3.z.string().nullish(),
|
|
9588
9947
|
project_id: _v3.z.string().nullish(),
|
|
9589
|
-
parent:
|
|
9948
|
+
parent: _chunkSU6EHKJVjs.InvokeParent.optional(),
|
|
9590
9949
|
stream: _v3.z.boolean().optional()
|
|
9591
9950
|
});
|
|
9592
9951
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -9594,7 +9953,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
9594
9953
|
_v3.z.union([
|
|
9595
9954
|
_v3.z.object({
|
|
9596
9955
|
type: _v3.z.literal("prompt"),
|
|
9597
|
-
default:
|
|
9956
|
+
default: _chunkSU6EHKJVjs.PromptData.optional(),
|
|
9598
9957
|
description: _v3.z.string().optional()
|
|
9599
9958
|
}),
|
|
9600
9959
|
_v3.z.object({
|
|
@@ -9650,7 +10009,7 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
9650
10009
|
);
|
|
9651
10010
|
|
|
9652
10011
|
// src/node/index.ts
|
|
9653
|
-
|
|
10012
|
+
_chunkSU6EHKJVjs.configureNode.call(void 0, );
|
|
9654
10013
|
|
|
9655
10014
|
|
|
9656
10015
|
|
|
@@ -9821,4 +10180,4 @@ _chunkB6ZQIAK3js.configureNode.call(void 0, );
|
|
|
9821
10180
|
|
|
9822
10181
|
|
|
9823
10182
|
|
|
9824
|
-
exports.Attachment =
|
|
10183
|
+
exports.Attachment = _chunkSU6EHKJVjs.Attachment; exports.AttachmentReference = _chunkSU6EHKJVjs.AttachmentReference; exports.BAGGAGE_HEADER = _chunkSU6EHKJVjs.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkSU6EHKJVjs.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkSU6EHKJVjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkSU6EHKJVjs.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkSU6EHKJVjs.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = _chunkSU6EHKJVjs.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkSU6EHKJVjs.BraintrustObservabilityExporter; exports.BraintrustState = _chunkSU6EHKJVjs.BraintrustState; exports.BraintrustStream = _chunkSU6EHKJVjs.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkSU6EHKJVjs.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkSU6EHKJVjs.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkSU6EHKJVjs.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkSU6EHKJVjs.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = _chunkSU6EHKJVjs.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkSU6EHKJVjs.Experiment; exports.ExternalAttachment = _chunkSU6EHKJVjs.ExternalAttachment; exports.FailedHTTPResponse = _chunkSU6EHKJVjs.FailedHTTPResponse; exports.IDGenerator = _chunkSU6EHKJVjs.IDGenerator; exports.JSONAttachment = _chunkSU6EHKJVjs.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkSU6EHKJVjs.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkSU6EHKJVjs.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkSU6EHKJVjs.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkSU6EHKJVjs.Logger; exports.LoginInvalidOrgError = _chunkSU6EHKJVjs.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkSU6EHKJVjs.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkSU6EHKJVjs.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkSU6EHKJVjs.NoopSpan; exports.OTELIDGenerator = _chunkSU6EHKJVjs.OTELIDGenerator; exports.ObjectFetcher = _chunkSU6EHKJVjs.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkSU6EHKJVjs.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkSU6EHKJVjs.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkSU6EHKJVjs.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkSU6EHKJVjs.SpanImpl; exports.TRACEPARENT_HEADER = _chunkSU6EHKJVjs.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkSU6EHKJVjs.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkSU6EHKJVjs.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkSU6EHKJVjs.UUIDGenerator; exports.X_CACHED_HEADER = _chunkSU6EHKJVjs.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkSU6EHKJVjs._exportsForTestingOnly; exports._internalGetGlobalState = _chunkSU6EHKJVjs._internalGetGlobalState; exports._internalIso = _chunk7AUY2XWXjs.isomorph_default; exports._internalSetInitialState = _chunkSU6EHKJVjs._internalSetInitialState; exports.addAzureBlobHeaders = _chunkSU6EHKJVjs.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkSU6EHKJVjs.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkSU6EHKJVjs.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkSU6EHKJVjs.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkSU6EHKJVjs.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = _chunkSU6EHKJVjs.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkSU6EHKJVjs.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkSU6EHKJVjs.createFinalValuePassThroughStream; exports.currentExperiment = _chunkSU6EHKJVjs.currentExperiment; exports.currentLogger = _chunkSU6EHKJVjs.currentLogger; exports.currentSpan = _chunkSU6EHKJVjs.currentSpan; exports.deepCopyEvent = _chunkSU6EHKJVjs.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = _chunkSU6EHKJVjs.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkSU6EHKJVjs.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkSU6EHKJVjs.extractTraceContextFromHeaders; exports.flush = _chunkSU6EHKJVjs.flush; exports.getContextManager = _chunkSU6EHKJVjs.getContextManager; exports.getIdGenerator = _chunkSU6EHKJVjs.getIdGenerator; exports.getPromptVersions = _chunkSU6EHKJVjs.getPromptVersions; exports.getSpanParentObject = _chunkSU6EHKJVjs.getSpanParentObject; exports.getTemplateRenderer = _chunkSU6EHKJVjs.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkSU6EHKJVjs.init; exports.initDataset = _chunkSU6EHKJVjs.initDataset; exports.initExperiment = _chunkSU6EHKJVjs.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkSU6EHKJVjs.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkSU6EHKJVjs.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkSU6EHKJVjs.isTemplateFormat; exports.loadParameters = _chunkSU6EHKJVjs.loadParameters; exports.loadPrompt = _chunkSU6EHKJVjs.loadPrompt; exports.log = _chunkSU6EHKJVjs.log; exports.logError = _chunkSU6EHKJVjs.logError; exports.login = _chunkSU6EHKJVjs.login; exports.loginToState = _chunkSU6EHKJVjs.loginToState; exports.logs3OverflowUploadSchema = _chunkSU6EHKJVjs.logs3OverflowUploadSchema; exports.newId = _chunkSU6EHKJVjs.newId; exports.parseCachedHeader = _chunkSU6EHKJVjs.parseCachedHeader; exports.parseTemplateFormat = _chunkSU6EHKJVjs.parseTemplateFormat; exports.permalink = _chunkSU6EHKJVjs.permalink; exports.pickLogs3OverflowObjectIds = _chunkSU6EHKJVjs.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkSU6EHKJVjs.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkSU6EHKJVjs.registerTemplatePlugin; exports.renderMessage = _chunkSU6EHKJVjs.renderMessage; exports.renderPromptParams = _chunkSU6EHKJVjs.renderPromptParams; exports.renderTemplateContent = _chunkSU6EHKJVjs.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkSU6EHKJVjs.setFetch; exports.setMaskingFunction = _chunkSU6EHKJVjs.setMaskingFunction; exports.spanComponentsToObjectId = _chunkSU6EHKJVjs.spanComponentsToObjectId; exports.startSpan = _chunkSU6EHKJVjs.startSpan; exports.summarize = _chunkSU6EHKJVjs.summarize; exports.templateRegistry = _chunkSU6EHKJVjs.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkSU6EHKJVjs.ToolFunctionDefinition; exports.traceable = _chunkSU6EHKJVjs.traceable; exports.traced = _chunkSU6EHKJVjs.traced; exports.updateSpan = _chunkSU6EHKJVjs.updateSpan; exports.uploadLogs3OverflowPayload = _chunkSU6EHKJVjs.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkSU6EHKJVjs.utf8ByteLength; exports.withCurrent = _chunkSU6EHKJVjs.withCurrent; exports.withDataset = _chunkSU6EHKJVjs.withDataset; exports.withExperiment = _chunkSU6EHKJVjs.withExperiment; exports.withLogger = _chunkSU6EHKJVjs.withLogger; exports.withParent = _chunkSU6EHKJVjs.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkSU6EHKJVjs.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkSU6EHKJVjs.wrapTraced; exports.wrapVitest = wrapVitest;
|