braintrust 3.12.0 → 3.13.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 +25 -6
- package/dev/dist/index.d.ts +25 -6
- package/dev/dist/index.js +134 -43
- package/dev/dist/index.mjs +113 -22
- package/dist/apply-auto-instrumentation.js +170 -170
- package/dist/apply-auto-instrumentation.mjs +1 -1
- package/dist/auto-instrumentations/bundler/esbuild.cjs +1 -0
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +1 -0
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +1 -0
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +1 -0
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1 -0
- package/dist/auto-instrumentations/bundler/webpack.cjs +1 -0
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-2DPA74KK.mjs → chunk-E5DUYJWK.mjs} +1 -0
- package/dist/auto-instrumentations/{chunk-73BZUKVI.mjs → chunk-GJOO4ESL.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-AFXRW7I7.mjs → chunk-WFEUJACP.mjs} +1 -1
- package/dist/auto-instrumentations/hook.mjs +1 -0
- package/dist/auto-instrumentations/index.cjs +1 -0
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +149 -21
- package/dist/browser.d.ts +149 -21
- package/dist/browser.js +114 -24
- package/dist/browser.mjs +114 -24
- package/dist/{chunk-BW4DF4CY.js → chunk-26JGOELH.js} +1 -0
- package/dist/{chunk-MSLBGITU.mjs → chunk-75IQCUB2.mjs} +1 -0
- package/dist/cli.js +121 -44
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +114 -24
- package/dist/edge-light.mjs +114 -24
- package/dist/index.d.mts +149 -21
- package/dist/index.d.ts +149 -21
- package/dist/index.js +529 -394
- package/dist/index.mjs +161 -26
- package/dist/instrumentation/index.d.mts +40 -3
- package/dist/instrumentation/index.d.ts +40 -3
- package/dist/instrumentation/index.js +15 -2
- package/dist/instrumentation/index.mjs +15 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +114 -24
- package/dist/workerd.mjs +114 -24
- package/package.json +3 -17
- package/util/dist/index.d.mts +3 -1
- package/util/dist/index.d.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunk26JGOELHjs = require('./chunk-26JGOELH.js');
|
|
28
28
|
|
|
29
29
|
// src/node/config.ts
|
|
30
30
|
var _nodeasync_hooks = require('node:async_hooks');
|
|
@@ -36,6 +36,7 @@ var _nodefs = require('node:fs'); var fsSync = _interopRequireWildcard(_nodefs);
|
|
|
36
36
|
var _nodecrypto = require('node:crypto'); var crypto = _interopRequireWildcard(_nodecrypto);
|
|
37
37
|
var _nodeutil = require('node:util');
|
|
38
38
|
var _nodezlib = require('node:zlib'); var zlib = _interopRequireWildcard(_nodezlib);
|
|
39
|
+
var _dotenv = require('dotenv'); var dotenv = _interopRequireWildcard(_dotenv);
|
|
39
40
|
|
|
40
41
|
// src/debug-logger.ts
|
|
41
42
|
var PREFIX = "[braintrust]";
|
|
@@ -80,7 +81,7 @@ function parseDebugLogLevelEnv(value) {
|
|
|
80
81
|
return void 0;
|
|
81
82
|
}
|
|
82
83
|
function getEnvDebugLogLevel() {
|
|
83
|
-
return parseDebugLogLevelEnv(
|
|
84
|
+
return parseDebugLogLevelEnv(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_DEBUG_LOG_LEVEL"));
|
|
84
85
|
}
|
|
85
86
|
function setGlobalDebugLogLevel(level) {
|
|
86
87
|
globalThis[DEBUG_LOG_LEVEL_SYMBOL] = level;
|
|
@@ -347,9 +348,9 @@ function getCallerLocation() {
|
|
|
347
348
|
const entries = getStackTrace();
|
|
348
349
|
for (const frame of entries) {
|
|
349
350
|
if (thisDir === void 0) {
|
|
350
|
-
thisDir = _optionalChain([
|
|
351
|
+
thisDir = _optionalChain([_chunk26JGOELHjs.isomorph_default, 'access', _12 => _12.pathDirname, 'optionalCall', _13 => _13(frame.fileName)]);
|
|
351
352
|
}
|
|
352
|
-
if (_optionalChain([
|
|
353
|
+
if (_optionalChain([_chunk26JGOELHjs.isomorph_default, 'access', _14 => _14.pathDirname, 'optionalCall', _15 => _15(frame.fileName)]) !== thisDir) {
|
|
353
354
|
return {
|
|
354
355
|
caller_functionname: frame.functionName,
|
|
355
356
|
caller_filename: frame.fileName,
|
|
@@ -3941,7 +3942,7 @@ function devNullWritableStream() {
|
|
|
3941
3942
|
|
|
3942
3943
|
// src/prompt-cache/disk-cache.ts
|
|
3943
3944
|
function canUseDiskCache() {
|
|
3944
|
-
return !!(
|
|
3945
|
+
return !!(_chunk26JGOELHjs.isomorph_default.hash && _chunk26JGOELHjs.isomorph_default.gunzip && _chunk26JGOELHjs.isomorph_default.gzip && _chunk26JGOELHjs.isomorph_default.stat && _chunk26JGOELHjs.isomorph_default.readFile && _chunk26JGOELHjs.isomorph_default.writeFile && _chunk26JGOELHjs.isomorph_default.utimes && _chunk26JGOELHjs.isomorph_default.readdir && _chunk26JGOELHjs.isomorph_default.mkdir && _chunk26JGOELHjs.isomorph_default.unlink && _chunk26JGOELHjs.isomorph_default.homedir);
|
|
3945
3946
|
}
|
|
3946
3947
|
var DiskCache = class {
|
|
3947
3948
|
|
|
@@ -3962,8 +3963,8 @@ var DiskCache = class {
|
|
|
3962
3963
|
this.mkdir = _nullishCoalesce(options.mkdir, () => ( true));
|
|
3963
3964
|
}
|
|
3964
3965
|
getEntryPath(key) {
|
|
3965
|
-
const hashed =
|
|
3966
|
-
return
|
|
3966
|
+
const hashed = _chunk26JGOELHjs.isomorph_default.hash(key);
|
|
3967
|
+
return _chunk26JGOELHjs.isomorph_default.pathJoin(this.dir, hashed);
|
|
3967
3968
|
}
|
|
3968
3969
|
/**
|
|
3969
3970
|
* Retrieves a value from the cache.
|
|
@@ -3975,8 +3976,8 @@ var DiskCache = class {
|
|
|
3975
3976
|
async get(key) {
|
|
3976
3977
|
try {
|
|
3977
3978
|
const filePath = this.getEntryPath(key);
|
|
3978
|
-
const data = await
|
|
3979
|
-
await
|
|
3979
|
+
const data = await _chunk26JGOELHjs.isomorph_default.gunzip(await _chunk26JGOELHjs.isomorph_default.readFile(filePath));
|
|
3980
|
+
await _chunk26JGOELHjs.isomorph_default.utimes(filePath, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
|
3980
3981
|
return JSON.parse(data.toString());
|
|
3981
3982
|
} catch (e) {
|
|
3982
3983
|
if (e.code === "ENOENT") {
|
|
@@ -3998,11 +3999,11 @@ var DiskCache = class {
|
|
|
3998
3999
|
async set(key, value) {
|
|
3999
4000
|
try {
|
|
4000
4001
|
if (this.mkdir) {
|
|
4001
|
-
await
|
|
4002
|
+
await _chunk26JGOELHjs.isomorph_default.mkdir(this.dir, { recursive: true });
|
|
4002
4003
|
}
|
|
4003
4004
|
const filePath = this.getEntryPath(key);
|
|
4004
|
-
const data = await
|
|
4005
|
-
await
|
|
4005
|
+
const data = await _chunk26JGOELHjs.isomorph_default.gzip(JSON.stringify(value));
|
|
4006
|
+
await _chunk26JGOELHjs.isomorph_default.writeFile(filePath, data);
|
|
4006
4007
|
await this.evictOldestIfFull();
|
|
4007
4008
|
} catch (e) {
|
|
4008
4009
|
if (this.logWarnings) {
|
|
@@ -4015,14 +4016,14 @@ var DiskCache = class {
|
|
|
4015
4016
|
if (!this.max) {
|
|
4016
4017
|
return;
|
|
4017
4018
|
}
|
|
4018
|
-
const files = await
|
|
4019
|
-
const paths = files.map((file) =>
|
|
4019
|
+
const files = await _chunk26JGOELHjs.isomorph_default.readdir(this.dir);
|
|
4020
|
+
const paths = files.map((file) => _chunk26JGOELHjs.isomorph_default.pathJoin(this.dir, file));
|
|
4020
4021
|
if (paths.length <= this.max) {
|
|
4021
4022
|
return;
|
|
4022
4023
|
}
|
|
4023
4024
|
const stats = await Promise.all(
|
|
4024
4025
|
paths.map(async (path2) => {
|
|
4025
|
-
const stat2 = await
|
|
4026
|
+
const stat2 = await _chunk26JGOELHjs.isomorph_default.stat(path2);
|
|
4026
4027
|
return {
|
|
4027
4028
|
path: path2,
|
|
4028
4029
|
mtime: stat2.mtime.getTime()
|
|
@@ -4031,7 +4032,7 @@ var DiskCache = class {
|
|
|
4031
4032
|
);
|
|
4032
4033
|
stats.sort((a, b) => a.mtime - b.mtime);
|
|
4033
4034
|
const toRemove = stats.slice(0, stats.length - this.max);
|
|
4034
|
-
await Promise.all(toRemove.map((stat2) =>
|
|
4035
|
+
await Promise.all(toRemove.map((stat2) => _chunk26JGOELHjs.isomorph_default.unlink(stat2.path)));
|
|
4035
4036
|
}
|
|
4036
4037
|
};
|
|
4037
4038
|
|
|
@@ -4192,7 +4193,7 @@ var ParametersCache = class {
|
|
|
4192
4193
|
var activeCaches = /* @__PURE__ */ new Set();
|
|
4193
4194
|
var exitHandlersRegistered = false;
|
|
4194
4195
|
function canUseSpanCache() {
|
|
4195
|
-
return !!(
|
|
4196
|
+
return !!(_chunk26JGOELHjs.isomorph_default.pathJoin && _chunk26JGOELHjs.isomorph_default.tmpdir && _chunk26JGOELHjs.isomorph_default.writeFileSync && _chunk26JGOELHjs.isomorph_default.appendFileSync && _chunk26JGOELHjs.isomorph_default.readFileSync && _chunk26JGOELHjs.isomorph_default.unlinkSync && _chunk26JGOELHjs.isomorph_default.openFile);
|
|
4196
4197
|
}
|
|
4197
4198
|
var SpanCache = (_class5 = class {
|
|
4198
4199
|
__init7() {this.cacheFilePath = null}
|
|
@@ -4257,16 +4258,16 @@ var SpanCache = (_class5 = class {
|
|
|
4257
4258
|
return this.initPromise;
|
|
4258
4259
|
}
|
|
4259
4260
|
this.initPromise = (async () => {
|
|
4260
|
-
if (!
|
|
4261
|
+
if (!_chunk26JGOELHjs.isomorph_default.tmpdir || !_chunk26JGOELHjs.isomorph_default.pathJoin || !_chunk26JGOELHjs.isomorph_default.openFile) {
|
|
4261
4262
|
return;
|
|
4262
4263
|
}
|
|
4263
|
-
const tmpDir =
|
|
4264
|
+
const tmpDir = _chunk26JGOELHjs.isomorph_default.tmpdir();
|
|
4264
4265
|
const uniqueId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
4265
|
-
this.cacheFilePath =
|
|
4266
|
+
this.cacheFilePath = _chunk26JGOELHjs.isomorph_default.pathJoin(
|
|
4266
4267
|
tmpDir,
|
|
4267
4268
|
`braintrust-span-cache-${uniqueId}.jsonl`
|
|
4268
4269
|
);
|
|
4269
|
-
this.fileHandle = await
|
|
4270
|
+
this.fileHandle = await _chunk26JGOELHjs.isomorph_default.openFile(this.cacheFilePath, "a+");
|
|
4270
4271
|
this.initialized = true;
|
|
4271
4272
|
this.registerExitHandler();
|
|
4272
4273
|
})();
|
|
@@ -4290,9 +4291,9 @@ var SpanCache = (_class5 = class {
|
|
|
4290
4291
|
} catch (e12) {
|
|
4291
4292
|
}
|
|
4292
4293
|
}
|
|
4293
|
-
if (cache.cacheFilePath && canUseSpanCache() &&
|
|
4294
|
+
if (cache.cacheFilePath && canUseSpanCache() && _chunk26JGOELHjs.isomorph_default.unlinkSync) {
|
|
4294
4295
|
try {
|
|
4295
|
-
|
|
4296
|
+
_chunk26JGOELHjs.isomorph_default.unlinkSync(cache.cacheFilePath);
|
|
4296
4297
|
} catch (e13) {
|
|
4297
4298
|
}
|
|
4298
4299
|
}
|
|
@@ -4371,9 +4372,9 @@ var SpanCache = (_class5 = class {
|
|
|
4371
4372
|
return void 0;
|
|
4372
4373
|
}
|
|
4373
4374
|
const spanMap = /* @__PURE__ */ new Map();
|
|
4374
|
-
if (this.initialized && this.cacheFilePath &&
|
|
4375
|
+
if (this.initialized && this.cacheFilePath && _chunk26JGOELHjs.isomorph_default.readFileSync) {
|
|
4375
4376
|
try {
|
|
4376
|
-
const content =
|
|
4377
|
+
const content = _chunk26JGOELHjs.isomorph_default.readFileSync(this.cacheFilePath, "utf8");
|
|
4377
4378
|
const lines = content.trim().split("\n").filter(Boolean);
|
|
4378
4379
|
for (const line of lines) {
|
|
4379
4380
|
try {
|
|
@@ -4462,9 +4463,9 @@ var SpanCache = (_class5 = class {
|
|
|
4462
4463
|
});
|
|
4463
4464
|
this.fileHandle = null;
|
|
4464
4465
|
}
|
|
4465
|
-
if (this.cacheFilePath && canUseSpanCache() &&
|
|
4466
|
+
if (this.cacheFilePath && canUseSpanCache() && _chunk26JGOELHjs.isomorph_default.unlinkSync) {
|
|
4466
4467
|
try {
|
|
4467
|
-
|
|
4468
|
+
_chunk26JGOELHjs.isomorph_default.unlinkSync(this.cacheFilePath);
|
|
4468
4469
|
} catch (e16) {
|
|
4469
4470
|
}
|
|
4470
4471
|
this.cacheFilePath = null;
|
|
@@ -4577,7 +4578,7 @@ var BraintrustContextManager = class extends ContextManager {
|
|
|
4577
4578
|
|
|
4578
4579
|
constructor() {
|
|
4579
4580
|
super();
|
|
4580
|
-
this._currentSpan =
|
|
4581
|
+
this._currentSpan = _chunk26JGOELHjs.isomorph_default.newAsyncLocalStorage();
|
|
4581
4582
|
this[BRAINTRUST_CURRENT_SPAN_STORE] = this._currentSpan;
|
|
4582
4583
|
}
|
|
4583
4584
|
getParentSpanIds() {
|
|
@@ -4690,8 +4691,8 @@ var BraintrustState = (_class7 = class _BraintrustState {
|
|
|
4690
4691
|
this.id = `${(/* @__PURE__ */ new Date()).toLocaleString()}-${stateNonce++}`;
|
|
4691
4692
|
this.currentExperiment = void 0;
|
|
4692
4693
|
this.currentLogger = void 0;
|
|
4693
|
-
this.currentParent =
|
|
4694
|
-
this.currentSpan =
|
|
4694
|
+
this.currentParent = _chunk26JGOELHjs.isomorph_default.newAsyncLocalStorage();
|
|
4695
|
+
this.currentSpan = _chunk26JGOELHjs.isomorph_default.newAsyncLocalStorage();
|
|
4695
4696
|
if (loginParams.fetch) {
|
|
4696
4697
|
this.fetch = loginParams.fetch;
|
|
4697
4698
|
}
|
|
@@ -4714,19 +4715,19 @@ var BraintrustState = (_class7 = class _BraintrustState {
|
|
|
4714
4715
|
}
|
|
4715
4716
|
this.resetLoginInfo();
|
|
4716
4717
|
const memoryCache = new LRUCache({
|
|
4717
|
-
max: _nullishCoalesce(Number(
|
|
4718
|
+
max: _nullishCoalesce(Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PROMPT_CACHE_MEMORY_MAX")), () => ( 1 << 10))
|
|
4718
4719
|
});
|
|
4719
4720
|
const diskCache = canUseDiskCache() ? new DiskCache({
|
|
4720
|
-
cacheDir: _nullishCoalesce(
|
|
4721
|
-
max: _nullishCoalesce(Number(
|
|
4721
|
+
cacheDir: _nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PROMPT_CACHE_DIR"), () => ( `${_nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("HOME"), () => ( _chunk26JGOELHjs.isomorph_default.homedir()))}/.braintrust/prompt_cache`)),
|
|
4722
|
+
max: _nullishCoalesce(Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PROMPT_CACHE_DISK_MAX")), () => ( 1 << 20))
|
|
4722
4723
|
}) : void 0;
|
|
4723
4724
|
this.promptCache = new PromptCache({ memoryCache, diskCache });
|
|
4724
4725
|
const parametersMemoryCache = new LRUCache({
|
|
4725
|
-
max: _nullishCoalesce(Number(
|
|
4726
|
+
max: _nullishCoalesce(Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PARAMETERS_CACHE_MEMORY_MAX")), () => ( 1 << 10))
|
|
4726
4727
|
});
|
|
4727
4728
|
const parametersDiskCache = canUseDiskCache() ? new DiskCache({
|
|
4728
|
-
cacheDir: _nullishCoalesce(
|
|
4729
|
-
max: _nullishCoalesce(Number(
|
|
4729
|
+
cacheDir: _nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PARAMETERS_CACHE_DIR"), () => ( `${_nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("HOME"), () => ( _chunk26JGOELHjs.isomorph_default.homedir()))}/.braintrust/parameters_cache`)),
|
|
4730
|
+
max: _nullishCoalesce(Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PARAMETERS_CACHE_DISK_MAX")), () => ( 1 << 20))
|
|
4730
4731
|
}) : void 0;
|
|
4731
4732
|
this.parametersCache = new ParametersCache({
|
|
4732
4733
|
memoryCache: parametersMemoryCache,
|
|
@@ -5367,7 +5368,7 @@ var Attachment = class extends BaseAttachment {
|
|
|
5367
5368
|
initData(data) {
|
|
5368
5369
|
if (typeof data === "string") {
|
|
5369
5370
|
this.ensureFileReadable(data);
|
|
5370
|
-
const readFile2 =
|
|
5371
|
+
const readFile2 = _chunk26JGOELHjs.isomorph_default.readFile;
|
|
5371
5372
|
if (!readFile2) {
|
|
5372
5373
|
throw new Error(
|
|
5373
5374
|
`This platform does not support reading the filesystem. Construct the Attachment
|
|
@@ -5380,7 +5381,7 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
|
|
|
5380
5381
|
}
|
|
5381
5382
|
}
|
|
5382
5383
|
ensureFileReadable(data) {
|
|
5383
|
-
const statSync2 =
|
|
5384
|
+
const statSync2 = _chunk26JGOELHjs.isomorph_default.statSync;
|
|
5384
5385
|
if (!statSync2) {
|
|
5385
5386
|
throw new Error(
|
|
5386
5387
|
`This platform does not support reading the filesystem. Construct the Attachment
|
|
@@ -5580,6 +5581,19 @@ var JSONAttachment = class extends Attachment {
|
|
|
5580
5581
|
*/
|
|
5581
5582
|
constructor(data, options) {
|
|
5582
5583
|
const { filename = "data.json", pretty = false, state } = _nullishCoalesce(options, () => ( {}));
|
|
5584
|
+
const deferredJsonAttachment = globalThis.__BT_DATASET_PIPELINE_DEFER_JSON_ATTACHMENT__;
|
|
5585
|
+
if (deferredJsonAttachment) {
|
|
5586
|
+
super({
|
|
5587
|
+
data: new Blob([]),
|
|
5588
|
+
filename,
|
|
5589
|
+
contentType: "application/json",
|
|
5590
|
+
state
|
|
5591
|
+
});
|
|
5592
|
+
return deferredJsonAttachment(data, {
|
|
5593
|
+
filename,
|
|
5594
|
+
pretty
|
|
5595
|
+
});
|
|
5596
|
+
}
|
|
5583
5597
|
const jsonString = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
5584
5598
|
const blob = new Blob([jsonString], { type: "application/json" });
|
|
5585
5599
|
super({
|
|
@@ -5755,10 +5769,10 @@ function getErrPermlink(msg) {
|
|
|
5755
5769
|
return `${ERR_PERMALINK}?msg=${encodeURIComponent(msg)}`;
|
|
5756
5770
|
}
|
|
5757
5771
|
function _getAppUrl(appUrl) {
|
|
5758
|
-
return appUrl ||
|
|
5772
|
+
return appUrl || _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_APP_URL") || "https://www.braintrust.dev";
|
|
5759
5773
|
}
|
|
5760
5774
|
function _getOrgName(orgName) {
|
|
5761
|
-
return orgName ||
|
|
5775
|
+
return orgName || _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_ORG_NAME") || void 0;
|
|
5762
5776
|
}
|
|
5763
5777
|
function _getLinkBaseUrl(state, linkArgs) {
|
|
5764
5778
|
const appUrl = _getAppUrl(state.appUrl || _optionalChain([linkArgs, 'optionalAccess', _53 => _53.app_url]));
|
|
@@ -6242,62 +6256,62 @@ var HTTPBackgroundLogger = (_class10 = class _HTTPBackgroundLogger {
|
|
|
6242
6256
|
constructor(apiConn, opts) {;_class10.prototype.__init38.call(this);_class10.prototype.__init39.call(this);_class10.prototype.__init40.call(this);_class10.prototype.__init41.call(this);_class10.prototype.__init42.call(this);_class10.prototype.__init43.call(this);_class10.prototype.__init44.call(this);_class10.prototype.__init45.call(this);_class10.prototype.__init46.call(this);_class10.prototype.__init47.call(this);_class10.prototype.__init48.call(this);_class10.prototype.__init49.call(this);_class10.prototype.__init50.call(this);_class10.prototype.__init51.call(this);_class10.prototype.__init52.call(this);_class10.prototype.__init53.call(this);_class10.prototype.__init54.call(this);
|
|
6243
6257
|
opts = _nullishCoalesce(opts, () => ( {}));
|
|
6244
6258
|
this.apiConn = apiConn;
|
|
6245
|
-
const syncFlushEnv = Number(
|
|
6259
|
+
const syncFlushEnv = Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_SYNC_FLUSH"));
|
|
6246
6260
|
if (!isNaN(syncFlushEnv)) {
|
|
6247
6261
|
this.syncFlush = Boolean(syncFlushEnv);
|
|
6248
6262
|
}
|
|
6249
6263
|
const defaultBatchSizeEnv = Number(
|
|
6250
|
-
|
|
6264
|
+
_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_DEFAULT_BATCH_SIZE")
|
|
6251
6265
|
);
|
|
6252
6266
|
if (!isNaN(defaultBatchSizeEnv)) {
|
|
6253
6267
|
this.defaultBatchSize = defaultBatchSizeEnv;
|
|
6254
6268
|
}
|
|
6255
|
-
const maxRequestSizeEnv = Number(
|
|
6269
|
+
const maxRequestSizeEnv = Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_MAX_REQUEST_SIZE"));
|
|
6256
6270
|
if (!isNaN(maxRequestSizeEnv)) {
|
|
6257
6271
|
this.maxRequestSizeOverride = maxRequestSizeEnv;
|
|
6258
6272
|
}
|
|
6259
|
-
const numTriesEnv = Number(
|
|
6273
|
+
const numTriesEnv = Number(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_NUM_RETRIES"));
|
|
6260
6274
|
if (!isNaN(numTriesEnv)) {
|
|
6261
6275
|
this.numTries = numTriesEnv + 1;
|
|
6262
6276
|
}
|
|
6263
6277
|
const queueDropExceedingMaxsizeEnv = Number(
|
|
6264
|
-
|
|
6278
|
+
_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_QUEUE_DROP_EXCEEDING_MAXSIZE")
|
|
6265
6279
|
);
|
|
6266
6280
|
if (!isNaN(queueDropExceedingMaxsizeEnv)) {
|
|
6267
6281
|
this.queueDropExceedingMaxsize = queueDropExceedingMaxsizeEnv;
|
|
6268
6282
|
}
|
|
6269
6283
|
this.queue = new Queue(this.queueDropExceedingMaxsize);
|
|
6270
6284
|
const queueDropLoggingPeriodEnv = Number(
|
|
6271
|
-
|
|
6285
|
+
_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_QUEUE_DROP_LOGGING_PERIOD")
|
|
6272
6286
|
);
|
|
6273
6287
|
if (!isNaN(queueDropLoggingPeriodEnv)) {
|
|
6274
6288
|
this.queueDropLoggingPeriod = queueDropLoggingPeriodEnv;
|
|
6275
6289
|
}
|
|
6276
|
-
if (
|
|
6290
|
+
if (_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_LOG_FLUSH_CHUNK_SIZE")) {
|
|
6277
6291
|
debugLogger.warn(
|
|
6278
6292
|
"BRAINTRUST_LOG_FLUSH_CHUNK_SIZE is deprecated and no longer has any effect. Log flushing now sends all items at once and batches them automatically. This environment variable will be removed in a future major release."
|
|
6279
6293
|
);
|
|
6280
6294
|
}
|
|
6281
6295
|
const flushBackpressureBytesEnv = Number(
|
|
6282
|
-
|
|
6296
|
+
_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_FLUSH_BACKPRESSURE_BYTES")
|
|
6283
6297
|
);
|
|
6284
6298
|
if (!isNaN(flushBackpressureBytesEnv) && flushBackpressureBytesEnv > 0) {
|
|
6285
6299
|
this._flushBackpressureBytes = flushBackpressureBytesEnv;
|
|
6286
6300
|
}
|
|
6287
|
-
const failedPublishPayloadsDirEnv =
|
|
6301
|
+
const failedPublishPayloadsDirEnv = _chunk26JGOELHjs.isomorph_default.getEnv(
|
|
6288
6302
|
"BRAINTRUST_FAILED_PUBLISH_PAYLOADS_DIR"
|
|
6289
6303
|
);
|
|
6290
6304
|
if (failedPublishPayloadsDirEnv) {
|
|
6291
6305
|
this.failedPublishPayloadsDir = failedPublishPayloadsDirEnv;
|
|
6292
6306
|
}
|
|
6293
|
-
const allPublishPayloadsDirEnv =
|
|
6307
|
+
const allPublishPayloadsDirEnv = _chunk26JGOELHjs.isomorph_default.getEnv(
|
|
6294
6308
|
"BRAINTRUST_ALL_PUBLISH_PAYLOADS_DIR"
|
|
6295
6309
|
);
|
|
6296
6310
|
if (allPublishPayloadsDirEnv) {
|
|
6297
6311
|
this.allPublishPayloadsDir = allPublishPayloadsDirEnv;
|
|
6298
6312
|
}
|
|
6299
6313
|
if (!opts.noExitFlush) {
|
|
6300
|
-
|
|
6314
|
+
_chunk26JGOELHjs.isomorph_default.processOn("beforeExit", async () => {
|
|
6301
6315
|
await this.flush();
|
|
6302
6316
|
});
|
|
6303
6317
|
}
|
|
@@ -6655,19 +6669,19 @@ Error: ${errorText}`;
|
|
|
6655
6669
|
payloadDir,
|
|
6656
6670
|
payload
|
|
6657
6671
|
}) {
|
|
6658
|
-
if (!(
|
|
6672
|
+
if (!(_chunk26JGOELHjs.isomorph_default.pathJoin && _chunk26JGOELHjs.isomorph_default.mkdir && _chunk26JGOELHjs.isomorph_default.writeFile)) {
|
|
6659
6673
|
debugLogger.warn(
|
|
6660
6674
|
"Cannot dump payloads: filesystem-operations not supported on this platform"
|
|
6661
6675
|
);
|
|
6662
6676
|
return;
|
|
6663
6677
|
}
|
|
6664
|
-
const payloadFile =
|
|
6678
|
+
const payloadFile = _chunk26JGOELHjs.isomorph_default.pathJoin(
|
|
6665
6679
|
payloadDir,
|
|
6666
6680
|
`payload_${getCurrentUnixTimestamp()}_${_uuid.v4.call(void 0, ).slice(0, 8)}.json`
|
|
6667
6681
|
);
|
|
6668
6682
|
try {
|
|
6669
|
-
await
|
|
6670
|
-
await
|
|
6683
|
+
await _chunk26JGOELHjs.isomorph_default.mkdir(payloadDir, { recursive: true });
|
|
6684
|
+
await _chunk26JGOELHjs.isomorph_default.writeFile(payloadFile, payload);
|
|
6671
6685
|
} catch (e) {
|
|
6672
6686
|
debugLogger.error(
|
|
6673
6687
|
`Failed to write failed payload to output file ${payloadFile}:
|
|
@@ -6849,7 +6863,7 @@ function init(projectOrOptions, optionalOptions) {
|
|
|
6849
6863
|
state.gitMetadataSettings,
|
|
6850
6864
|
_nullishCoalesce(gitMetadataSettings, () => ( { collect: "all" }))
|
|
6851
6865
|
);
|
|
6852
|
-
return await
|
|
6866
|
+
return await _chunk26JGOELHjs.isomorph_default.getRepoInfo(mergedGitMetadataSettings);
|
|
6853
6867
|
})();
|
|
6854
6868
|
if (repoInfoArg) {
|
|
6855
6869
|
args["repo_info"] = repoInfoArg;
|
|
@@ -6859,7 +6873,7 @@ function init(projectOrOptions, optionalOptions) {
|
|
|
6859
6873
|
} else if (baseExperiment) {
|
|
6860
6874
|
args["base_experiment"] = baseExperiment;
|
|
6861
6875
|
} else {
|
|
6862
|
-
args["ancestor_commits"] = await
|
|
6876
|
+
args["ancestor_commits"] = await _chunk26JGOELHjs.isomorph_default.getPastNAncestors();
|
|
6863
6877
|
}
|
|
6864
6878
|
if (dataset !== void 0) {
|
|
6865
6879
|
const datasetSelection = await serializeDatasetForExperiment({
|
|
@@ -7571,12 +7585,13 @@ async function login(options = {}) {
|
|
|
7571
7585
|
}
|
|
7572
7586
|
async function loginToState(options = {}) {
|
|
7573
7587
|
const {
|
|
7574
|
-
appUrl =
|
|
7575
|
-
apiKey
|
|
7576
|
-
orgName =
|
|
7588
|
+
appUrl = _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_APP_URL") || "https://www.braintrust.dev",
|
|
7589
|
+
apiKey: apiKeyArg,
|
|
7590
|
+
orgName = _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_ORG_NAME"),
|
|
7577
7591
|
fetch: fetch2 = globalThis.fetch
|
|
7578
7592
|
} = options || {};
|
|
7579
|
-
const
|
|
7593
|
+
const apiKey = apiKeyArg !== void 0 ? apiKeyArg : await _chunk26JGOELHjs.isomorph_default.getBraintrustApiKey();
|
|
7594
|
+
const appPublicUrl = _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_APP_PUBLIC_URL") || appUrl;
|
|
7580
7595
|
const state = new BraintrustState(options);
|
|
7581
7596
|
state.resetLoginInfo();
|
|
7582
7597
|
state.appUrl = appUrl;
|
|
@@ -7741,7 +7756,7 @@ function wrapTracedSyncGenerator(fn, spanArgs, noTraceIO) {
|
|
|
7741
7756
|
if (!noTraceIO) {
|
|
7742
7757
|
span.log({ input: fnArgs });
|
|
7743
7758
|
}
|
|
7744
|
-
const envValue =
|
|
7759
|
+
const envValue = _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_MAX_GENERATOR_ITEMS");
|
|
7745
7760
|
const maxItems = envValue !== void 0 ? Number(envValue) : 1e3;
|
|
7746
7761
|
if (!noTraceIO && maxItems !== 0) {
|
|
7747
7762
|
let collected = [];
|
|
@@ -7790,7 +7805,7 @@ function wrapTracedAsyncGenerator(fn, spanArgs, noTraceIO) {
|
|
|
7790
7805
|
if (!noTraceIO) {
|
|
7791
7806
|
span.log({ input: fnArgs });
|
|
7792
7807
|
}
|
|
7793
|
-
const envValue =
|
|
7808
|
+
const envValue = _chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_MAX_GENERATOR_ITEMS");
|
|
7794
7809
|
const maxItems = envValue !== void 0 ? Number(envValue) : 1e3;
|
|
7795
7810
|
if (!noTraceIO && maxItems !== 0) {
|
|
7796
7811
|
let collected = [];
|
|
@@ -7992,8 +8007,8 @@ function _saveOrgInfo(state, org_info, org_name) {
|
|
|
7992
8007
|
if (org_name === void 0 || org.name === org_name) {
|
|
7993
8008
|
state.orgId = org.id;
|
|
7994
8009
|
state.orgName = org.name;
|
|
7995
|
-
state.apiUrl = _nullishCoalesce(
|
|
7996
|
-
state.proxyUrl = _nullishCoalesce(
|
|
8010
|
+
state.apiUrl = _nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_API_URL"), () => ( org.api_url));
|
|
8011
|
+
state.proxyUrl = _nullishCoalesce(_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_PROXY_URL"), () => ( org.proxy_url));
|
|
7997
8012
|
state.gitMetadataSettings = org.git_metadata || void 0;
|
|
7998
8013
|
break;
|
|
7999
8014
|
}
|
|
@@ -8721,7 +8736,7 @@ var SpanImpl = (_class13 = class _SpanImpl {
|
|
|
8721
8736
|
mergeDicts(rawEvent, this.propagatedEvent);
|
|
8722
8737
|
}
|
|
8723
8738
|
const { id: eventId, ...event } = rawEvent;
|
|
8724
|
-
const callerLocation =
|
|
8739
|
+
const callerLocation = _chunk26JGOELHjs.isomorph_default.getCallerLocation();
|
|
8725
8740
|
const name = (() => {
|
|
8726
8741
|
if (args.name) return args.name;
|
|
8727
8742
|
if (!args.parentSpanIds) return "root";
|
|
@@ -8816,9 +8831,15 @@ var SpanImpl = (_class13 = class _SpanImpl {
|
|
|
8816
8831
|
const cachedSpan = {
|
|
8817
8832
|
input: partialRecord.input,
|
|
8818
8833
|
output: partialRecord.output,
|
|
8834
|
+
expected: partialRecord.expected,
|
|
8835
|
+
error: partialRecord.error,
|
|
8836
|
+
scores: partialRecord.scores,
|
|
8837
|
+
metrics: partialRecord.metrics,
|
|
8819
8838
|
metadata: partialRecord.metadata,
|
|
8839
|
+
tags: partialRecord.tags,
|
|
8820
8840
|
span_id: this._spanId,
|
|
8821
8841
|
span_parents: this._spanParents,
|
|
8842
|
+
is_root: this._spanId === this._rootSpanId,
|
|
8822
8843
|
span_attributes: partialRecord.span_attributes
|
|
8823
8844
|
};
|
|
8824
8845
|
this._state.spanCache.queueWrite(
|
|
@@ -9154,6 +9175,7 @@ var Dataset2 = (_class14 = class extends ObjectFetcher {
|
|
|
9154
9175
|
metadata,
|
|
9155
9176
|
tags,
|
|
9156
9177
|
output,
|
|
9178
|
+
origin,
|
|
9157
9179
|
isMerge
|
|
9158
9180
|
}) {
|
|
9159
9181
|
return new LazyValue(async () => {
|
|
@@ -9168,6 +9190,7 @@ var Dataset2 = (_class14 = class extends ObjectFetcher {
|
|
|
9168
9190
|
created: !isMerge ? (/* @__PURE__ */ new Date()).toISOString() : void 0,
|
|
9169
9191
|
//if we're merging/updating an event we will not add this ts
|
|
9170
9192
|
metadata,
|
|
9193
|
+
origin,
|
|
9171
9194
|
...!!isMerge ? {
|
|
9172
9195
|
[IS_MERGE_FIELD]: true
|
|
9173
9196
|
} : {}
|
|
@@ -9187,6 +9210,7 @@ var Dataset2 = (_class14 = class extends ObjectFetcher {
|
|
|
9187
9210
|
* about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
|
|
9188
9211
|
* `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any
|
|
9189
9212
|
* JSON-serializable type, but its keys must be strings.
|
|
9213
|
+
* @param event.origin (Optional) a reference to the source object this dataset record was derived from.
|
|
9190
9214
|
* @param event.id (Optional) a unique identifier for the event. If you don't provide one, Braintrust will generate one for you.
|
|
9191
9215
|
* @param event.output: (Deprecated) The output of your application. Use `expected` instead.
|
|
9192
9216
|
* @returns The `id` of the logged record.
|
|
@@ -9197,7 +9221,8 @@ var Dataset2 = (_class14 = class extends ObjectFetcher {
|
|
|
9197
9221
|
metadata,
|
|
9198
9222
|
tags,
|
|
9199
9223
|
id,
|
|
9200
|
-
output
|
|
9224
|
+
output,
|
|
9225
|
+
origin
|
|
9201
9226
|
}) {
|
|
9202
9227
|
this.validateEvent({ metadata, expected, output, tags });
|
|
9203
9228
|
const rowId = id || _uuid.v4.call(void 0, );
|
|
@@ -9209,6 +9234,7 @@ var Dataset2 = (_class14 = class extends ObjectFetcher {
|
|
|
9209
9234
|
metadata,
|
|
9210
9235
|
tags,
|
|
9211
9236
|
output,
|
|
9237
|
+
origin,
|
|
9212
9238
|
isMerge: false
|
|
9213
9239
|
})
|
|
9214
9240
|
);
|
|
@@ -9946,7 +9972,7 @@ var _exportsForTestingOnly = {
|
|
|
9946
9972
|
isAsyncGeneratorFunction,
|
|
9947
9973
|
resetIdGenStateForTests,
|
|
9948
9974
|
validateTags,
|
|
9949
|
-
isomorph:
|
|
9975
|
+
isomorph: _chunk26JGOELHjs.isomorph_default
|
|
9950
9976
|
// Expose isomorph for build type detection
|
|
9951
9977
|
};
|
|
9952
9978
|
|
|
@@ -10239,7 +10265,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10239
10265
|
* @param handlers - Event handlers
|
|
10240
10266
|
*/
|
|
10241
10267
|
subscribe(channelName, handlers) {
|
|
10242
|
-
const channel =
|
|
10268
|
+
const channel = _chunk26JGOELHjs.isomorph_default.newTracingChannel(channelName);
|
|
10243
10269
|
channel.subscribe(handlers);
|
|
10244
10270
|
}
|
|
10245
10271
|
/**
|
|
@@ -10247,7 +10273,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10247
10273
|
* Creates a span and logs input/output/metrics.
|
|
10248
10274
|
*/
|
|
10249
10275
|
subscribeToChannel(channelName, config) {
|
|
10250
|
-
const channel =
|
|
10276
|
+
const channel = _chunk26JGOELHjs.isomorph_default.newTracingChannel(channelName);
|
|
10251
10277
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10252
10278
|
const handlers = {
|
|
10253
10279
|
start: (event) => {
|
|
@@ -10316,7 +10342,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10316
10342
|
* Handles both streaming and non-streaming responses.
|
|
10317
10343
|
*/
|
|
10318
10344
|
subscribeToStreamingChannel(channelName, config) {
|
|
10319
|
-
const channel =
|
|
10345
|
+
const channel = _chunk26JGOELHjs.isomorph_default.newTracingChannel(channelName);
|
|
10320
10346
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10321
10347
|
const handlers = {
|
|
10322
10348
|
start: (event) => {
|
|
@@ -10443,7 +10469,7 @@ var BasePlugin = (_class17 = class {constructor() { _class17.prototype.__init63.
|
|
|
10443
10469
|
* Used for methods like beta.chat.completions.stream() and responses.stream().
|
|
10444
10470
|
*/
|
|
10445
10471
|
subscribeToSyncStreamChannel(channelName, config) {
|
|
10446
|
-
const channel =
|
|
10472
|
+
const channel = _chunk26JGOELHjs.isomorph_default.newTracingChannel(channelName);
|
|
10447
10473
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
10448
10474
|
const handlers = {
|
|
10449
10475
|
start: (event) => {
|
|
@@ -11217,7 +11243,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11217
11243
|
}
|
|
11218
11244
|
onEnable() {
|
|
11219
11245
|
this.unsubscribers.push(
|
|
11220
|
-
traceStreamingChannel(
|
|
11246
|
+
traceStreamingChannel(_chunk26JGOELHjs.openAIChannels.chatCompletionsCreate, {
|
|
11221
11247
|
name: "Chat Completion",
|
|
11222
11248
|
type: "llm" /* LLM */,
|
|
11223
11249
|
extractInput: ([params]) => {
|
|
@@ -11245,7 +11271,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11245
11271
|
})
|
|
11246
11272
|
);
|
|
11247
11273
|
this.unsubscribers.push(
|
|
11248
|
-
traceAsyncChannel(
|
|
11274
|
+
traceAsyncChannel(_chunk26JGOELHjs.openAIChannels.embeddingsCreate, {
|
|
11249
11275
|
name: "Embedding",
|
|
11250
11276
|
type: "llm" /* LLM */,
|
|
11251
11277
|
extractInput: ([params]) => {
|
|
@@ -11269,7 +11295,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11269
11295
|
})
|
|
11270
11296
|
);
|
|
11271
11297
|
this.unsubscribers.push(
|
|
11272
|
-
traceStreamingChannel(
|
|
11298
|
+
traceStreamingChannel(_chunk26JGOELHjs.openAIChannels.betaChatCompletionsParse, {
|
|
11273
11299
|
name: "Chat Completion",
|
|
11274
11300
|
type: "llm" /* LLM */,
|
|
11275
11301
|
extractInput: ([params]) => {
|
|
@@ -11297,7 +11323,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11297
11323
|
})
|
|
11298
11324
|
);
|
|
11299
11325
|
this.unsubscribers.push(
|
|
11300
|
-
traceSyncStreamChannel(
|
|
11326
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.openAIChannels.betaChatCompletionsStream, {
|
|
11301
11327
|
name: "Chat Completion",
|
|
11302
11328
|
type: "llm" /* LLM */,
|
|
11303
11329
|
extractInput: ([params]) => {
|
|
@@ -11310,7 +11336,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11310
11336
|
})
|
|
11311
11337
|
);
|
|
11312
11338
|
this.unsubscribers.push(
|
|
11313
|
-
traceAsyncChannel(
|
|
11339
|
+
traceAsyncChannel(_chunk26JGOELHjs.openAIChannels.moderationsCreate, {
|
|
11314
11340
|
name: "Moderation",
|
|
11315
11341
|
type: "llm" /* LLM */,
|
|
11316
11342
|
extractInput: ([params]) => {
|
|
@@ -11333,7 +11359,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11333
11359
|
})
|
|
11334
11360
|
);
|
|
11335
11361
|
this.unsubscribers.push(
|
|
11336
|
-
traceStreamingChannel(
|
|
11362
|
+
traceStreamingChannel(_chunk26JGOELHjs.openAIChannels.responsesCreate, {
|
|
11337
11363
|
name: "openai.responses.create",
|
|
11338
11364
|
type: "llm" /* LLM */,
|
|
11339
11365
|
extractInput: ([params]) => {
|
|
@@ -11368,7 +11394,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11368
11394
|
})
|
|
11369
11395
|
);
|
|
11370
11396
|
this.unsubscribers.push(
|
|
11371
|
-
traceSyncStreamChannel(
|
|
11397
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.openAIChannels.responsesStream, {
|
|
11372
11398
|
name: "openai.responses.create",
|
|
11373
11399
|
type: "llm" /* LLM */,
|
|
11374
11400
|
extractInput: ([params]) => {
|
|
@@ -11397,7 +11423,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11397
11423
|
})
|
|
11398
11424
|
);
|
|
11399
11425
|
this.unsubscribers.push(
|
|
11400
|
-
traceStreamingChannel(
|
|
11426
|
+
traceStreamingChannel(_chunk26JGOELHjs.openAIChannels.responsesParse, {
|
|
11401
11427
|
name: "openai.responses.parse",
|
|
11402
11428
|
type: "llm" /* LLM */,
|
|
11403
11429
|
extractInput: ([params]) => {
|
|
@@ -11432,7 +11458,7 @@ var OpenAIPlugin = class extends BasePlugin {
|
|
|
11432
11458
|
})
|
|
11433
11459
|
);
|
|
11434
11460
|
this.unsubscribers.push(
|
|
11435
|
-
traceAsyncChannel(
|
|
11461
|
+
traceAsyncChannel(_chunk26JGOELHjs.openAIChannels.responsesCompact, {
|
|
11436
11462
|
name: "openai.responses.compact",
|
|
11437
11463
|
type: "llm" /* LLM */,
|
|
11438
11464
|
extractInput: ([params]) => {
|
|
@@ -11683,7 +11709,7 @@ var OpenAICodexPlugin = class extends BasePlugin {
|
|
|
11683
11709
|
this.unsubscribers = [];
|
|
11684
11710
|
}
|
|
11685
11711
|
subscribeToRun() {
|
|
11686
|
-
const channel =
|
|
11712
|
+
const channel = _chunk26JGOELHjs.openAICodexChannels.run.tracingChannel();
|
|
11687
11713
|
const states = /* @__PURE__ */ new WeakMap();
|
|
11688
11714
|
const handlers = {
|
|
11689
11715
|
start: (event) => {
|
|
@@ -11712,7 +11738,7 @@ var OpenAICodexPlugin = class extends BasePlugin {
|
|
|
11712
11738
|
});
|
|
11713
11739
|
}
|
|
11714
11740
|
subscribeToRunStreamed() {
|
|
11715
|
-
const channel =
|
|
11741
|
+
const channel = _chunk26JGOELHjs.openAICodexChannels.runStreamed.tracingChannel();
|
|
11716
11742
|
const states = /* @__PURE__ */ new WeakMap();
|
|
11717
11743
|
const handlers = {
|
|
11718
11744
|
start: (event) => {
|
|
@@ -12363,17 +12389,17 @@ var AnthropicPlugin = class extends BasePlugin {
|
|
|
12363
12389
|
aggregateChunks: (chunks) => aggregateAnthropicStreamChunks(chunks)
|
|
12364
12390
|
};
|
|
12365
12391
|
this.unsubscribers.push(
|
|
12366
|
-
traceStreamingChannel(
|
|
12392
|
+
traceStreamingChannel(_chunk26JGOELHjs.anthropicChannels.messagesCreate, anthropicConfig)
|
|
12367
12393
|
);
|
|
12368
12394
|
this.unsubscribers.push(
|
|
12369
|
-
traceStreamingChannel(
|
|
12395
|
+
traceStreamingChannel(_chunk26JGOELHjs.anthropicChannels.betaMessagesCreate, {
|
|
12370
12396
|
...anthropicConfig,
|
|
12371
12397
|
name: "anthropic.messages.create"
|
|
12372
12398
|
})
|
|
12373
12399
|
);
|
|
12374
12400
|
}
|
|
12375
12401
|
subscribeToAnthropicToolRunner() {
|
|
12376
|
-
const tracingChannel2 =
|
|
12402
|
+
const tracingChannel2 = _chunk26JGOELHjs.anthropicChannels.betaMessagesToolRunner.tracingChannel();
|
|
12377
12403
|
const states = /* @__PURE__ */ new WeakMap();
|
|
12378
12404
|
const handlers = {
|
|
12379
12405
|
start: (event) => {
|
|
@@ -13141,7 +13167,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13141
13167
|
subscribeToAISDK() {
|
|
13142
13168
|
const denyOutputPaths = this.config.denyOutputPaths || DEFAULT_DENY_OUTPUT_PATHS;
|
|
13143
13169
|
this.unsubscribers.push(
|
|
13144
|
-
traceStreamingChannel(
|
|
13170
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.generateText, {
|
|
13145
13171
|
name: "generateText",
|
|
13146
13172
|
type: "function" /* FUNCTION */,
|
|
13147
13173
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13157,7 +13183,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13157
13183
|
})
|
|
13158
13184
|
);
|
|
13159
13185
|
this.unsubscribers.push(
|
|
13160
|
-
traceStreamingChannel(
|
|
13186
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.streamText, {
|
|
13161
13187
|
name: "streamText",
|
|
13162
13188
|
type: "function" /* FUNCTION */,
|
|
13163
13189
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13177,7 +13203,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13177
13203
|
})
|
|
13178
13204
|
);
|
|
13179
13205
|
this.unsubscribers.push(
|
|
13180
|
-
traceSyncStreamChannel(
|
|
13206
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.aiSDKChannels.streamTextSync, {
|
|
13181
13207
|
name: "streamText",
|
|
13182
13208
|
type: "function" /* FUNCTION */,
|
|
13183
13209
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13191,7 +13217,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13191
13217
|
})
|
|
13192
13218
|
);
|
|
13193
13219
|
this.unsubscribers.push(
|
|
13194
|
-
traceStreamingChannel(
|
|
13220
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.generateObject, {
|
|
13195
13221
|
name: "generateObject",
|
|
13196
13222
|
type: "function" /* FUNCTION */,
|
|
13197
13223
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13207,7 +13233,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13207
13233
|
})
|
|
13208
13234
|
);
|
|
13209
13235
|
this.unsubscribers.push(
|
|
13210
|
-
traceStreamingChannel(
|
|
13236
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.streamObject, {
|
|
13211
13237
|
name: "streamObject",
|
|
13212
13238
|
type: "function" /* FUNCTION */,
|
|
13213
13239
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13227,7 +13253,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13227
13253
|
})
|
|
13228
13254
|
);
|
|
13229
13255
|
this.unsubscribers.push(
|
|
13230
|
-
traceSyncStreamChannel(
|
|
13256
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.aiSDKChannels.streamObjectSync, {
|
|
13231
13257
|
name: "streamObject",
|
|
13232
13258
|
type: "function" /* FUNCTION */,
|
|
13233
13259
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13241,7 +13267,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13241
13267
|
})
|
|
13242
13268
|
);
|
|
13243
13269
|
this.unsubscribers.push(
|
|
13244
|
-
traceAsyncChannel(
|
|
13270
|
+
traceAsyncChannel(_chunk26JGOELHjs.aiSDKChannels.embed, {
|
|
13245
13271
|
name: "embed",
|
|
13246
13272
|
type: "function" /* FUNCTION */,
|
|
13247
13273
|
extractInput: ([params], event) => prepareAISDKEmbedInput(params, event.self),
|
|
@@ -13253,7 +13279,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13253
13279
|
})
|
|
13254
13280
|
);
|
|
13255
13281
|
this.unsubscribers.push(
|
|
13256
|
-
traceAsyncChannel(
|
|
13282
|
+
traceAsyncChannel(_chunk26JGOELHjs.aiSDKChannels.embedMany, {
|
|
13257
13283
|
name: "embedMany",
|
|
13258
13284
|
type: "function" /* FUNCTION */,
|
|
13259
13285
|
extractInput: ([params], event) => prepareAISDKEmbedInput(params, event.self),
|
|
@@ -13265,7 +13291,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13265
13291
|
})
|
|
13266
13292
|
);
|
|
13267
13293
|
this.unsubscribers.push(
|
|
13268
|
-
traceAsyncChannel(
|
|
13294
|
+
traceAsyncChannel(_chunk26JGOELHjs.aiSDKChannels.rerank, {
|
|
13269
13295
|
name: "rerank",
|
|
13270
13296
|
type: "function" /* FUNCTION */,
|
|
13271
13297
|
extractInput: ([params], event) => prepareAISDKRerankInput(params, event.self),
|
|
@@ -13277,7 +13303,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13277
13303
|
})
|
|
13278
13304
|
);
|
|
13279
13305
|
this.unsubscribers.push(
|
|
13280
|
-
traceStreamingChannel(
|
|
13306
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.agentGenerate, {
|
|
13281
13307
|
name: "Agent.generate",
|
|
13282
13308
|
type: "function" /* FUNCTION */,
|
|
13283
13309
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13293,7 +13319,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13293
13319
|
})
|
|
13294
13320
|
);
|
|
13295
13321
|
this.unsubscribers.push(
|
|
13296
|
-
traceStreamingChannel(
|
|
13322
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.agentStream, {
|
|
13297
13323
|
name: "Agent.stream",
|
|
13298
13324
|
type: "function" /* FUNCTION */,
|
|
13299
13325
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13313,7 +13339,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13313
13339
|
})
|
|
13314
13340
|
);
|
|
13315
13341
|
this.unsubscribers.push(
|
|
13316
|
-
traceSyncStreamChannel(
|
|
13342
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.aiSDKChannels.agentStreamSync, {
|
|
13317
13343
|
name: "Agent.stream",
|
|
13318
13344
|
type: "function" /* FUNCTION */,
|
|
13319
13345
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13327,7 +13353,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13327
13353
|
})
|
|
13328
13354
|
);
|
|
13329
13355
|
this.unsubscribers.push(
|
|
13330
|
-
traceStreamingChannel(
|
|
13356
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.toolLoopAgentGenerate, {
|
|
13331
13357
|
name: "ToolLoopAgent.generate",
|
|
13332
13358
|
type: "function" /* FUNCTION */,
|
|
13333
13359
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -13343,7 +13369,7 @@ var AISDKPlugin = class extends BasePlugin {
|
|
|
13343
13369
|
})
|
|
13344
13370
|
);
|
|
13345
13371
|
this.unsubscribers.push(
|
|
13346
|
-
traceStreamingChannel(
|
|
13372
|
+
traceStreamingChannel(_chunk26JGOELHjs.aiSDKChannels.toolLoopAgentStream, {
|
|
13347
13373
|
name: "ToolLoopAgent.stream",
|
|
13348
13374
|
type: "function" /* FUNCTION */,
|
|
13349
13375
|
extractInput: ([params], event, span) => prepareAISDKCallInput(params, event, span, denyOutputPaths),
|
|
@@ -14751,7 +14777,7 @@ var LOCAL_TOOL_CONTEXT_ASYNC_ITERATOR_PATCHED = /* @__PURE__ */ Symbol.for(
|
|
|
14751
14777
|
"braintrust.claude_agent_sdk.local_tool_context_async_iterator_patched"
|
|
14752
14778
|
);
|
|
14753
14779
|
function createLocalToolContextStore() {
|
|
14754
|
-
const maybeIsoWithAsyncLocalStorage =
|
|
14780
|
+
const maybeIsoWithAsyncLocalStorage = _chunk26JGOELHjs.isomorph_default;
|
|
14755
14781
|
if (typeof maybeIsoWithAsyncLocalStorage.newAsyncLocalStorage === "function") {
|
|
14756
14782
|
return maybeIsoWithAsyncLocalStorage.newAsyncLocalStorage();
|
|
14757
14783
|
}
|
|
@@ -15928,7 +15954,7 @@ var ClaudeAgentSDKPlugin = class extends BasePlugin {
|
|
|
15928
15954
|
this.unsubscribers = [];
|
|
15929
15955
|
}
|
|
15930
15956
|
subscribeToQuery() {
|
|
15931
|
-
const channel =
|
|
15957
|
+
const channel = _chunk26JGOELHjs.claudeAgentSDKChannels.query.tracingChannel();
|
|
15932
15958
|
const spans = /* @__PURE__ */ new WeakMap();
|
|
15933
15959
|
const handlers = {
|
|
15934
15960
|
start: (event) => {
|
|
@@ -16161,8 +16187,8 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16161
16187
|
this.promptDepth = 0;
|
|
16162
16188
|
}
|
|
16163
16189
|
subscribeToAgentFactories() {
|
|
16164
|
-
this.subscribeToAgentFactory(
|
|
16165
|
-
this.subscribeToAgentFactory(
|
|
16190
|
+
this.subscribeToAgentFactory(_chunk26JGOELHjs.cursorSDKChannels.create);
|
|
16191
|
+
this.subscribeToAgentFactory(_chunk26JGOELHjs.cursorSDKChannels.resume);
|
|
16166
16192
|
}
|
|
16167
16193
|
subscribeToAgentFactory(channel) {
|
|
16168
16194
|
const tracingChannel2 = channel.tracingChannel();
|
|
@@ -16179,7 +16205,7 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16179
16205
|
});
|
|
16180
16206
|
}
|
|
16181
16207
|
subscribeToPrompt() {
|
|
16182
|
-
const channel =
|
|
16208
|
+
const channel = _chunk26JGOELHjs.cursorSDKChannels.prompt.tracingChannel();
|
|
16183
16209
|
const states = /* @__PURE__ */ new WeakMap();
|
|
16184
16210
|
const handlers = {
|
|
16185
16211
|
start: (event) => {
|
|
@@ -16240,7 +16266,7 @@ var CursorSDKPlugin = (_class18 = class extends BasePlugin {constructor(...args3
|
|
|
16240
16266
|
});
|
|
16241
16267
|
}
|
|
16242
16268
|
subscribeToSend() {
|
|
16243
|
-
const channel =
|
|
16269
|
+
const channel = _chunk26JGOELHjs.cursorSDKChannels.send.tracingChannel();
|
|
16244
16270
|
const states = /* @__PURE__ */ new WeakMap();
|
|
16245
16271
|
const handlers = {
|
|
16246
16272
|
start: (event) => {
|
|
@@ -16339,7 +16365,7 @@ function patchCursorAgentInPlace(agent) {
|
|
|
16339
16365
|
configurable: true,
|
|
16340
16366
|
value(message, options) {
|
|
16341
16367
|
const args = [message, options];
|
|
16342
|
-
return
|
|
16368
|
+
return _chunk26JGOELHjs.cursorSDKChannels.send.tracePromise(
|
|
16343
16369
|
() => originalSend(...args),
|
|
16344
16370
|
{
|
|
16345
16371
|
agent: agentRecord,
|
|
@@ -17388,7 +17414,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17388
17414
|
void this.processor.shutdown();
|
|
17389
17415
|
}
|
|
17390
17416
|
subscribeToTraceLifecycle() {
|
|
17391
|
-
const traceStartChannel =
|
|
17417
|
+
const traceStartChannel = _chunk26JGOELHjs.openAIAgentsCoreChannels.onTraceStart.tracingChannel();
|
|
17392
17418
|
const traceStartHandlers = {
|
|
17393
17419
|
start: (event) => {
|
|
17394
17420
|
const trace = firstArgument(event.arguments);
|
|
@@ -17401,7 +17427,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17401
17427
|
this.unsubscribers.push(
|
|
17402
17428
|
() => traceStartChannel.unsubscribe(traceStartHandlers)
|
|
17403
17429
|
);
|
|
17404
|
-
const traceEndChannel =
|
|
17430
|
+
const traceEndChannel = _chunk26JGOELHjs.openAIAgentsCoreChannels.onTraceEnd.tracingChannel();
|
|
17405
17431
|
const traceEndHandlers = {
|
|
17406
17432
|
start: (event) => {
|
|
17407
17433
|
const trace = firstArgument(event.arguments);
|
|
@@ -17414,7 +17440,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17414
17440
|
this.unsubscribers.push(
|
|
17415
17441
|
() => traceEndChannel.unsubscribe(traceEndHandlers)
|
|
17416
17442
|
);
|
|
17417
|
-
const spanStartChannel =
|
|
17443
|
+
const spanStartChannel = _chunk26JGOELHjs.openAIAgentsCoreChannels.onSpanStart.tracingChannel();
|
|
17418
17444
|
const spanStartHandlers = {
|
|
17419
17445
|
start: (event) => {
|
|
17420
17446
|
const span = firstArgument(event.arguments);
|
|
@@ -17427,7 +17453,7 @@ var OpenAIAgentsPlugin = (_class20 = class extends BasePlugin {constructor(...ar
|
|
|
17427
17453
|
this.unsubscribers.push(
|
|
17428
17454
|
() => spanStartChannel.unsubscribe(spanStartHandlers)
|
|
17429
17455
|
);
|
|
17430
|
-
const spanEndChannel =
|
|
17456
|
+
const spanEndChannel = _chunk26JGOELHjs.openAIAgentsCoreChannels.onSpanEnd.tracingChannel();
|
|
17431
17457
|
const spanEndHandlers = {
|
|
17432
17458
|
start: (event) => {
|
|
17433
17459
|
const span = firstArgument(event.arguments);
|
|
@@ -17467,7 +17493,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17467
17493
|
this.subscribeToEmbedContentChannel();
|
|
17468
17494
|
}
|
|
17469
17495
|
subscribeToGenerateContentChannel() {
|
|
17470
|
-
const tracingChannel2 =
|
|
17496
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleGenAIChannels.generateContent.tracingChannel();
|
|
17471
17497
|
const states = /* @__PURE__ */ new WeakMap();
|
|
17472
17498
|
const unbindCurrentSpanStore = bindCurrentSpanStoreToStart2(
|
|
17473
17499
|
tracingChannel2,
|
|
@@ -17541,7 +17567,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17541
17567
|
});
|
|
17542
17568
|
}
|
|
17543
17569
|
subscribeToGenerateContentStreamChannel() {
|
|
17544
|
-
const tracingChannel2 =
|
|
17570
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleGenAIChannels.generateContentStream.tracingChannel();
|
|
17545
17571
|
const handlers = {
|
|
17546
17572
|
start: (event) => {
|
|
17547
17573
|
const streamEvent = event;
|
|
@@ -17568,7 +17594,7 @@ var GoogleGenAIPlugin = class extends BasePlugin {
|
|
|
17568
17594
|
});
|
|
17569
17595
|
}
|
|
17570
17596
|
subscribeToEmbedContentChannel() {
|
|
17571
|
-
const tracingChannel2 =
|
|
17597
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleGenAIChannels.embedContent.tracingChannel();
|
|
17572
17598
|
const states = /* @__PURE__ */ new WeakMap();
|
|
17573
17599
|
const unbindCurrentSpanStore = bindCurrentSpanStoreToStart2(
|
|
17574
17600
|
tracingChannel2,
|
|
@@ -18213,7 +18239,7 @@ var RESPONSE_METADATA_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
|
18213
18239
|
var HuggingFacePlugin = class extends BasePlugin {
|
|
18214
18240
|
onEnable() {
|
|
18215
18241
|
this.unsubscribers.push(
|
|
18216
|
-
traceAsyncChannel(
|
|
18242
|
+
traceAsyncChannel(_chunk26JGOELHjs.huggingFaceChannels.chatCompletion, {
|
|
18217
18243
|
name: "huggingface.chat_completion",
|
|
18218
18244
|
type: "llm" /* LLM */,
|
|
18219
18245
|
extractInput: extractChatInputWithMetadata,
|
|
@@ -18221,7 +18247,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18221
18247
|
extractMetadata: (result) => extractResponseMetadata2(result),
|
|
18222
18248
|
extractMetrics: (result) => parseMetricsFromUsage(_optionalChain([result, 'optionalAccess', _380 => _380.usage]))
|
|
18223
18249
|
}),
|
|
18224
|
-
traceSyncStreamChannel(
|
|
18250
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.huggingFaceChannels.chatCompletionStream, {
|
|
18225
18251
|
name: "huggingface.chat_completion_stream",
|
|
18226
18252
|
type: "llm" /* LLM */,
|
|
18227
18253
|
extractInput: extractChatInputWithMetadata,
|
|
@@ -18231,7 +18257,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18231
18257
|
startTime
|
|
18232
18258
|
})
|
|
18233
18259
|
}),
|
|
18234
|
-
traceAsyncChannel(
|
|
18260
|
+
traceAsyncChannel(_chunk26JGOELHjs.huggingFaceChannels.textGeneration, {
|
|
18235
18261
|
name: "huggingface.text_generation",
|
|
18236
18262
|
type: "llm" /* LLM */,
|
|
18237
18263
|
extractInput: extractTextGenerationInputWithMetadata,
|
|
@@ -18239,7 +18265,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18239
18265
|
extractMetadata: extractTextGenerationMetadata,
|
|
18240
18266
|
extractMetrics: (result) => extractTextGenerationMetrics(_nullishCoalesce(_optionalChain([result, 'optionalAccess', _381 => _381.details]), () => ( null)))
|
|
18241
18267
|
}),
|
|
18242
|
-
traceSyncStreamChannel(
|
|
18268
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.huggingFaceChannels.textGenerationStream, {
|
|
18243
18269
|
name: "huggingface.text_generation_stream",
|
|
18244
18270
|
type: "llm" /* LLM */,
|
|
18245
18271
|
extractInput: extractTextGenerationInputWithMetadata,
|
|
@@ -18249,7 +18275,7 @@ var HuggingFacePlugin = class extends BasePlugin {
|
|
|
18249
18275
|
startTime
|
|
18250
18276
|
})
|
|
18251
18277
|
}),
|
|
18252
|
-
traceAsyncChannel(
|
|
18278
|
+
traceAsyncChannel(_chunk26JGOELHjs.huggingFaceChannels.featureExtraction, {
|
|
18253
18279
|
name: "huggingface.feature_extraction",
|
|
18254
18280
|
type: "llm" /* LLM */,
|
|
18255
18281
|
extractInput: extractFeatureExtractionInputWithMetadata,
|
|
@@ -18622,7 +18648,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18622
18648
|
}
|
|
18623
18649
|
subscribeToOpenRouterAgentChannels() {
|
|
18624
18650
|
this.unsubscribers.push(
|
|
18625
|
-
traceSyncStreamChannel(
|
|
18651
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.openRouterAgentChannels.callModel, {
|
|
18626
18652
|
name: "openrouter.callModel",
|
|
18627
18653
|
type: "task" /* TASK */,
|
|
18628
18654
|
extractInput: (args) => {
|
|
@@ -18642,7 +18668,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18642
18668
|
})
|
|
18643
18669
|
);
|
|
18644
18670
|
this.unsubscribers.push(
|
|
18645
|
-
traceAsyncChannel(
|
|
18671
|
+
traceAsyncChannel(_chunk26JGOELHjs.openRouterAgentChannels.callModelTurn, {
|
|
18646
18672
|
name: "openrouter.beta.responses.send",
|
|
18647
18673
|
type: "llm" /* LLM */,
|
|
18648
18674
|
extractInput: (args, event) => {
|
|
@@ -18678,7 +18704,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18678
18704
|
})
|
|
18679
18705
|
);
|
|
18680
18706
|
this.unsubscribers.push(
|
|
18681
|
-
traceStreamingChannel(
|
|
18707
|
+
traceStreamingChannel(_chunk26JGOELHjs.openRouterAgentChannels.toolExecute, {
|
|
18682
18708
|
name: "openrouter.tool",
|
|
18683
18709
|
type: "tool" /* TOOL */,
|
|
18684
18710
|
extractInput: (args, event) => ({
|
|
@@ -18697,7 +18723,7 @@ var OpenRouterAgentPlugin = class extends BasePlugin {
|
|
|
18697
18723
|
})
|
|
18698
18724
|
})
|
|
18699
18725
|
);
|
|
18700
|
-
const callModelChannel =
|
|
18726
|
+
const callModelChannel = _chunk26JGOELHjs.openRouterAgentChannels.callModel.tracingChannel();
|
|
18701
18727
|
const callModelHandlers = {
|
|
18702
18728
|
start: (event) => {
|
|
18703
18729
|
const request = getOpenRouterCallModelRequestArg(event.arguments);
|
|
@@ -18991,7 +19017,7 @@ function isWrappedTool(tool) {
|
|
|
18991
19017
|
return Boolean(tool[OPENROUTER_WRAPPED_TOOL]);
|
|
18992
19018
|
}
|
|
18993
19019
|
function traceToolExecution(args) {
|
|
18994
|
-
const tracingChannel2 =
|
|
19020
|
+
const tracingChannel2 = _chunk26JGOELHjs.openRouterAgentChannels.toolExecute.tracingChannel();
|
|
18995
19021
|
const input = args.args.length > 0 ? args.args[0] : void 0;
|
|
18996
19022
|
const event = {
|
|
18997
19023
|
arguments: [input],
|
|
@@ -19248,7 +19274,7 @@ async function traceOpenRouterCallModelTurn(args) {
|
|
|
19248
19274
|
};
|
|
19249
19275
|
return await withCurrent(
|
|
19250
19276
|
args.parentSpan,
|
|
19251
|
-
() =>
|
|
19277
|
+
() => _chunk26JGOELHjs.openRouterAgentChannels.callModelTurn.tracePromise(args.fn, context)
|
|
19252
19278
|
);
|
|
19253
19279
|
}
|
|
19254
19280
|
function isWrappedCallModelResult(value) {
|
|
@@ -19391,7 +19417,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19391
19417
|
}
|
|
19392
19418
|
subscribeToOpenRouterChannels() {
|
|
19393
19419
|
this.unsubscribers.push(
|
|
19394
|
-
traceStreamingChannel(
|
|
19420
|
+
traceStreamingChannel(_chunk26JGOELHjs.openRouterChannels.chatSend, {
|
|
19395
19421
|
name: "openrouter.chat.send",
|
|
19396
19422
|
type: "llm" /* LLM */,
|
|
19397
19423
|
extractInput: (args) => {
|
|
@@ -19419,7 +19445,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19419
19445
|
})
|
|
19420
19446
|
);
|
|
19421
19447
|
this.unsubscribers.push(
|
|
19422
|
-
traceAsyncChannel(
|
|
19448
|
+
traceAsyncChannel(_chunk26JGOELHjs.openRouterChannels.embeddingsGenerate, {
|
|
19423
19449
|
name: "openrouter.embeddings.generate",
|
|
19424
19450
|
type: "llm" /* LLM */,
|
|
19425
19451
|
extractInput: (args) => {
|
|
@@ -19456,7 +19482,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19456
19482
|
})
|
|
19457
19483
|
);
|
|
19458
19484
|
this.unsubscribers.push(
|
|
19459
|
-
traceAsyncChannel(
|
|
19485
|
+
traceAsyncChannel(_chunk26JGOELHjs.openRouterChannels.rerankRerank, {
|
|
19460
19486
|
name: "openrouter.rerank.rerank",
|
|
19461
19487
|
type: "llm" /* LLM */,
|
|
19462
19488
|
extractInput: (args) => {
|
|
@@ -19484,7 +19510,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19484
19510
|
})
|
|
19485
19511
|
);
|
|
19486
19512
|
this.unsubscribers.push(
|
|
19487
|
-
traceStreamingChannel(
|
|
19513
|
+
traceStreamingChannel(_chunk26JGOELHjs.openRouterChannels.betaResponsesSend, {
|
|
19488
19514
|
name: "openrouter.beta.responses.send",
|
|
19489
19515
|
type: "llm" /* LLM */,
|
|
19490
19516
|
extractInput: (args) => {
|
|
@@ -19511,7 +19537,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19511
19537
|
})
|
|
19512
19538
|
);
|
|
19513
19539
|
this.unsubscribers.push(
|
|
19514
|
-
traceSyncStreamChannel(
|
|
19540
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.openRouterChannels.callModel, {
|
|
19515
19541
|
name: "openrouter.callModel",
|
|
19516
19542
|
type: "task" /* TASK */,
|
|
19517
19543
|
extractInput: (args) => {
|
|
@@ -19531,7 +19557,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19531
19557
|
})
|
|
19532
19558
|
);
|
|
19533
19559
|
this.unsubscribers.push(
|
|
19534
|
-
traceAsyncChannel(
|
|
19560
|
+
traceAsyncChannel(_chunk26JGOELHjs.openRouterChannels.callModelTurn, {
|
|
19535
19561
|
name: "openrouter.beta.responses.send",
|
|
19536
19562
|
type: "llm" /* LLM */,
|
|
19537
19563
|
extractInput: (args, event) => {
|
|
@@ -19567,7 +19593,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19567
19593
|
})
|
|
19568
19594
|
);
|
|
19569
19595
|
this.unsubscribers.push(
|
|
19570
|
-
traceStreamingChannel(
|
|
19596
|
+
traceStreamingChannel(_chunk26JGOELHjs.openRouterChannels.toolExecute, {
|
|
19571
19597
|
name: "openrouter.tool",
|
|
19572
19598
|
type: "tool" /* TOOL */,
|
|
19573
19599
|
extractInput: (args, event) => ({
|
|
@@ -19586,7 +19612,7 @@ var OpenRouterPlugin = class extends BasePlugin {
|
|
|
19586
19612
|
})
|
|
19587
19613
|
})
|
|
19588
19614
|
);
|
|
19589
|
-
const callModelChannel =
|
|
19615
|
+
const callModelChannel = _chunk26JGOELHjs.openRouterChannels.callModel.tracingChannel();
|
|
19590
19616
|
const callModelHandlers = {
|
|
19591
19617
|
start: (event) => {
|
|
19592
19618
|
const request = getOpenRouterCallModelRequestArg2(event.arguments);
|
|
@@ -19899,7 +19925,7 @@ function isWrappedTool2(tool) {
|
|
|
19899
19925
|
return Boolean(tool[OPENROUTER_WRAPPED_TOOL2]);
|
|
19900
19926
|
}
|
|
19901
19927
|
function traceToolExecution2(args) {
|
|
19902
|
-
const tracingChannel2 =
|
|
19928
|
+
const tracingChannel2 = _chunk26JGOELHjs.openRouterChannels.toolExecute.tracingChannel();
|
|
19903
19929
|
const input = args.args.length > 0 ? args.args[0] : void 0;
|
|
19904
19930
|
const event = {
|
|
19905
19931
|
arguments: [input],
|
|
@@ -20287,7 +20313,7 @@ async function traceOpenRouterCallModelTurn2(args) {
|
|
|
20287
20313
|
};
|
|
20288
20314
|
return await withCurrent(
|
|
20289
20315
|
args.parentSpan,
|
|
20290
|
-
() =>
|
|
20316
|
+
() => _chunk26JGOELHjs.openRouterChannels.callModelTurn.tracePromise(args.fn, context)
|
|
20291
20317
|
);
|
|
20292
20318
|
}
|
|
20293
20319
|
function isWrappedCallModelResult2(value) {
|
|
@@ -20430,7 +20456,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20430
20456
|
}
|
|
20431
20457
|
subscribeToMistralChannels() {
|
|
20432
20458
|
this.unsubscribers.push(
|
|
20433
|
-
traceStreamingChannel(
|
|
20459
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.chatComplete, {
|
|
20434
20460
|
name: "mistral.chat.complete",
|
|
20435
20461
|
type: "llm" /* LLM */,
|
|
20436
20462
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20442,7 +20468,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20442
20468
|
})
|
|
20443
20469
|
);
|
|
20444
20470
|
this.unsubscribers.push(
|
|
20445
|
-
traceStreamingChannel(
|
|
20471
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.chatStream, {
|
|
20446
20472
|
name: "mistral.chat.stream",
|
|
20447
20473
|
type: "llm" /* LLM */,
|
|
20448
20474
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20453,7 +20479,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20453
20479
|
})
|
|
20454
20480
|
);
|
|
20455
20481
|
this.unsubscribers.push(
|
|
20456
|
-
traceAsyncChannel(
|
|
20482
|
+
traceAsyncChannel(_chunk26JGOELHjs.mistralChannels.embeddingsCreate, {
|
|
20457
20483
|
name: "mistral.embeddings.create",
|
|
20458
20484
|
type: "llm" /* LLM */,
|
|
20459
20485
|
extractInput: extractEmbeddingInputWithMetadata,
|
|
@@ -20466,7 +20492,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20466
20492
|
})
|
|
20467
20493
|
);
|
|
20468
20494
|
this.unsubscribers.push(
|
|
20469
|
-
traceAsyncChannel(
|
|
20495
|
+
traceAsyncChannel(_chunk26JGOELHjs.mistralChannels.classifiersModerate, {
|
|
20470
20496
|
name: "mistral.classifiers.moderate",
|
|
20471
20497
|
type: "llm" /* LLM */,
|
|
20472
20498
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20476,7 +20502,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20476
20502
|
})
|
|
20477
20503
|
);
|
|
20478
20504
|
this.unsubscribers.push(
|
|
20479
|
-
traceAsyncChannel(
|
|
20505
|
+
traceAsyncChannel(_chunk26JGOELHjs.mistralChannels.classifiersModerateChat, {
|
|
20480
20506
|
name: "mistral.classifiers.moderateChat",
|
|
20481
20507
|
type: "llm" /* LLM */,
|
|
20482
20508
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20486,7 +20512,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20486
20512
|
})
|
|
20487
20513
|
);
|
|
20488
20514
|
this.unsubscribers.push(
|
|
20489
|
-
traceAsyncChannel(
|
|
20515
|
+
traceAsyncChannel(_chunk26JGOELHjs.mistralChannels.classifiersClassify, {
|
|
20490
20516
|
name: "mistral.classifiers.classify",
|
|
20491
20517
|
type: "llm" /* LLM */,
|
|
20492
20518
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20496,7 +20522,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20496
20522
|
})
|
|
20497
20523
|
);
|
|
20498
20524
|
this.unsubscribers.push(
|
|
20499
|
-
traceAsyncChannel(
|
|
20525
|
+
traceAsyncChannel(_chunk26JGOELHjs.mistralChannels.classifiersClassifyChat, {
|
|
20500
20526
|
name: "mistral.classifiers.classifyChat",
|
|
20501
20527
|
type: "llm" /* LLM */,
|
|
20502
20528
|
extractInput: extractClassifierInputWithMetadata,
|
|
@@ -20506,7 +20532,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20506
20532
|
})
|
|
20507
20533
|
);
|
|
20508
20534
|
this.unsubscribers.push(
|
|
20509
|
-
traceStreamingChannel(
|
|
20535
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.fimComplete, {
|
|
20510
20536
|
name: "mistral.fim.complete",
|
|
20511
20537
|
type: "llm" /* LLM */,
|
|
20512
20538
|
extractInput: extractPromptInputWithMetadata,
|
|
@@ -20518,7 +20544,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20518
20544
|
})
|
|
20519
20545
|
);
|
|
20520
20546
|
this.unsubscribers.push(
|
|
20521
|
-
traceStreamingChannel(
|
|
20547
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.fimStream, {
|
|
20522
20548
|
name: "mistral.fim.stream",
|
|
20523
20549
|
type: "llm" /* LLM */,
|
|
20524
20550
|
extractInput: extractPromptInputWithMetadata,
|
|
@@ -20529,7 +20555,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20529
20555
|
})
|
|
20530
20556
|
);
|
|
20531
20557
|
this.unsubscribers.push(
|
|
20532
|
-
traceStreamingChannel(
|
|
20558
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.agentsComplete, {
|
|
20533
20559
|
name: "mistral.agents.complete",
|
|
20534
20560
|
type: "llm" /* LLM */,
|
|
20535
20561
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -20541,7 +20567,7 @@ var MistralPlugin = class extends BasePlugin {
|
|
|
20541
20567
|
})
|
|
20542
20568
|
);
|
|
20543
20569
|
this.unsubscribers.push(
|
|
20544
|
-
traceStreamingChannel(
|
|
20570
|
+
traceStreamingChannel(_chunk26JGOELHjs.mistralChannels.agentsStream, {
|
|
20545
20571
|
name: "mistral.agents.stream",
|
|
20546
20572
|
type: "llm" /* LLM */,
|
|
20547
20573
|
extractInput: extractMessagesInputWithMetadata,
|
|
@@ -21055,7 +21081,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21055
21081
|
this.activeAgentSpans.clear();
|
|
21056
21082
|
}
|
|
21057
21083
|
subscribeToRunnerRunAsync() {
|
|
21058
|
-
const tracingChannel2 =
|
|
21084
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleADKChannels.runnerRunAsync.tracingChannel();
|
|
21059
21085
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21060
21086
|
const createState = (event) => {
|
|
21061
21087
|
const params = _nullishCoalesce(event.arguments[0], () => ( {}));
|
|
@@ -21140,7 +21166,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21140
21166
|
});
|
|
21141
21167
|
}
|
|
21142
21168
|
subscribeToAgentRunAsync() {
|
|
21143
|
-
const tracingChannel2 =
|
|
21169
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleADKChannels.agentRunAsync.tracingChannel();
|
|
21144
21170
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21145
21171
|
const createState = (event) => {
|
|
21146
21172
|
const parentContext = event.arguments[0];
|
|
@@ -21243,7 +21269,7 @@ var GoogleADKPlugin = (_class21 = class extends BasePlugin {constructor(...args5
|
|
|
21243
21269
|
});
|
|
21244
21270
|
}
|
|
21245
21271
|
subscribeToToolRunAsync() {
|
|
21246
|
-
const tracingChannel2 =
|
|
21272
|
+
const tracingChannel2 = _chunk26JGOELHjs.googleADKChannels.toolRunAsync.tracingChannel();
|
|
21247
21273
|
const states = /* @__PURE__ */ new WeakMap();
|
|
21248
21274
|
const handlers = {
|
|
21249
21275
|
start: (event) => {
|
|
@@ -21678,7 +21704,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21678
21704
|
}
|
|
21679
21705
|
subscribeToCohereChannels() {
|
|
21680
21706
|
this.unsubscribers.push(
|
|
21681
|
-
traceStreamingChannel(
|
|
21707
|
+
traceStreamingChannel(_chunk26JGOELHjs.cohereChannels.chat, {
|
|
21682
21708
|
name: "cohere.chat",
|
|
21683
21709
|
type: "llm" /* LLM */,
|
|
21684
21710
|
extractInput: extractChatInputWithMetadata2,
|
|
@@ -21694,7 +21720,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21694
21720
|
})
|
|
21695
21721
|
);
|
|
21696
21722
|
this.unsubscribers.push(
|
|
21697
|
-
traceStreamingChannel(
|
|
21723
|
+
traceStreamingChannel(_chunk26JGOELHjs.cohereChannels.chatStream, {
|
|
21698
21724
|
name: "cohere.chatStream",
|
|
21699
21725
|
type: "llm" /* LLM */,
|
|
21700
21726
|
extractInput: extractChatInputWithMetadata2,
|
|
@@ -21705,7 +21731,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21705
21731
|
})
|
|
21706
21732
|
);
|
|
21707
21733
|
this.unsubscribers.push(
|
|
21708
|
-
traceAsyncChannel(
|
|
21734
|
+
traceAsyncChannel(_chunk26JGOELHjs.cohereChannels.embed, {
|
|
21709
21735
|
name: "cohere.embed",
|
|
21710
21736
|
type: "llm" /* LLM */,
|
|
21711
21737
|
extractInput: extractEmbedInputWithMetadata,
|
|
@@ -21715,7 +21741,7 @@ var CoherePlugin = class extends BasePlugin {
|
|
|
21715
21741
|
})
|
|
21716
21742
|
);
|
|
21717
21743
|
this.unsubscribers.push(
|
|
21718
|
-
traceAsyncChannel(
|
|
21744
|
+
traceAsyncChannel(_chunk26JGOELHjs.cohereChannels.rerank, {
|
|
21719
21745
|
name: "cohere.rerank",
|
|
21720
21746
|
type: "llm" /* LLM */,
|
|
21721
21747
|
extractInput: extractRerankInputWithMetadata,
|
|
@@ -22338,7 +22364,7 @@ function aggregateCohereChatStreamChunks(chunks) {
|
|
|
22338
22364
|
var GroqPlugin = class extends BasePlugin {
|
|
22339
22365
|
onEnable() {
|
|
22340
22366
|
this.unsubscribers.push(
|
|
22341
|
-
traceStreamingChannel(
|
|
22367
|
+
traceStreamingChannel(_chunk26JGOELHjs.groqChannels.chatCompletionsCreate, {
|
|
22342
22368
|
name: "groq.chat.completions.create",
|
|
22343
22369
|
type: "llm" /* LLM */,
|
|
22344
22370
|
extractInput: ([params]) => {
|
|
@@ -22360,7 +22386,7 @@ var GroqPlugin = class extends BasePlugin {
|
|
|
22360
22386
|
})
|
|
22361
22387
|
);
|
|
22362
22388
|
this.unsubscribers.push(
|
|
22363
|
-
traceAsyncChannel(
|
|
22389
|
+
traceAsyncChannel(_chunk26JGOELHjs.groqChannels.embeddingsCreate, {
|
|
22364
22390
|
name: "groq.embeddings.create",
|
|
22365
22391
|
type: "llm" /* LLM */,
|
|
22366
22392
|
extractInput: ([params]) => {
|
|
@@ -22440,7 +22466,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22440
22466
|
}
|
|
22441
22467
|
subscribeToGenkitChannels() {
|
|
22442
22468
|
this.unsubscribers.push(
|
|
22443
|
-
traceAsyncChannel(
|
|
22469
|
+
traceAsyncChannel(_chunk26JGOELHjs.genkitChannels.generate, {
|
|
22444
22470
|
name: "genkit.generate",
|
|
22445
22471
|
type: "llm" /* LLM */,
|
|
22446
22472
|
extractInput: ([input]) => extractGenerateInput(input),
|
|
@@ -22450,7 +22476,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22450
22476
|
})
|
|
22451
22477
|
);
|
|
22452
22478
|
this.unsubscribers.push(
|
|
22453
|
-
traceSyncStreamChannel(
|
|
22479
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.genkitChannels.generateStream, {
|
|
22454
22480
|
name: "genkit.generateStream",
|
|
22455
22481
|
type: "llm" /* LLM */,
|
|
22456
22482
|
extractInput: ([input]) => extractGenerateInput(input),
|
|
@@ -22458,7 +22484,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22458
22484
|
})
|
|
22459
22485
|
);
|
|
22460
22486
|
this.unsubscribers.push(
|
|
22461
|
-
traceAsyncChannel(
|
|
22487
|
+
traceAsyncChannel(_chunk26JGOELHjs.genkitChannels.embed, {
|
|
22462
22488
|
name: "genkit.embed",
|
|
22463
22489
|
type: "function" /* FUNCTION */,
|
|
22464
22490
|
extractInput: ([params]) => extractEmbedInput(params),
|
|
@@ -22468,7 +22494,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22468
22494
|
})
|
|
22469
22495
|
);
|
|
22470
22496
|
this.unsubscribers.push(
|
|
22471
|
-
traceAsyncChannel(
|
|
22497
|
+
traceAsyncChannel(_chunk26JGOELHjs.genkitChannels.embedMany, {
|
|
22472
22498
|
name: "genkit.embedMany",
|
|
22473
22499
|
type: "function" /* FUNCTION */,
|
|
22474
22500
|
extractInput: ([params]) => extractEmbedManyInput(params),
|
|
@@ -22482,7 +22508,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22482
22508
|
this.subscribeToActionStream();
|
|
22483
22509
|
}
|
|
22484
22510
|
subscribeToActionRun() {
|
|
22485
|
-
const tracingChannel2 =
|
|
22511
|
+
const tracingChannel2 = _chunk26JGOELHjs.genkitChannels.actionRun.tracingChannel();
|
|
22486
22512
|
const states = /* @__PURE__ */ new WeakMap();
|
|
22487
22513
|
const unbindCurrentSpanStore = bindActionCurrentSpanStoreToStart(
|
|
22488
22514
|
tracingChannel2,
|
|
@@ -22529,7 +22555,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22529
22555
|
});
|
|
22530
22556
|
}
|
|
22531
22557
|
subscribeToActionSpan() {
|
|
22532
|
-
const tracingChannel2 =
|
|
22558
|
+
const tracingChannel2 = _chunk26JGOELHjs.genkitCoreChannels.actionSpan.tracingChannel();
|
|
22533
22559
|
const states = /* @__PURE__ */ new WeakMap();
|
|
22534
22560
|
const unbindCurrentSpanStore = bindActionCurrentSpanStoreToStart(
|
|
22535
22561
|
tracingChannel2,
|
|
@@ -22578,7 +22604,7 @@ var GenkitPlugin = class extends BasePlugin {
|
|
|
22578
22604
|
}
|
|
22579
22605
|
subscribeToActionStream() {
|
|
22580
22606
|
this.unsubscribers.push(
|
|
22581
|
-
traceSyncStreamChannel(
|
|
22607
|
+
traceSyncStreamChannel(_chunk26JGOELHjs.genkitChannels.actionStream, {
|
|
22582
22608
|
name: "genkit.action.stream",
|
|
22583
22609
|
type: "task" /* TASK */,
|
|
22584
22610
|
extractInput: ([input], event) => ({
|
|
@@ -23469,8 +23495,8 @@ var GitHubCopilotPlugin = class extends BasePlugin {
|
|
|
23469
23495
|
this.unsubscribers = [];
|
|
23470
23496
|
}
|
|
23471
23497
|
subscribeToSessionChannels() {
|
|
23472
|
-
const createChannel =
|
|
23473
|
-
const resumeChannel =
|
|
23498
|
+
const createChannel = _chunk26JGOELHjs.gitHubCopilotChannels.createSession.tracingChannel();
|
|
23499
|
+
const resumeChannel = _chunk26JGOELHjs.gitHubCopilotChannels.resumeSession.tracingChannel();
|
|
23474
23500
|
const sessionStates = /* @__PURE__ */ new WeakMap();
|
|
23475
23501
|
const createHandlers = makeSessionHandlers(
|
|
23476
23502
|
sessionStates,
|
|
@@ -23560,7 +23586,7 @@ function subscribeFlueContextEvents(ctx, options = {}) {
|
|
|
23560
23586
|
}
|
|
23561
23587
|
try {
|
|
23562
23588
|
const unsubscribe = ctx.subscribeEvent((event) => {
|
|
23563
|
-
|
|
23589
|
+
_chunk26JGOELHjs.flueChannels.contextEvent.traceSync(() => void 0, {
|
|
23564
23590
|
arguments: [event],
|
|
23565
23591
|
captureTurnSpans,
|
|
23566
23592
|
context: ctx
|
|
@@ -23626,9 +23652,9 @@ function patchFlueSessionInPlace(session) {
|
|
|
23626
23652
|
enumerable: false,
|
|
23627
23653
|
value: true
|
|
23628
23654
|
});
|
|
23629
|
-
patchCallHandleMethod(session, "prompt",
|
|
23630
|
-
patchCallHandleMethod(session, "skill",
|
|
23631
|
-
patchCallHandleMethod(session, "task",
|
|
23655
|
+
patchCallHandleMethod(session, "prompt", _chunk26JGOELHjs.flueChannels.prompt);
|
|
23656
|
+
patchCallHandleMethod(session, "skill", _chunk26JGOELHjs.flueChannels.skill);
|
|
23657
|
+
patchCallHandleMethod(session, "task", _chunk26JGOELHjs.flueChannels.task);
|
|
23632
23658
|
patchCompact(session);
|
|
23633
23659
|
} catch (e52) {
|
|
23634
23660
|
}
|
|
@@ -23686,7 +23712,7 @@ function patchCompact(session) {
|
|
|
23686
23712
|
operation: "compact",
|
|
23687
23713
|
session
|
|
23688
23714
|
};
|
|
23689
|
-
return
|
|
23715
|
+
return _chunk26JGOELHjs.flueChannels.compact.tracePromise(() => bound(), context);
|
|
23690
23716
|
},
|
|
23691
23717
|
writable: true
|
|
23692
23718
|
});
|
|
@@ -23793,7 +23819,7 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
23793
23819
|
this.turnsByScope.clear();
|
|
23794
23820
|
}
|
|
23795
23821
|
subscribeToContextCreation() {
|
|
23796
|
-
const channel =
|
|
23822
|
+
const channel = _chunk26JGOELHjs.flueChannels.createContext.tracingChannel();
|
|
23797
23823
|
const handlers = {
|
|
23798
23824
|
end: (event) => {
|
|
23799
23825
|
const ctx = event.result;
|
|
@@ -23812,7 +23838,7 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
23812
23838
|
});
|
|
23813
23839
|
}
|
|
23814
23840
|
subscribeToSessionCreation() {
|
|
23815
|
-
const channel =
|
|
23841
|
+
const channel = _chunk26JGOELHjs.flueChannels.openSession.tracingChannel();
|
|
23816
23842
|
const handlers = {
|
|
23817
23843
|
asyncEnd: (event) => {
|
|
23818
23844
|
if (event.result) {
|
|
@@ -23833,9 +23859,9 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
23833
23859
|
});
|
|
23834
23860
|
}
|
|
23835
23861
|
subscribeToSessionOperations() {
|
|
23836
|
-
this.subscribeToSessionOperation(
|
|
23837
|
-
this.subscribeToSessionOperation(
|
|
23838
|
-
this.subscribeToSessionOperation(
|
|
23862
|
+
this.subscribeToSessionOperation(_chunk26JGOELHjs.flueChannels.prompt);
|
|
23863
|
+
this.subscribeToSessionOperation(_chunk26JGOELHjs.flueChannels.skill);
|
|
23864
|
+
this.subscribeToSessionOperation(_chunk26JGOELHjs.flueChannels.task);
|
|
23839
23865
|
this.subscribeToCompact();
|
|
23840
23866
|
}
|
|
23841
23867
|
subscribeToSessionOperation(channel) {
|
|
@@ -23883,7 +23909,7 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
23883
23909
|
});
|
|
23884
23910
|
}
|
|
23885
23911
|
subscribeToCompact() {
|
|
23886
|
-
const tracingChannel2 =
|
|
23912
|
+
const tracingChannel2 = _chunk26JGOELHjs.flueChannels.compact.tracingChannel();
|
|
23887
23913
|
const states = /* @__PURE__ */ new WeakMap();
|
|
23888
23914
|
const ensureState2 = (event) => {
|
|
23889
23915
|
const existing = states.get(event);
|
|
@@ -23927,7 +23953,7 @@ var FluePlugin = (_class22 = class extends BasePlugin {constructor(...args6) { s
|
|
|
23927
23953
|
});
|
|
23928
23954
|
}
|
|
23929
23955
|
subscribeToContextEvents() {
|
|
23930
|
-
const channel =
|
|
23956
|
+
const channel = _chunk26JGOELHjs.flueChannels.contextEvent.tracingChannel();
|
|
23931
23957
|
const handlers = {
|
|
23932
23958
|
start: (event) => {
|
|
23933
23959
|
const flueEvent = event.arguments[0];
|
|
@@ -25099,8 +25125,8 @@ function isRecord(value) {
|
|
|
25099
25125
|
var LangChainPlugin = (_class24 = class extends BasePlugin {constructor(...args7) { super(...args7); _class24.prototype.__init85.call(this); }
|
|
25100
25126
|
__init85() {this.injectedManagers = /* @__PURE__ */ new WeakSet()}
|
|
25101
25127
|
onEnable() {
|
|
25102
|
-
this.subscribeToConfigure(
|
|
25103
|
-
this.subscribeToConfigure(
|
|
25128
|
+
this.subscribeToConfigure(_chunk26JGOELHjs.langChainChannels.configure);
|
|
25129
|
+
this.subscribeToConfigure(_chunk26JGOELHjs.langChainChannels.configureSync);
|
|
25104
25130
|
}
|
|
25105
25131
|
onDisable() {
|
|
25106
25132
|
for (const unsubscribe of this.unsubscribers) {
|
|
@@ -25446,15 +25472,15 @@ var PluginRegistry = (_class26 = class {constructor() { _class26.prototype.__ini
|
|
|
25446
25472
|
* Get default configuration (all integrations enabled).
|
|
25447
25473
|
*/
|
|
25448
25474
|
getDefaultConfig() {
|
|
25449
|
-
return
|
|
25475
|
+
return _chunk26JGOELHjs.getDefaultInstrumentationIntegrations.call(void 0, );
|
|
25450
25476
|
}
|
|
25451
25477
|
/**
|
|
25452
25478
|
* Read configuration from environment variables.
|
|
25453
25479
|
* Supports: BRAINTRUST_DISABLE_INSTRUMENTATION=openai,anthropic,...
|
|
25454
25480
|
*/
|
|
25455
25481
|
readEnvConfig() {
|
|
25456
|
-
return
|
|
25457
|
-
|
|
25482
|
+
return _chunk26JGOELHjs.readDisabledInstrumentationEnvConfig.call(void 0,
|
|
25483
|
+
_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_DISABLE_INSTRUMENTATION")
|
|
25458
25484
|
);
|
|
25459
25485
|
}
|
|
25460
25486
|
}, _class26);
|
|
@@ -25464,47 +25490,96 @@ function configureInstrumentation(config) {
|
|
|
25464
25490
|
}
|
|
25465
25491
|
|
|
25466
25492
|
// src/node/config.ts
|
|
25493
|
+
var BRAINTRUST_ENV_SEARCH_PARENT_LIMIT = 64;
|
|
25467
25494
|
function configureNode() {
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25495
|
+
_chunk26JGOELHjs.isomorph_default.buildType = "node";
|
|
25496
|
+
_chunk26JGOELHjs.isomorph_default.getRepoInfo = getRepoInfo;
|
|
25497
|
+
_chunk26JGOELHjs.isomorph_default.getPastNAncestors = getPastNAncestors;
|
|
25498
|
+
_chunk26JGOELHjs.isomorph_default.getEnv = (name) => {
|
|
25499
|
+
const value = process.env[name];
|
|
25500
|
+
return name === "BRAINTRUST_API_KEY" && !_optionalChain([value, 'optionalAccess', _627 => _627.trim, 'call', _628 => _628()]) ? void 0 : value;
|
|
25501
|
+
};
|
|
25502
|
+
_chunk26JGOELHjs.isomorph_default.getBraintrustApiKey = async () => {
|
|
25503
|
+
const value = process.env.BRAINTRUST_API_KEY;
|
|
25504
|
+
if (_optionalChain([value, 'optionalAccess', _629 => _629.trim, 'call', _630 => _630()])) {
|
|
25505
|
+
return value;
|
|
25506
|
+
}
|
|
25507
|
+
const envPaths = [];
|
|
25508
|
+
for (let dir2 = process.cwd(), depth = 0; depth <= BRAINTRUST_ENV_SEARCH_PARENT_LIMIT; dir2 = path.dirname(dir2), depth++) {
|
|
25509
|
+
envPaths.push(path.join(dir2, ".env.braintrust"));
|
|
25510
|
+
if (path.dirname(dir2) === dir2) {
|
|
25511
|
+
break;
|
|
25512
|
+
}
|
|
25513
|
+
}
|
|
25514
|
+
const pending = /* @__PURE__ */ new Map();
|
|
25515
|
+
envPaths.forEach((envPath, index) => {
|
|
25516
|
+
pending.set(
|
|
25517
|
+
index,
|
|
25518
|
+
fs.readFile(envPath, "utf8").then(
|
|
25519
|
+
(contents) => ({ contents, envPath, index }),
|
|
25520
|
+
(error) => ({ error, envPath, index })
|
|
25521
|
+
)
|
|
25522
|
+
);
|
|
25523
|
+
});
|
|
25524
|
+
const results = [];
|
|
25525
|
+
let nearestUnresolvedIndex = 0;
|
|
25526
|
+
while (pending.size > 0) {
|
|
25527
|
+
const result = await Promise.race(pending.values());
|
|
25528
|
+
pending.delete(result.index);
|
|
25529
|
+
results[result.index] = result;
|
|
25530
|
+
while (results[nearestUnresolvedIndex]) {
|
|
25531
|
+
const nearestResult = results[nearestUnresolvedIndex];
|
|
25532
|
+
if ("contents" in nearestResult) {
|
|
25533
|
+
const parsed = dotenv.parse(nearestResult.contents);
|
|
25534
|
+
const apiKey = parsed.BRAINTRUST_API_KEY;
|
|
25535
|
+
return _optionalChain([apiKey, 'optionalAccess', _631 => _631.trim, 'call', _632 => _632()]) ? apiKey : void 0;
|
|
25536
|
+
}
|
|
25537
|
+
const e = nearestResult.error;
|
|
25538
|
+
if (typeof e === "object" && e !== null && "code" in e && e.code === "ENOENT") {
|
|
25539
|
+
nearestUnresolvedIndex++;
|
|
25540
|
+
continue;
|
|
25541
|
+
}
|
|
25542
|
+
return void 0;
|
|
25543
|
+
}
|
|
25544
|
+
}
|
|
25545
|
+
return void 0;
|
|
25546
|
+
};
|
|
25547
|
+
_chunk26JGOELHjs.isomorph_default.getCallerLocation = getCallerLocation;
|
|
25548
|
+
_chunk26JGOELHjs.isomorph_default.newAsyncLocalStorage = () => new (0, _nodeasync_hooks.AsyncLocalStorage)();
|
|
25549
|
+
_chunk26JGOELHjs.isomorph_default.newTracingChannel = (nameOrChannels) => diagnostics_channel.tracingChannel(nameOrChannels);
|
|
25550
|
+
_chunk26JGOELHjs.patchTracingChannel.call(void 0, diagnostics_channel.tracingChannel);
|
|
25551
|
+
_chunk26JGOELHjs.isomorph_default.processOn = (event, handler) => {
|
|
25477
25552
|
process.on(event, handler);
|
|
25478
25553
|
};
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25554
|
+
_chunk26JGOELHjs.isomorph_default.basename = path.basename;
|
|
25555
|
+
_chunk26JGOELHjs.isomorph_default.writeln = (text) => process.stdout.write(text + "\n");
|
|
25556
|
+
_chunk26JGOELHjs.isomorph_default.pathJoin = path.join;
|
|
25557
|
+
_chunk26JGOELHjs.isomorph_default.pathDirname = path.dirname;
|
|
25558
|
+
_chunk26JGOELHjs.isomorph_default.mkdir = fs.mkdir;
|
|
25559
|
+
_chunk26JGOELHjs.isomorph_default.writeFile = fs.writeFile;
|
|
25560
|
+
_chunk26JGOELHjs.isomorph_default.readFile = fs.readFile;
|
|
25561
|
+
_chunk26JGOELHjs.isomorph_default.readdir = fs.readdir;
|
|
25562
|
+
_chunk26JGOELHjs.isomorph_default.stat = fs.stat;
|
|
25563
|
+
_chunk26JGOELHjs.isomorph_default.statSync = fsSync.statSync;
|
|
25564
|
+
_chunk26JGOELHjs.isomorph_default.utimes = fs.utimes;
|
|
25565
|
+
_chunk26JGOELHjs.isomorph_default.unlink = fs.unlink;
|
|
25566
|
+
_chunk26JGOELHjs.isomorph_default.homedir = os.homedir;
|
|
25567
|
+
_chunk26JGOELHjs.isomorph_default.tmpdir = os.tmpdir;
|
|
25568
|
+
_chunk26JGOELHjs.isomorph_default.writeFileSync = fsSync.writeFileSync;
|
|
25569
|
+
_chunk26JGOELHjs.isomorph_default.appendFileSync = fsSync.appendFileSync;
|
|
25570
|
+
_chunk26JGOELHjs.isomorph_default.readFileSync = (filename, encoding) => fsSync.readFileSync(filename, encoding);
|
|
25571
|
+
_chunk26JGOELHjs.isomorph_default.unlinkSync = fsSync.unlinkSync;
|
|
25572
|
+
_chunk26JGOELHjs.isomorph_default.openFile = fs.open;
|
|
25573
|
+
_chunk26JGOELHjs.isomorph_default.gzip = _nodeutil.promisify.call(void 0, zlib.gzip);
|
|
25574
|
+
_chunk26JGOELHjs.isomorph_default.gunzip = _nodeutil.promisify.call(void 0, zlib.gunzip);
|
|
25575
|
+
_chunk26JGOELHjs.isomorph_default.hash = (data) => crypto.createHash("sha256").update(data).digest("hex");
|
|
25501
25576
|
_internalSetInitialState();
|
|
25502
25577
|
registry.enable();
|
|
25503
25578
|
}
|
|
25504
25579
|
|
|
25505
25580
|
// src/exports.ts
|
|
25506
25581
|
var exports_exports = {};
|
|
25507
|
-
|
|
25582
|
+
_chunk26JGOELHjs.__export.call(void 0, exports_exports, {
|
|
25508
25583
|
Attachment: () => Attachment,
|
|
25509
25584
|
AttachmentReference: () => AttachmentReference,
|
|
25510
25585
|
BRAINTRUST_CURRENT_SPAN_STORE: () => BRAINTRUST_CURRENT_SPAN_STORE,
|
|
@@ -25522,6 +25597,7 @@ _chunkBW4DF4CYjs.__export.call(void 0, exports_exports, {
|
|
|
25522
25597
|
DEFAULT_FETCH_BATCH_SIZE: () => DEFAULT_FETCH_BATCH_SIZE,
|
|
25523
25598
|
DEFAULT_MAX_REQUEST_SIZE: () => DEFAULT_MAX_REQUEST_SIZE,
|
|
25524
25599
|
Dataset: () => Dataset2,
|
|
25600
|
+
DatasetPipeline: () => DatasetPipeline,
|
|
25525
25601
|
ERR_PERMALINK: () => ERR_PERMALINK,
|
|
25526
25602
|
Eval: () => Eval,
|
|
25527
25603
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
@@ -25555,7 +25631,7 @@ _chunkBW4DF4CYjs.__export.call(void 0, exports_exports, {
|
|
|
25555
25631
|
X_CACHED_HEADER: () => X_CACHED_HEADER,
|
|
25556
25632
|
_exportsForTestingOnly: () => _exportsForTestingOnly,
|
|
25557
25633
|
_internalGetGlobalState: () => _internalGetGlobalState,
|
|
25558
|
-
_internalIso: () =>
|
|
25634
|
+
_internalIso: () => _chunk26JGOELHjs.isomorph_default,
|
|
25559
25635
|
_internalSetInitialState: () => _internalSetInitialState,
|
|
25560
25636
|
addAzureBlobHeaders: () => addAzureBlobHeaders,
|
|
25561
25637
|
braintrustStreamChunkSchema: () => braintrustStreamChunkSchema,
|
|
@@ -25834,7 +25910,7 @@ function initFunction({
|
|
|
25834
25910
|
state
|
|
25835
25911
|
}) {
|
|
25836
25912
|
const s = _nullishCoalesce(state, () => ( _internalGetGlobalState()));
|
|
25837
|
-
_optionalChain([s, 'optionalAccess',
|
|
25913
|
+
_optionalChain([s, 'optionalAccess', _633 => _633.spanCache, 'optionalAccess', _634 => _634.disable, 'call', _635 => _635()]);
|
|
25838
25914
|
const f = async (input) => {
|
|
25839
25915
|
return await invoke({
|
|
25840
25916
|
projectName,
|
|
@@ -25911,22 +25987,22 @@ function responsesProxy(openai) {
|
|
|
25911
25987
|
if (name === "create" && typeof target.create === "function") {
|
|
25912
25988
|
return wrapResponsesAsync(
|
|
25913
25989
|
target.create.bind(target),
|
|
25914
|
-
|
|
25990
|
+
_chunk26JGOELHjs.openAIChannels.responsesCreate
|
|
25915
25991
|
);
|
|
25916
25992
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
25917
25993
|
return wrapResponsesSyncStream(
|
|
25918
25994
|
target.stream.bind(target),
|
|
25919
|
-
|
|
25995
|
+
_chunk26JGOELHjs.openAIChannels.responsesStream
|
|
25920
25996
|
);
|
|
25921
25997
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
25922
25998
|
return wrapResponsesAsync(
|
|
25923
25999
|
target.parse.bind(target),
|
|
25924
|
-
|
|
26000
|
+
_chunk26JGOELHjs.openAIChannels.responsesParse
|
|
25925
26001
|
);
|
|
25926
26002
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
25927
26003
|
return wrapResponsesAsync(
|
|
25928
26004
|
target.compact.bind(target),
|
|
25929
|
-
|
|
26005
|
+
_chunk26JGOELHjs.openAIChannels.responsesCompact
|
|
25930
26006
|
);
|
|
25931
26007
|
}
|
|
25932
26008
|
return Reflect.get(target, name, receiver);
|
|
@@ -25999,9 +26075,9 @@ function wrapOpenAIv4(openai) {
|
|
|
25999
26075
|
const embeddingProxy = createEndpointProxy(typedOpenai.embeddings, wrapEmbeddings);
|
|
26000
26076
|
const moderationProxy = createEndpointProxy(typedOpenai.moderations, wrapModerations);
|
|
26001
26077
|
let betaProxy3;
|
|
26002
|
-
if (_optionalChain([typedOpenai, 'access',
|
|
26078
|
+
if (_optionalChain([typedOpenai, 'access', _636 => _636.beta, 'optionalAccess', _637 => _637.chat, 'optionalAccess', _638 => _638.completions, 'optionalAccess', _639 => _639.stream])) {
|
|
26003
26079
|
const betaChatCompletionProxy = new Proxy(
|
|
26004
|
-
_optionalChain([typedOpenai, 'optionalAccess',
|
|
26080
|
+
_optionalChain([typedOpenai, 'optionalAccess', _640 => _640.beta, 'optionalAccess', _641 => _641.chat, 'access', _642 => _642.completions]),
|
|
26005
26081
|
{
|
|
26006
26082
|
get(target, name, receiver) {
|
|
26007
26083
|
const baseVal = Reflect.get(target, name, receiver);
|
|
@@ -26070,7 +26146,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
26070
26146
|
const { span_info, params } = splitSpanInfo(
|
|
26071
26147
|
allParams
|
|
26072
26148
|
);
|
|
26073
|
-
return
|
|
26149
|
+
return _chunk26JGOELHjs.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
26074
26150
|
async () => await completion(params),
|
|
26075
26151
|
{ arguments: [params], span_info }
|
|
26076
26152
|
);
|
|
@@ -26081,7 +26157,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
26081
26157
|
const { span_info, params } = splitSpanInfo(
|
|
26082
26158
|
allParams
|
|
26083
26159
|
);
|
|
26084
|
-
return
|
|
26160
|
+
return _chunk26JGOELHjs.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
26085
26161
|
() => completion(params),
|
|
26086
26162
|
{ arguments: [params], span_info }
|
|
26087
26163
|
);
|
|
@@ -26097,7 +26173,7 @@ function wrapChatCompletion(completion) {
|
|
|
26097
26173
|
if (!executionPromise) {
|
|
26098
26174
|
executionPromise = (async () => {
|
|
26099
26175
|
const traceContext = createChannelContext(
|
|
26100
|
-
|
|
26176
|
+
_chunk26JGOELHjs.openAIChannels.chatCompletionsCreate,
|
|
26101
26177
|
params,
|
|
26102
26178
|
span_info
|
|
26103
26179
|
);
|
|
@@ -26107,7 +26183,7 @@ function wrapChatCompletion(completion) {
|
|
|
26107
26183
|
options
|
|
26108
26184
|
);
|
|
26109
26185
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
26110
|
-
|
|
26186
|
+
_chunk26JGOELHjs.openAIChannels.chatCompletionsCreate,
|
|
26111
26187
|
traceContext,
|
|
26112
26188
|
completionPromise
|
|
26113
26189
|
);
|
|
@@ -26118,7 +26194,7 @@ function wrapChatCompletion(completion) {
|
|
|
26118
26194
|
options
|
|
26119
26195
|
);
|
|
26120
26196
|
const { data, response } = await tracePromiseWithResponse(
|
|
26121
|
-
|
|
26197
|
+
_chunk26JGOELHjs.openAIChannels.chatCompletionsCreate,
|
|
26122
26198
|
traceContext,
|
|
26123
26199
|
completionResponse
|
|
26124
26200
|
);
|
|
@@ -26161,15 +26237,15 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
26161
26237
|
return createLazyAPIPromise(ensureExecuted);
|
|
26162
26238
|
};
|
|
26163
26239
|
}
|
|
26164
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
26165
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
26240
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunk26JGOELHjs.openAIChannels.embeddingsCreate);
|
|
26241
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunk26JGOELHjs.openAIChannels.moderationsCreate);
|
|
26166
26242
|
|
|
26167
26243
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
26168
26244
|
function isModuleNamespace(obj) {
|
|
26169
26245
|
if (!obj || typeof obj !== "object") {
|
|
26170
26246
|
return false;
|
|
26171
26247
|
}
|
|
26172
|
-
if (_optionalChain([obj, 'access',
|
|
26248
|
+
if (_optionalChain([obj, 'access', _643 => _643.constructor, 'optionalAccess', _644 => _644.name]) === "Module") {
|
|
26173
26249
|
return true;
|
|
26174
26250
|
}
|
|
26175
26251
|
try {
|
|
@@ -26249,7 +26325,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
26249
26325
|
var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
26250
26326
|
const defaultName = `${instance.constructor.name}.generate`;
|
|
26251
26327
|
return async (params) => makeGenerateTextWrapper(
|
|
26252
|
-
|
|
26328
|
+
_chunk26JGOELHjs.aiSDKChannels.generateText,
|
|
26253
26329
|
defaultName,
|
|
26254
26330
|
generate.bind(instance),
|
|
26255
26331
|
{
|
|
@@ -26262,7 +26338,7 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
26262
26338
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
26263
26339
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
26264
26340
|
return (params) => makeStreamWrapper(
|
|
26265
|
-
|
|
26341
|
+
_chunk26JGOELHjs.aiSDKChannels.agentStream,
|
|
26266
26342
|
defaultName,
|
|
26267
26343
|
stream.bind(instance),
|
|
26268
26344
|
{
|
|
@@ -26294,7 +26370,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
26294
26370
|
};
|
|
26295
26371
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
26296
26372
|
return makeGenerateTextWrapper(
|
|
26297
|
-
|
|
26373
|
+
_chunk26JGOELHjs.aiSDKChannels.generateText,
|
|
26298
26374
|
"generateText",
|
|
26299
26375
|
generateText,
|
|
26300
26376
|
{ aiSDK },
|
|
@@ -26303,7 +26379,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
26303
26379
|
};
|
|
26304
26380
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
26305
26381
|
return makeGenerateTextWrapper(
|
|
26306
|
-
|
|
26382
|
+
_chunk26JGOELHjs.aiSDKChannels.generateObject,
|
|
26307
26383
|
"generateObject",
|
|
26308
26384
|
generateObject,
|
|
26309
26385
|
{ aiSDK },
|
|
@@ -26332,7 +26408,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
26332
26408
|
};
|
|
26333
26409
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
26334
26410
|
return makeEmbedWrapper(
|
|
26335
|
-
|
|
26411
|
+
_chunk26JGOELHjs.aiSDKChannels.embed,
|
|
26336
26412
|
"embed",
|
|
26337
26413
|
embed,
|
|
26338
26414
|
{ aiSDK },
|
|
@@ -26341,7 +26417,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
26341
26417
|
};
|
|
26342
26418
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
26343
26419
|
return makeEmbedWrapper(
|
|
26344
|
-
|
|
26420
|
+
_chunk26JGOELHjs.aiSDKChannels.embedMany,
|
|
26345
26421
|
"embedMany",
|
|
26346
26422
|
embedMany,
|
|
26347
26423
|
{ aiSDK },
|
|
@@ -26352,7 +26428,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
26352
26428
|
const wrapper = async function(allParams) {
|
|
26353
26429
|
const { span_info, ...params } = allParams;
|
|
26354
26430
|
const tracedParams = { ...params };
|
|
26355
|
-
return
|
|
26431
|
+
return _chunk26JGOELHjs.aiSDKChannels.rerank.tracePromise(
|
|
26356
26432
|
() => rerank(tracedParams),
|
|
26357
26433
|
createAISDKChannelContext(tracedParams, {
|
|
26358
26434
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -26391,7 +26467,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
26391
26467
|
};
|
|
26392
26468
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
26393
26469
|
return makeStreamWrapper(
|
|
26394
|
-
|
|
26470
|
+
_chunk26JGOELHjs.aiSDKChannels.streamText,
|
|
26395
26471
|
"streamText",
|
|
26396
26472
|
streamText,
|
|
26397
26473
|
{ aiSDK },
|
|
@@ -26400,7 +26476,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
26400
26476
|
};
|
|
26401
26477
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
26402
26478
|
return makeStreamWrapper(
|
|
26403
|
-
|
|
26479
|
+
_chunk26JGOELHjs.aiSDKChannels.streamObject,
|
|
26404
26480
|
"streamObject",
|
|
26405
26481
|
streamObject,
|
|
26406
26482
|
{ aiSDK },
|
|
@@ -26413,11 +26489,11 @@ function mergeSpanInfo(spanInfo, defaults) {
|
|
|
26413
26489
|
}
|
|
26414
26490
|
return {
|
|
26415
26491
|
...spanInfo,
|
|
26416
|
-
..._optionalChain([spanInfo, 'optionalAccess',
|
|
26417
|
-
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess',
|
|
26492
|
+
..._optionalChain([spanInfo, 'optionalAccess', _645 => _645.name]) ? {} : defaults.name ? { name: defaults.name } : {},
|
|
26493
|
+
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _646 => _646.spanAttributes]) ? {
|
|
26418
26494
|
spanAttributes: {
|
|
26419
26495
|
...defaults.spanType !== void 0 ? { type: defaults.spanType } : {},
|
|
26420
|
-
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess',
|
|
26496
|
+
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _647 => _647.spanAttributes]), () => ( {}))
|
|
26421
26497
|
}
|
|
26422
26498
|
} : {}
|
|
26423
26499
|
};
|
|
@@ -26435,7 +26511,7 @@ function createAISDKChannelContext(params, context = {}) {
|
|
|
26435
26511
|
// src/wrappers/ai-sdk/deprecated/wrapAISDKModel.ts
|
|
26436
26512
|
function wrapAISDKModel(model) {
|
|
26437
26513
|
const m = model;
|
|
26438
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
26514
|
+
if (_optionalChain([m, 'optionalAccess', _648 => _648.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _649 => _649.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _650 => _650.modelId]) === "string") {
|
|
26439
26515
|
return new BraintrustLanguageModelWrapper(m);
|
|
26440
26516
|
} else {
|
|
26441
26517
|
console.warn("Unsupported AI SDK model. Not wrapping.");
|
|
@@ -26492,10 +26568,10 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
26492
26568
|
metrics: {
|
|
26493
26569
|
time_to_first_token: getCurrentUnixTimestamp() - startTime,
|
|
26494
26570
|
tokens: !isEmpty2(ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
26495
|
-
prompt_tokens: _optionalChain([ret, 'access',
|
|
26496
|
-
completion_tokens: _optionalChain([ret, 'access',
|
|
26571
|
+
prompt_tokens: _optionalChain([ret, 'access', _651 => _651.usage, 'optionalAccess', _652 => _652.promptTokens]),
|
|
26572
|
+
completion_tokens: _optionalChain([ret, 'access', _653 => _653.usage, 'optionalAccess', _654 => _654.completionTokens]),
|
|
26497
26573
|
cached: parseCachedHeader(
|
|
26498
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
26574
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _655 => _655.rawResponse, 'optionalAccess', _656 => _656.headers, 'optionalAccess', _657 => _657[X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _658 => _658.rawResponse, 'optionalAccess', _659 => _659.headers, 'optionalAccess', _660 => _660[LEGACY_CACHED_HEADER]])))
|
|
26499
26575
|
)
|
|
26500
26576
|
}
|
|
26501
26577
|
});
|
|
@@ -26587,10 +26663,10 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
26587
26663
|
metrics: {
|
|
26588
26664
|
time_to_first_token,
|
|
26589
26665
|
tokens: !isEmpty2(usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
26590
|
-
prompt_tokens: _optionalChain([usage, 'optionalAccess',
|
|
26591
|
-
completion_tokens: _optionalChain([usage, 'optionalAccess',
|
|
26666
|
+
prompt_tokens: _optionalChain([usage, 'optionalAccess', _661 => _661.promptTokens]),
|
|
26667
|
+
completion_tokens: _optionalChain([usage, 'optionalAccess', _662 => _662.completionTokens]),
|
|
26592
26668
|
cached: parseCachedHeader(
|
|
26593
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
26669
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _663 => _663.rawResponse, 'optionalAccess', _664 => _664.headers, 'optionalAccess', _665 => _665[X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _666 => _666.rawResponse, 'optionalAccess', _667 => _667.headers, 'optionalAccess', _668 => _668[LEGACY_CACHED_HEADER]])))
|
|
26594
26670
|
)
|
|
26595
26671
|
}
|
|
26596
26672
|
});
|
|
@@ -26634,7 +26710,7 @@ function postProcessPrompt(prompt) {
|
|
|
26634
26710
|
return [
|
|
26635
26711
|
{
|
|
26636
26712
|
role: "assistant",
|
|
26637
|
-
content: _optionalChain([textPart, 'optionalAccess',
|
|
26713
|
+
content: _optionalChain([textPart, 'optionalAccess', _669 => _669.text]),
|
|
26638
26714
|
...toolCallParts.length > 0 ? {
|
|
26639
26715
|
tool_calls: toolCallParts.map((part) => ({
|
|
26640
26716
|
id: part.toolCallId,
|
|
@@ -26707,23 +26783,23 @@ function postProcessOutput(text, toolCalls, finishReason) {
|
|
|
26707
26783
|
|
|
26708
26784
|
// src/wrappers/ai-sdk/deprecated/BraintrustMiddleware.ts
|
|
26709
26785
|
function detectProviderFromResult(result) {
|
|
26710
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
26786
|
+
if (!_optionalChain([result, 'optionalAccess', _670 => _670.providerMetadata])) {
|
|
26711
26787
|
return void 0;
|
|
26712
26788
|
}
|
|
26713
26789
|
const keys = Object.keys(result.providerMetadata);
|
|
26714
|
-
return _optionalChain([keys, 'optionalAccess',
|
|
26790
|
+
return _optionalChain([keys, 'optionalAccess', _671 => _671.at, 'call', _672 => _672(0)]);
|
|
26715
26791
|
}
|
|
26716
26792
|
function extractModelFromResult(result) {
|
|
26717
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
26793
|
+
if (_optionalChain([result, 'optionalAccess', _673 => _673.response, 'optionalAccess', _674 => _674.modelId])) {
|
|
26718
26794
|
return result.response.modelId;
|
|
26719
26795
|
}
|
|
26720
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
26796
|
+
if (_optionalChain([result, 'optionalAccess', _675 => _675.request, 'optionalAccess', _676 => _676.body, 'optionalAccess', _677 => _677.model])) {
|
|
26721
26797
|
return result.request.body.model;
|
|
26722
26798
|
}
|
|
26723
26799
|
return void 0;
|
|
26724
26800
|
}
|
|
26725
26801
|
function extractModelFromWrapGenerateCallback(model) {
|
|
26726
|
-
return _optionalChain([model, 'optionalAccess',
|
|
26802
|
+
return _optionalChain([model, 'optionalAccess', _678 => _678.modelId]);
|
|
26727
26803
|
}
|
|
26728
26804
|
function camelToSnake4(str) {
|
|
26729
26805
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
@@ -26768,7 +26844,7 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
26768
26844
|
metrics.prompt_cached_tokens = cachedInputTokens;
|
|
26769
26845
|
}
|
|
26770
26846
|
if (provider === "anthropic") {
|
|
26771
|
-
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess',
|
|
26847
|
+
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _679 => _679.anthropic]);
|
|
26772
26848
|
if (anthropicMetadata) {
|
|
26773
26849
|
const cacheReadTokens = getNumberProperty3(anthropicMetadata.usage, "cache_read_input_tokens") || 0;
|
|
26774
26850
|
const cacheCreationTokens = getNumberProperty3(
|
|
@@ -26794,7 +26870,7 @@ function buildAssistantOutputWithToolCalls(result, toolCalls) {
|
|
|
26794
26870
|
{
|
|
26795
26871
|
index: 0,
|
|
26796
26872
|
logprobs: null,
|
|
26797
|
-
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess',
|
|
26873
|
+
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _680 => _680.finishReason])), () => ( (toolCalls.length ? "tool_calls" : void 0))),
|
|
26798
26874
|
message: {
|
|
26799
26875
|
role: "assistant",
|
|
26800
26876
|
tool_calls: toolCalls.length > 0 ? toolCalls : void 0
|
|
@@ -26807,7 +26883,7 @@ function extractToolCallsFromSteps(steps) {
|
|
|
26807
26883
|
if (!Array.isArray(steps)) return toolCalls;
|
|
26808
26884
|
let idx = 0;
|
|
26809
26885
|
for (const step of steps) {
|
|
26810
|
-
const blocks = _optionalChain([step, 'optionalAccess',
|
|
26886
|
+
const blocks = _optionalChain([step, 'optionalAccess', _681 => _681.content]);
|
|
26811
26887
|
if (!Array.isArray(blocks)) continue;
|
|
26812
26888
|
for (const block of blocks) {
|
|
26813
26889
|
if (block && typeof block === "object" && block.type === "tool-call") {
|
|
@@ -26830,7 +26906,7 @@ function extractToolCallsFromBlocks(blocks) {
|
|
|
26830
26906
|
return extractToolCallsFromSteps([{ content: blocks }]);
|
|
26831
26907
|
}
|
|
26832
26908
|
function extractInput(params) {
|
|
26833
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
26909
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _682 => _682.prompt]), () => ( _optionalChain([params, 'optionalAccess', _683 => _683.messages]))), () => ( _optionalChain([params, 'optionalAccess', _684 => _684.system])));
|
|
26834
26910
|
}
|
|
26835
26911
|
var V2_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
|
|
26836
26912
|
"prompt",
|
|
@@ -26854,16 +26930,16 @@ function BraintrustMiddleware(config = {}) {
|
|
|
26854
26930
|
const rawInput = extractInput(params);
|
|
26855
26931
|
const processedInput = processInputAttachments(rawInput);
|
|
26856
26932
|
const spanArgs = {
|
|
26857
|
-
name: _optionalChain([config, 'access',
|
|
26933
|
+
name: _optionalChain([config, 'access', _685 => _685.spanInfo, 'optionalAccess', _686 => _686.name]) || "ai-sdk.doGenerate",
|
|
26858
26934
|
spanAttributes: {
|
|
26859
26935
|
type: "llm" /* LLM */,
|
|
26860
|
-
..._optionalChain([config, 'access',
|
|
26936
|
+
..._optionalChain([config, 'access', _687 => _687.spanInfo, 'optionalAccess', _688 => _688.spanAttributes]) || {}
|
|
26861
26937
|
},
|
|
26862
26938
|
event: {
|
|
26863
26939
|
input: processedInput,
|
|
26864
26940
|
metadata: {
|
|
26865
26941
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
26866
|
-
..._optionalChain([config, 'access',
|
|
26942
|
+
..._optionalChain([config, 'access', _689 => _689.spanInfo, 'optionalAccess', _690 => _690.metadata]) || {}
|
|
26867
26943
|
}
|
|
26868
26944
|
}
|
|
26869
26945
|
};
|
|
@@ -26889,12 +26965,12 @@ function BraintrustMiddleware(config = {}) {
|
|
|
26889
26965
|
metadata.model = modelId;
|
|
26890
26966
|
}
|
|
26891
26967
|
}
|
|
26892
|
-
let toolCalls = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess',
|
|
26968
|
+
let toolCalls = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _691 => _691.steps]));
|
|
26893
26969
|
if (!toolCalls || toolCalls.length === 0) {
|
|
26894
|
-
toolCalls = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess',
|
|
26970
|
+
toolCalls = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _692 => _692.content]));
|
|
26895
26971
|
}
|
|
26896
26972
|
span.log({
|
|
26897
|
-
output: toolCalls.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls) : _optionalChain([result, 'optionalAccess',
|
|
26973
|
+
output: toolCalls.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls) : _optionalChain([result, 'optionalAccess', _693 => _693.content]),
|
|
26898
26974
|
metadata,
|
|
26899
26975
|
metrics: normalizeUsageMetrics(
|
|
26900
26976
|
result.usage,
|
|
@@ -26916,16 +26992,16 @@ function BraintrustMiddleware(config = {}) {
|
|
|
26916
26992
|
const rawInput = extractInput(params);
|
|
26917
26993
|
const processedInput = processInputAttachments(rawInput);
|
|
26918
26994
|
const spanArgs = {
|
|
26919
|
-
name: _optionalChain([config, 'access',
|
|
26995
|
+
name: _optionalChain([config, 'access', _694 => _694.spanInfo, 'optionalAccess', _695 => _695.name]) || "ai-sdk.doStream",
|
|
26920
26996
|
spanAttributes: {
|
|
26921
26997
|
type: "llm" /* LLM */,
|
|
26922
|
-
..._optionalChain([config, 'access',
|
|
26998
|
+
..._optionalChain([config, 'access', _696 => _696.spanInfo, 'optionalAccess', _697 => _697.spanAttributes]) || {}
|
|
26923
26999
|
},
|
|
26924
27000
|
event: {
|
|
26925
27001
|
input: processedInput,
|
|
26926
27002
|
metadata: {
|
|
26927
27003
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
26928
|
-
..._optionalChain([config, 'access',
|
|
27004
|
+
..._optionalChain([config, 'access', _698 => _698.spanInfo, 'optionalAccess', _699 => _699.metadata]) || {}
|
|
26929
27005
|
}
|
|
26930
27006
|
}
|
|
26931
27007
|
};
|
|
@@ -27068,7 +27144,7 @@ function messagesProxy(messages) {
|
|
|
27068
27144
|
return new Proxy(messages, {
|
|
27069
27145
|
get(target, prop, receiver) {
|
|
27070
27146
|
if (prop === "create") {
|
|
27071
|
-
return createProxy(target.create,
|
|
27147
|
+
return createProxy(target.create, _chunk26JGOELHjs.anthropicChannels.messagesCreate);
|
|
27072
27148
|
}
|
|
27073
27149
|
return Reflect.get(target, prop, receiver);
|
|
27074
27150
|
}
|
|
@@ -27078,7 +27154,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
27078
27154
|
return new Proxy(messages, {
|
|
27079
27155
|
get(target, prop, receiver) {
|
|
27080
27156
|
if (prop === "create") {
|
|
27081
|
-
return createProxy(target.create,
|
|
27157
|
+
return createProxy(target.create, _chunk26JGOELHjs.anthropicChannels.betaMessagesCreate);
|
|
27082
27158
|
}
|
|
27083
27159
|
if (prop === "toolRunner") {
|
|
27084
27160
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -27087,7 +27163,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
27087
27163
|
return toolRunnerProxy(
|
|
27088
27164
|
target.toolRunner,
|
|
27089
27165
|
anthropic,
|
|
27090
|
-
|
|
27166
|
+
_chunk26JGOELHjs.anthropicChannels.betaMessagesToolRunner
|
|
27091
27167
|
);
|
|
27092
27168
|
}
|
|
27093
27169
|
return Reflect.get(target, prop, receiver);
|
|
@@ -27153,7 +27229,7 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
27153
27229
|
}
|
|
27154
27230
|
};
|
|
27155
27231
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
27156
|
-
return
|
|
27232
|
+
return _chunk26JGOELHjs.claudeAgentSDKChannels.query.traceSync(
|
|
27157
27233
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
27158
27234
|
// The channel carries no extra context fields, but the generated
|
|
27159
27235
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -27199,8 +27275,8 @@ function wrapCreateSdkMcpServer(createSdkMcpServerFn, localToolMetadataByTool, d
|
|
|
27199
27275
|
apply(target, thisArg, argArray) {
|
|
27200
27276
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
27201
27277
|
const config = argArray[0];
|
|
27202
|
-
const serverName = _optionalChain([config, 'optionalAccess',
|
|
27203
|
-
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
27278
|
+
const serverName = _optionalChain([config, 'optionalAccess', _700 => _700.name]);
|
|
27279
|
+
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _701 => _701.tools]))) {
|
|
27204
27280
|
for (const tool of config.tools) {
|
|
27205
27281
|
if (!tool || typeof tool !== "object") {
|
|
27206
27282
|
continue;
|
|
@@ -27294,7 +27370,7 @@ function isModuleNamespace2(obj) {
|
|
|
27294
27370
|
if (!obj || typeof obj !== "object") {
|
|
27295
27371
|
return false;
|
|
27296
27372
|
}
|
|
27297
|
-
if (_optionalChain([obj, 'access',
|
|
27373
|
+
if (_optionalChain([obj, 'access', _702 => _702.constructor, 'optionalAccess', _703 => _703.name]) === "Module") {
|
|
27298
27374
|
return true;
|
|
27299
27375
|
}
|
|
27300
27376
|
const keys = Object.keys(obj);
|
|
@@ -27364,7 +27440,7 @@ function wrapCodexThread(thread) {
|
|
|
27364
27440
|
if (prop === "run" && typeof value === "function") {
|
|
27365
27441
|
return function(input, turnOptions) {
|
|
27366
27442
|
const args = [input, turnOptions];
|
|
27367
|
-
return
|
|
27443
|
+
return _chunk26JGOELHjs.openAICodexChannels.run.tracePromise(
|
|
27368
27444
|
() => Reflect.apply(value, target, args),
|
|
27369
27445
|
{
|
|
27370
27446
|
arguments: args,
|
|
@@ -27377,7 +27453,7 @@ function wrapCodexThread(thread) {
|
|
|
27377
27453
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
27378
27454
|
return function(input, turnOptions) {
|
|
27379
27455
|
const args = [input, turnOptions];
|
|
27380
|
-
return
|
|
27456
|
+
return _chunk26JGOELHjs.openAICodexChannels.runStreamed.tracePromise(
|
|
27381
27457
|
() => Reflect.apply(value, target, args),
|
|
27382
27458
|
{
|
|
27383
27459
|
arguments: args,
|
|
@@ -27424,7 +27500,7 @@ function isModuleNamespace3(obj) {
|
|
|
27424
27500
|
if (!obj || typeof obj !== "object") {
|
|
27425
27501
|
return false;
|
|
27426
27502
|
}
|
|
27427
|
-
if (_optionalChain([obj, 'access',
|
|
27503
|
+
if (_optionalChain([obj, 'access', _704 => _704.constructor, 'optionalAccess', _705 => _705.name]) === "Module") {
|
|
27428
27504
|
return true;
|
|
27429
27505
|
}
|
|
27430
27506
|
const keys = Object.keys(obj);
|
|
@@ -27445,7 +27521,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27445
27521
|
if (prop === "create" && typeof value === "function") {
|
|
27446
27522
|
const wrapped = async function(options) {
|
|
27447
27523
|
const args = [options];
|
|
27448
|
-
return
|
|
27524
|
+
return _chunk26JGOELHjs.cursorSDKChannels.create.tracePromise(
|
|
27449
27525
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
27450
27526
|
{ arguments: args }
|
|
27451
27527
|
);
|
|
@@ -27456,7 +27532,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27456
27532
|
if (prop === "resume" && typeof value === "function") {
|
|
27457
27533
|
const wrapped = async function(agentId, options) {
|
|
27458
27534
|
const args = [agentId, options];
|
|
27459
|
-
return
|
|
27535
|
+
return _chunk26JGOELHjs.cursorSDKChannels.resume.tracePromise(
|
|
27460
27536
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
27461
27537
|
{ arguments: args }
|
|
27462
27538
|
);
|
|
@@ -27467,7 +27543,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
27467
27543
|
if (prop === "prompt" && typeof value === "function") {
|
|
27468
27544
|
const wrapped = async function(message, options) {
|
|
27469
27545
|
const args = [message, options];
|
|
27470
|
-
return
|
|
27546
|
+
return _chunk26JGOELHjs.cursorSDKChannels.prompt.tracePromise(
|
|
27471
27547
|
() => Reflect.apply(value, target, args),
|
|
27472
27548
|
{ arguments: args }
|
|
27473
27549
|
);
|
|
@@ -27500,7 +27576,7 @@ function wrapCursorAgent(agent) {
|
|
|
27500
27576
|
if (prop === "send" && typeof value === "function") {
|
|
27501
27577
|
return function(message, options) {
|
|
27502
27578
|
const args = [message, options];
|
|
27503
|
-
return
|
|
27579
|
+
return _chunk26JGOELHjs.cursorSDKChannels.send.tracePromise(
|
|
27504
27580
|
() => Reflect.apply(value, target, args),
|
|
27505
27581
|
{
|
|
27506
27582
|
agent: target,
|
|
@@ -27589,7 +27665,7 @@ function wrapModels(models) {
|
|
|
27589
27665
|
}
|
|
27590
27666
|
function wrapGenerateContent(original) {
|
|
27591
27667
|
return function(params) {
|
|
27592
|
-
return
|
|
27668
|
+
return _chunk26JGOELHjs.googleGenAIChannels.generateContent.tracePromise(
|
|
27593
27669
|
() => original(params),
|
|
27594
27670
|
{ arguments: [params] }
|
|
27595
27671
|
);
|
|
@@ -27597,7 +27673,7 @@ function wrapGenerateContent(original) {
|
|
|
27597
27673
|
}
|
|
27598
27674
|
function wrapGenerateContentStream(original) {
|
|
27599
27675
|
return function(params) {
|
|
27600
|
-
return
|
|
27676
|
+
return _chunk26JGOELHjs.googleGenAIChannels.generateContentStream.tracePromise(
|
|
27601
27677
|
() => original(params),
|
|
27602
27678
|
{ arguments: [params] }
|
|
27603
27679
|
);
|
|
@@ -27605,7 +27681,7 @@ function wrapGenerateContentStream(original) {
|
|
|
27605
27681
|
}
|
|
27606
27682
|
function wrapEmbedContent(original) {
|
|
27607
27683
|
return function(params) {
|
|
27608
|
-
return
|
|
27684
|
+
return _chunk26JGOELHjs.googleGenAIChannels.embedContent.tracePromise(
|
|
27609
27685
|
() => original(params),
|
|
27610
27686
|
{ arguments: [params] }
|
|
27611
27687
|
);
|
|
@@ -27666,7 +27742,7 @@ function wrapRunnerInstance(runner) {
|
|
|
27666
27742
|
function wrapRunnerRunAsync(runner) {
|
|
27667
27743
|
const original = runner.runAsync.bind(runner);
|
|
27668
27744
|
return function(params) {
|
|
27669
|
-
return
|
|
27745
|
+
return _chunk26JGOELHjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
27670
27746
|
arguments: [params],
|
|
27671
27747
|
self: runner
|
|
27672
27748
|
});
|
|
@@ -27693,7 +27769,7 @@ function wrapAgentInstance(agent) {
|
|
|
27693
27769
|
function wrapAgentRunAsync(agent) {
|
|
27694
27770
|
const original = agent.runAsync.bind(agent);
|
|
27695
27771
|
return function(parentContext) {
|
|
27696
|
-
return
|
|
27772
|
+
return _chunk26JGOELHjs.googleADKChannels.agentRunAsync.traceSync(
|
|
27697
27773
|
() => original(parentContext),
|
|
27698
27774
|
{ arguments: [parentContext], self: agent }
|
|
27699
27775
|
);
|
|
@@ -27720,7 +27796,7 @@ function wrapToolInstance(tool) {
|
|
|
27720
27796
|
function wrapToolRunAsync(tool) {
|
|
27721
27797
|
const original = tool.runAsync.bind(tool);
|
|
27722
27798
|
return function(req) {
|
|
27723
|
-
return
|
|
27799
|
+
return _chunk26JGOELHjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
27724
27800
|
arguments: [req],
|
|
27725
27801
|
self: tool
|
|
27726
27802
|
});
|
|
@@ -27867,27 +27943,27 @@ function patchGenkitRegistryConstructor(registry2) {
|
|
|
27867
27943
|
}
|
|
27868
27944
|
}
|
|
27869
27945
|
function wrapGenerate(generate) {
|
|
27870
|
-
return (input) =>
|
|
27946
|
+
return (input) => _chunk26JGOELHjs.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
27871
27947
|
arguments: [input]
|
|
27872
27948
|
});
|
|
27873
27949
|
}
|
|
27874
27950
|
function wrapGenerateStream(generateStream) {
|
|
27875
|
-
return (input) =>
|
|
27951
|
+
return (input) => _chunk26JGOELHjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
27876
27952
|
arguments: [input]
|
|
27877
27953
|
});
|
|
27878
27954
|
}
|
|
27879
27955
|
function wrapEmbed2(embed) {
|
|
27880
|
-
return (params) =>
|
|
27956
|
+
return (params) => _chunk26JGOELHjs.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
27881
27957
|
arguments: [params]
|
|
27882
27958
|
});
|
|
27883
27959
|
}
|
|
27884
27960
|
function wrapEmbedMany2(embedMany) {
|
|
27885
|
-
return (params) =>
|
|
27961
|
+
return (params) => _chunk26JGOELHjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
27886
27962
|
arguments: [params]
|
|
27887
27963
|
});
|
|
27888
27964
|
}
|
|
27889
27965
|
function wrapRun(run) {
|
|
27890
|
-
return (name, inputOrFn, maybeFn) =>
|
|
27966
|
+
return (name, inputOrFn, maybeFn) => _chunk26JGOELHjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
27891
27967
|
arguments: [name, inputOrFn, maybeFn]
|
|
27892
27968
|
});
|
|
27893
27969
|
}
|
|
@@ -27926,13 +28002,13 @@ function isGenkitAction(value) {
|
|
|
27926
28002
|
return typeof value === "function" && "__action" in value;
|
|
27927
28003
|
}
|
|
27928
28004
|
function traceActionRun(action, run) {
|
|
27929
|
-
return (input, options) =>
|
|
28005
|
+
return (input, options) => _chunk26JGOELHjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
27930
28006
|
arguments: [input, options],
|
|
27931
28007
|
self: action
|
|
27932
28008
|
});
|
|
27933
28009
|
}
|
|
27934
28010
|
function traceActionStream(action, stream) {
|
|
27935
|
-
return (input, options) =>
|
|
28011
|
+
return (input, options) => _chunk26JGOELHjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
27936
28012
|
arguments: [input, options],
|
|
27937
28013
|
self: action
|
|
27938
28014
|
});
|
|
@@ -28089,14 +28165,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
28089
28165
|
const context = {
|
|
28090
28166
|
arguments: [traceParams]
|
|
28091
28167
|
};
|
|
28092
|
-
return
|
|
28168
|
+
return _chunk26JGOELHjs.huggingFaceChannels.chatCompletion.tracePromise(
|
|
28093
28169
|
() => original(params, options),
|
|
28094
28170
|
context
|
|
28095
28171
|
);
|
|
28096
28172
|
};
|
|
28097
28173
|
}
|
|
28098
28174
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
28099
|
-
return (params, options) =>
|
|
28175
|
+
return (params, options) => _chunk26JGOELHjs.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
28100
28176
|
() => original(params, options),
|
|
28101
28177
|
{
|
|
28102
28178
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -28109,14 +28185,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
28109
28185
|
const context = {
|
|
28110
28186
|
arguments: [traceParams]
|
|
28111
28187
|
};
|
|
28112
|
-
return
|
|
28188
|
+
return _chunk26JGOELHjs.huggingFaceChannels.textGeneration.tracePromise(
|
|
28113
28189
|
() => original(params, options),
|
|
28114
28190
|
context
|
|
28115
28191
|
);
|
|
28116
28192
|
};
|
|
28117
28193
|
}
|
|
28118
28194
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
28119
|
-
return (params, options) =>
|
|
28195
|
+
return (params, options) => _chunk26JGOELHjs.huggingFaceChannels.textGenerationStream.traceSync(
|
|
28120
28196
|
() => original(params, options),
|
|
28121
28197
|
{
|
|
28122
28198
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -28129,7 +28205,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
28129
28205
|
const context = {
|
|
28130
28206
|
arguments: [traceParams]
|
|
28131
28207
|
};
|
|
28132
|
-
return
|
|
28208
|
+
return _chunk26JGOELHjs.huggingFaceChannels.featureExtraction.tracePromise(
|
|
28133
28209
|
() => original(params, options),
|
|
28134
28210
|
context
|
|
28135
28211
|
);
|
|
@@ -28176,7 +28252,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
28176
28252
|
const request = cloneCallModelRequest(argArray[0]);
|
|
28177
28253
|
const options = argArray[1];
|
|
28178
28254
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
28179
|
-
return
|
|
28255
|
+
return _chunk26JGOELHjs.openRouterAgentChannels.callModel.traceSync(
|
|
28180
28256
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
28181
28257
|
{
|
|
28182
28258
|
arguments: [request]
|
|
@@ -28272,24 +28348,24 @@ function rerankProxy(rerank) {
|
|
|
28272
28348
|
});
|
|
28273
28349
|
}
|
|
28274
28350
|
function wrapChatSend(send) {
|
|
28275
|
-
return (request, options) =>
|
|
28351
|
+
return (request, options) => _chunk26JGOELHjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
28276
28352
|
arguments: [request]
|
|
28277
28353
|
});
|
|
28278
28354
|
}
|
|
28279
28355
|
function wrapEmbeddingsGenerate(generate) {
|
|
28280
|
-
return (request, options) =>
|
|
28356
|
+
return (request, options) => _chunk26JGOELHjs.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
28281
28357
|
() => generate(request, options),
|
|
28282
28358
|
{ arguments: [request] }
|
|
28283
28359
|
);
|
|
28284
28360
|
}
|
|
28285
28361
|
function wrapResponsesSend(send) {
|
|
28286
|
-
return (request, options) =>
|
|
28362
|
+
return (request, options) => _chunk26JGOELHjs.openRouterChannels.betaResponsesSend.tracePromise(
|
|
28287
28363
|
() => send(request, options),
|
|
28288
28364
|
{ arguments: [request] }
|
|
28289
28365
|
);
|
|
28290
28366
|
}
|
|
28291
28367
|
function wrapRerank2(rerank) {
|
|
28292
|
-
return (request, options) =>
|
|
28368
|
+
return (request, options) => _chunk26JGOELHjs.openRouterChannels.rerankRerank.tracePromise(
|
|
28293
28369
|
() => rerank(request, options),
|
|
28294
28370
|
{ arguments: [request] }
|
|
28295
28371
|
);
|
|
@@ -28297,7 +28373,7 @@ function wrapRerank2(rerank) {
|
|
|
28297
28373
|
function wrapCallModel2(callModel) {
|
|
28298
28374
|
return (request, options) => {
|
|
28299
28375
|
const tracedRequest = { ...request };
|
|
28300
|
-
return
|
|
28376
|
+
return _chunk26JGOELHjs.openRouterChannels.callModel.traceSync(
|
|
28301
28377
|
() => callModel(tracedRequest, options),
|
|
28302
28378
|
{
|
|
28303
28379
|
arguments: [tracedRequest]
|
|
@@ -28430,7 +28506,7 @@ function classifiersProxy(classifiers) {
|
|
|
28430
28506
|
});
|
|
28431
28507
|
}
|
|
28432
28508
|
function wrapChatComplete(complete) {
|
|
28433
|
-
return (request, options) =>
|
|
28509
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.chatComplete.tracePromise(
|
|
28434
28510
|
() => complete(request, options),
|
|
28435
28511
|
{
|
|
28436
28512
|
arguments: [request]
|
|
@@ -28438,52 +28514,52 @@ function wrapChatComplete(complete) {
|
|
|
28438
28514
|
);
|
|
28439
28515
|
}
|
|
28440
28516
|
function wrapChatStream(stream) {
|
|
28441
|
-
return (request, options) =>
|
|
28517
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
28442
28518
|
arguments: [request]
|
|
28443
28519
|
});
|
|
28444
28520
|
}
|
|
28445
28521
|
function wrapEmbeddingsCreate(create) {
|
|
28446
|
-
return (request, options) =>
|
|
28522
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.embeddingsCreate.tracePromise(
|
|
28447
28523
|
() => create(request, options),
|
|
28448
28524
|
{ arguments: [request] }
|
|
28449
28525
|
);
|
|
28450
28526
|
}
|
|
28451
28527
|
function wrapClassifiersModerate(moderate) {
|
|
28452
|
-
return (request, options) =>
|
|
28528
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.classifiersModerate.tracePromise(
|
|
28453
28529
|
() => moderate(request, options),
|
|
28454
28530
|
{ arguments: [request] }
|
|
28455
28531
|
);
|
|
28456
28532
|
}
|
|
28457
28533
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
28458
|
-
return (request, options) =>
|
|
28534
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.classifiersModerateChat.tracePromise(
|
|
28459
28535
|
() => moderateChat(request, options),
|
|
28460
28536
|
{ arguments: [request] }
|
|
28461
28537
|
);
|
|
28462
28538
|
}
|
|
28463
28539
|
function wrapClassifiersClassify(classify) {
|
|
28464
|
-
return (request, options) =>
|
|
28540
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.classifiersClassify.tracePromise(
|
|
28465
28541
|
() => classify(request, options),
|
|
28466
28542
|
{ arguments: [request] }
|
|
28467
28543
|
);
|
|
28468
28544
|
}
|
|
28469
28545
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
28470
|
-
return (request, options) =>
|
|
28546
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
28471
28547
|
() => classifyChat(request, options),
|
|
28472
28548
|
{ arguments: [request] }
|
|
28473
28549
|
);
|
|
28474
28550
|
}
|
|
28475
28551
|
function wrapFimComplete(complete) {
|
|
28476
|
-
return (request, options) =>
|
|
28552
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
28477
28553
|
arguments: [request]
|
|
28478
28554
|
});
|
|
28479
28555
|
}
|
|
28480
28556
|
function wrapFimStream(stream) {
|
|
28481
|
-
return (request, options) =>
|
|
28557
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
28482
28558
|
arguments: [request]
|
|
28483
28559
|
});
|
|
28484
28560
|
}
|
|
28485
28561
|
function wrapAgentsComplete(complete) {
|
|
28486
|
-
return (request, options) =>
|
|
28562
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.agentsComplete.tracePromise(
|
|
28487
28563
|
() => complete(request, options),
|
|
28488
28564
|
{
|
|
28489
28565
|
arguments: [request]
|
|
@@ -28491,7 +28567,7 @@ function wrapAgentsComplete(complete) {
|
|
|
28491
28567
|
);
|
|
28492
28568
|
}
|
|
28493
28569
|
function wrapAgentsStream(stream) {
|
|
28494
|
-
return (request, options) =>
|
|
28570
|
+
return (request, options) => _chunk26JGOELHjs.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
28495
28571
|
arguments: [request]
|
|
28496
28572
|
});
|
|
28497
28573
|
}
|
|
@@ -28544,22 +28620,22 @@ function cohereProxy(cohere) {
|
|
|
28544
28620
|
return proxy;
|
|
28545
28621
|
}
|
|
28546
28622
|
function wrapChat(chat) {
|
|
28547
|
-
return (request, options) =>
|
|
28623
|
+
return (request, options) => _chunk26JGOELHjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
28548
28624
|
arguments: [request]
|
|
28549
28625
|
});
|
|
28550
28626
|
}
|
|
28551
28627
|
function wrapChatStream2(chatStream) {
|
|
28552
|
-
return (request, options) =>
|
|
28628
|
+
return (request, options) => _chunk26JGOELHjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
28553
28629
|
arguments: [request]
|
|
28554
28630
|
});
|
|
28555
28631
|
}
|
|
28556
28632
|
function wrapEmbed3(embed) {
|
|
28557
|
-
return (request, options) =>
|
|
28633
|
+
return (request, options) => _chunk26JGOELHjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
28558
28634
|
arguments: [request]
|
|
28559
28635
|
});
|
|
28560
28636
|
}
|
|
28561
28637
|
function wrapRerank3(rerank) {
|
|
28562
|
-
return (request, options) =>
|
|
28638
|
+
return (request, options) => _chunk26JGOELHjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
28563
28639
|
arguments: [request]
|
|
28564
28640
|
});
|
|
28565
28641
|
}
|
|
@@ -28589,7 +28665,7 @@ function isSupportedGroqClient(value) {
|
|
|
28589
28665
|
}
|
|
28590
28666
|
function groqProxy(groq) {
|
|
28591
28667
|
const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
|
|
28592
|
-
const completionProxy = _optionalChain([groq, 'access',
|
|
28668
|
+
const completionProxy = _optionalChain([groq, 'access', _706 => _706.chat, 'optionalAccess', _707 => _707.completions]) ? new Proxy(groq.chat.completions, {
|
|
28593
28669
|
get(target, prop, receiver) {
|
|
28594
28670
|
if (prop === "create") {
|
|
28595
28671
|
return wrapChatCompletionsCreate(target.create.bind(target));
|
|
@@ -28641,13 +28717,13 @@ function groqProxy(groq) {
|
|
|
28641
28717
|
return topLevelProxy;
|
|
28642
28718
|
}
|
|
28643
28719
|
function wrapChatCompletionsCreate(create) {
|
|
28644
|
-
return (request, options) =>
|
|
28720
|
+
return (request, options) => _chunk26JGOELHjs.groqChannels.chatCompletionsCreate.tracePromise(
|
|
28645
28721
|
() => create(request, options),
|
|
28646
28722
|
{ arguments: [request] }
|
|
28647
28723
|
);
|
|
28648
28724
|
}
|
|
28649
28725
|
function wrapEmbeddingsCreate2(create) {
|
|
28650
|
-
return (request, options) =>
|
|
28726
|
+
return (request, options) => _chunk26JGOELHjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
28651
28727
|
arguments: [request]
|
|
28652
28728
|
});
|
|
28653
28729
|
}
|
|
@@ -28695,13 +28771,13 @@ function copilotClientProxy(client) {
|
|
|
28695
28771
|
return proxy;
|
|
28696
28772
|
}
|
|
28697
28773
|
function wrappedCreateSession(client) {
|
|
28698
|
-
return (config) =>
|
|
28774
|
+
return (config) => _chunk26JGOELHjs.gitHubCopilotChannels.createSession.tracePromise(
|
|
28699
28775
|
() => client.createSession(config),
|
|
28700
28776
|
{ arguments: [config] }
|
|
28701
28777
|
);
|
|
28702
28778
|
}
|
|
28703
28779
|
function wrappedResumeSession(client) {
|
|
28704
|
-
return (sessionId, config) =>
|
|
28780
|
+
return (sessionId, config) => _chunk26JGOELHjs.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
28705
28781
|
() => client.resumeSession(sessionId, config),
|
|
28706
28782
|
{ arguments: [sessionId, config] }
|
|
28707
28783
|
);
|
|
@@ -28715,7 +28791,7 @@ var VitestContextManager = class {
|
|
|
28715
28791
|
*/
|
|
28716
28792
|
|
|
28717
28793
|
constructor() {
|
|
28718
|
-
this.contextStorage =
|
|
28794
|
+
this.contextStorage = _chunk26JGOELHjs.isomorph_default.newAsyncLocalStorage();
|
|
28719
28795
|
}
|
|
28720
28796
|
getCurrentContext() {
|
|
28721
28797
|
return this.contextStorage.getStore();
|
|
@@ -28780,10 +28856,12 @@ function formatExperimentSummary(summary) {
|
|
|
28780
28856
|
// src/wrappers/shared/flush.ts
|
|
28781
28857
|
async function summarizeAndFlush(experiment, options) {
|
|
28782
28858
|
const shouldDisplay = _nullishCoalesce(options.displaySummary, () => ( true));
|
|
28783
|
-
|
|
28784
|
-
|
|
28785
|
-
|
|
28859
|
+
if (!shouldDisplay) {
|
|
28860
|
+
await experiment.flush();
|
|
28861
|
+
return;
|
|
28786
28862
|
}
|
|
28863
|
+
const summary = await experiment.summarize();
|
|
28864
|
+
console.log(formatExperimentSummary(summary));
|
|
28787
28865
|
}
|
|
28788
28866
|
|
|
28789
28867
|
// src/wrappers/vitest/flush-manager.ts
|
|
@@ -28926,7 +29004,7 @@ function wrapTest(originalTest, config) {
|
|
|
28926
29004
|
const wrapped = function(name, configOrFn, maybeFn) {
|
|
28927
29005
|
const isEnhanced = typeof configOrFn !== "function";
|
|
28928
29006
|
const testConfig = isEnhanced ? configOrFn : void 0;
|
|
28929
|
-
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess',
|
|
29007
|
+
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _708 => _708.data]) && Array.isArray(testConfig.data)) {
|
|
28930
29008
|
const dataRecords = testConfig.data;
|
|
28931
29009
|
const testFn2 = maybeFn;
|
|
28932
29010
|
if (!testFn2) {
|
|
@@ -28964,7 +29042,7 @@ function wrapTest(originalTest, config) {
|
|
|
28964
29042
|
const registrationContext = getExperimentContext();
|
|
28965
29043
|
const testImplementation = async (vitestContext) => {
|
|
28966
29044
|
const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
|
|
28967
|
-
const experiment = _optionalChain([experimentContext, 'optionalAccess',
|
|
29045
|
+
const experiment = _optionalChain([experimentContext, 'optionalAccess', _709 => _709.experiment]);
|
|
28968
29046
|
if (config.onProgress) {
|
|
28969
29047
|
config.onProgress({ type: "test_start", testName: name });
|
|
28970
29048
|
}
|
|
@@ -28996,11 +29074,11 @@ function wrapTest(originalTest, config) {
|
|
|
28996
29074
|
const result = await runTracedEval({
|
|
28997
29075
|
experiment,
|
|
28998
29076
|
spanName: name,
|
|
28999
|
-
input: _optionalChain([testConfig, 'optionalAccess',
|
|
29000
|
-
expected: _optionalChain([testConfig, 'optionalAccess',
|
|
29001
|
-
metadata: _optionalChain([testConfig, 'optionalAccess',
|
|
29002
|
-
tags: _optionalChain([testConfig, 'optionalAccess',
|
|
29003
|
-
scorers: _optionalChain([testConfig, 'optionalAccess',
|
|
29077
|
+
input: _optionalChain([testConfig, 'optionalAccess', _710 => _710.input]),
|
|
29078
|
+
expected: _optionalChain([testConfig, 'optionalAccess', _711 => _711.expected]),
|
|
29079
|
+
metadata: _optionalChain([testConfig, 'optionalAccess', _712 => _712.metadata]),
|
|
29080
|
+
tags: _optionalChain([testConfig, 'optionalAccess', _713 => _713.tags]),
|
|
29081
|
+
scorers: _optionalChain([testConfig, 'optionalAccess', _714 => _714.scorers]),
|
|
29004
29082
|
fn: async () => {
|
|
29005
29083
|
if (testConfig && maybeFn) {
|
|
29006
29084
|
const params = {
|
|
@@ -29115,8 +29193,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
29115
29193
|
config.onProgress({
|
|
29116
29194
|
type: "suite_complete",
|
|
29117
29195
|
suiteName,
|
|
29118
|
-
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
29119
|
-
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
29196
|
+
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _715 => _715.passed]), () => ( 0)),
|
|
29197
|
+
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _716 => _716.failed]), () => ( 0))
|
|
29120
29198
|
});
|
|
29121
29199
|
}
|
|
29122
29200
|
});
|
|
@@ -29248,7 +29326,7 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
29248
29326
|
return;
|
|
29249
29327
|
}
|
|
29250
29328
|
await summarizeAndFlush(ctx.experiment, {
|
|
29251
|
-
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29329
|
+
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _717 => _717.displaySummary]), () => ( config.displaySummary))
|
|
29252
29330
|
});
|
|
29253
29331
|
}
|
|
29254
29332
|
};
|
|
@@ -29328,7 +29406,7 @@ function initNodeTestSuite(config) {
|
|
|
29328
29406
|
|
|
29329
29407
|
// src/graph-framework.ts
|
|
29330
29408
|
var graph_framework_exports = {};
|
|
29331
|
-
|
|
29409
|
+
_chunk26JGOELHjs.__export.call(void 0, graph_framework_exports, {
|
|
29332
29410
|
AggregatorNode: () => AggregatorNode,
|
|
29333
29411
|
GateNode: () => GateNode,
|
|
29334
29412
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -30647,8 +30725,12 @@ var waterfall$1 = awaitify(waterfall);
|
|
|
30647
30725
|
|
|
30648
30726
|
// src/trace.ts
|
|
30649
30727
|
var SpanFetcher = class _SpanFetcher extends ObjectFetcher {
|
|
30650
|
-
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter) {
|
|
30651
|
-
const filterExpr = _SpanFetcher.buildFilter(
|
|
30728
|
+
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false) {
|
|
30729
|
+
const filterExpr = _SpanFetcher.buildFilter(
|
|
30730
|
+
rootSpanId,
|
|
30731
|
+
spanTypeFilter,
|
|
30732
|
+
includeScorers
|
|
30733
|
+
);
|
|
30652
30734
|
super(objectType, void 0, void 0, {
|
|
30653
30735
|
filter: filterExpr
|
|
30654
30736
|
});
|
|
@@ -30657,16 +30739,17 @@ var SpanFetcher = class _SpanFetcher extends ObjectFetcher {
|
|
|
30657
30739
|
this._state = _state;
|
|
30658
30740
|
this.spanTypeFilter = spanTypeFilter;
|
|
30659
30741
|
}
|
|
30660
|
-
static buildFilter(rootSpanId, spanTypeFilter) {
|
|
30742
|
+
static buildFilter(rootSpanId, spanTypeFilter, includeScorers = false) {
|
|
30661
30743
|
const children = [
|
|
30662
30744
|
// Base filter: root_span_id = 'value'
|
|
30663
30745
|
{
|
|
30664
30746
|
op: "eq",
|
|
30665
30747
|
left: { op: "ident", name: ["root_span_id"] },
|
|
30666
30748
|
right: { op: "literal", value: rootSpanId }
|
|
30667
|
-
}
|
|
30668
|
-
|
|
30669
|
-
|
|
30749
|
+
}
|
|
30750
|
+
];
|
|
30751
|
+
if (!includeScorers) {
|
|
30752
|
+
children.push({
|
|
30670
30753
|
op: "or",
|
|
30671
30754
|
children: [
|
|
30672
30755
|
{
|
|
@@ -30679,8 +30762,8 @@ var SpanFetcher = class _SpanFetcher extends ObjectFetcher {
|
|
|
30679
30762
|
right: { op: "literal", value: "scorer" }
|
|
30680
30763
|
}
|
|
30681
30764
|
]
|
|
30682
|
-
}
|
|
30683
|
-
|
|
30765
|
+
});
|
|
30766
|
+
}
|
|
30684
30767
|
if (spanTypeFilter && spanTypeFilter.length > 0) {
|
|
30685
30768
|
children.push({
|
|
30686
30769
|
op: "in",
|
|
@@ -30706,35 +30789,49 @@ var CachedSpanFetcher = (_class30 = class {
|
|
|
30706
30789
|
|
|
30707
30790
|
constructor(objectTypeOrFetchFn, objectId, rootSpanId, getState) {;_class30.prototype.__init114.call(this);_class30.prototype.__init115.call(this);
|
|
30708
30791
|
if (typeof objectTypeOrFetchFn === "function") {
|
|
30709
|
-
this.fetchFn = objectTypeOrFetchFn;
|
|
30792
|
+
this.fetchFn = (spanType) => objectTypeOrFetchFn(spanType);
|
|
30710
30793
|
} else {
|
|
30711
30794
|
const objectType = objectTypeOrFetchFn;
|
|
30712
|
-
this.fetchFn = async (spanType) => {
|
|
30795
|
+
this.fetchFn = async (spanType, includeScorers) => {
|
|
30713
30796
|
const state = await getState();
|
|
30714
30797
|
const fetcher = new SpanFetcher(
|
|
30715
30798
|
objectType,
|
|
30716
30799
|
objectId,
|
|
30717
30800
|
rootSpanId,
|
|
30718
30801
|
state,
|
|
30719
|
-
spanType
|
|
30802
|
+
spanType,
|
|
30803
|
+
includeScorers
|
|
30720
30804
|
);
|
|
30721
30805
|
const rows = await fetcher.fetchedData();
|
|
30722
|
-
return rows.
|
|
30806
|
+
return rows.map((row) => ({
|
|
30723
30807
|
input: row.input,
|
|
30724
30808
|
output: row.output,
|
|
30809
|
+
expected: row.expected,
|
|
30810
|
+
error: row.error,
|
|
30811
|
+
scores: row.scores,
|
|
30812
|
+
metrics: row.metrics,
|
|
30725
30813
|
metadata: row.metadata,
|
|
30726
30814
|
span_id: row.span_id,
|
|
30727
30815
|
span_parents: row.span_parents,
|
|
30816
|
+
is_root: row.is_root,
|
|
30728
30817
|
span_attributes: row.span_attributes,
|
|
30729
30818
|
id: row.id,
|
|
30730
30819
|
_xact_id: row._xact_id,
|
|
30731
30820
|
_pagination_key: row._pagination_key,
|
|
30732
|
-
root_span_id: row.root_span_id
|
|
30821
|
+
root_span_id: row.root_span_id,
|
|
30822
|
+
created: row.created,
|
|
30823
|
+
tags: row.tags
|
|
30733
30824
|
}));
|
|
30734
30825
|
};
|
|
30735
30826
|
}
|
|
30736
30827
|
}
|
|
30737
|
-
async getSpans({
|
|
30828
|
+
async getSpans({
|
|
30829
|
+
spanType,
|
|
30830
|
+
includeScorers = false
|
|
30831
|
+
} = {}) {
|
|
30832
|
+
if (includeScorers) {
|
|
30833
|
+
return this.fetchFn(spanType, true);
|
|
30834
|
+
}
|
|
30738
30835
|
if (this.allFetched) {
|
|
30739
30836
|
return this.getFromCache(spanType);
|
|
30740
30837
|
}
|
|
@@ -30751,9 +30848,9 @@ var CachedSpanFetcher = (_class30 = class {
|
|
|
30751
30848
|
return this.getFromCache(spanType);
|
|
30752
30849
|
}
|
|
30753
30850
|
async fetchSpans(spanType) {
|
|
30754
|
-
const spans = await this.fetchFn(spanType);
|
|
30851
|
+
const spans = await this.fetchFn(spanType, false);
|
|
30755
30852
|
for (const span of spans) {
|
|
30756
|
-
const type = _nullishCoalesce(_optionalChain([span, 'access',
|
|
30853
|
+
const type = _nullishCoalesce(_optionalChain([span, 'access', _718 => _718.span_attributes, 'optionalAccess', _719 => _719.type]), () => ( ""));
|
|
30757
30854
|
const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
|
|
30758
30855
|
existing.push(span);
|
|
30759
30856
|
this.spanCache.set(type, existing);
|
|
@@ -30829,34 +30926,43 @@ var LocalTrace = (_class31 = class {
|
|
|
30829
30926
|
* First checks the local span cache for recently logged spans, then falls
|
|
30830
30927
|
* back to CachedSpanFetcher which handles BTQL fetching and caching.
|
|
30831
30928
|
*/
|
|
30832
|
-
async getSpans({
|
|
30929
|
+
async getSpans({
|
|
30930
|
+
spanType,
|
|
30931
|
+
includeScorers = false
|
|
30932
|
+
} = {}) {
|
|
30833
30933
|
const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
|
|
30834
30934
|
if (cachedSpans && cachedSpans.length > 0) {
|
|
30835
|
-
let spans = cachedSpans.filter(
|
|
30836
|
-
(span) => _optionalChain([span, 'access',
|
|
30935
|
+
let spans = includeScorers ? cachedSpans : cachedSpans.filter(
|
|
30936
|
+
(span) => _optionalChain([span, 'access', _720 => _720.span_attributes, 'optionalAccess', _721 => _721.purpose]) !== "scorer"
|
|
30837
30937
|
);
|
|
30838
30938
|
if (spanType && spanType.length > 0) {
|
|
30839
30939
|
spans = spans.filter(
|
|
30840
|
-
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access',
|
|
30940
|
+
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _722 => _722.span_attributes, 'optionalAccess', _723 => _723.type]), () => ( "")))
|
|
30841
30941
|
);
|
|
30842
30942
|
}
|
|
30843
30943
|
return spans.map((span) => ({
|
|
30844
30944
|
input: span.input,
|
|
30845
30945
|
output: span.output,
|
|
30946
|
+
expected: span.expected,
|
|
30947
|
+
error: span.error,
|
|
30948
|
+
scores: span.scores,
|
|
30949
|
+
metrics: span.metrics,
|
|
30846
30950
|
metadata: span.metadata,
|
|
30847
30951
|
span_id: span.span_id,
|
|
30848
30952
|
span_parents: span.span_parents,
|
|
30849
|
-
|
|
30953
|
+
is_root: span.is_root,
|
|
30954
|
+
span_attributes: span.span_attributes,
|
|
30955
|
+
tags: span.tags
|
|
30850
30956
|
}));
|
|
30851
30957
|
}
|
|
30852
|
-
return this.cachedFetcher.getSpans({ spanType });
|
|
30958
|
+
return this.cachedFetcher.getSpans({ spanType, includeScorers });
|
|
30853
30959
|
}
|
|
30854
30960
|
/**
|
|
30855
30961
|
* Get the thread (preprocessed messages) for this trace.
|
|
30856
30962
|
* Calls the API with the project_default preprocessor (which falls back to "thread").
|
|
30857
30963
|
*/
|
|
30858
30964
|
async getThread(options) {
|
|
30859
|
-
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30965
|
+
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _724 => _724.preprocessor]), () => ( "project_default"));
|
|
30860
30966
|
if (!this.threadCache.has(cacheKey)) {
|
|
30861
30967
|
const promise = this.fetchThread(options);
|
|
30862
30968
|
this.threadCache.set(cacheKey, promise);
|
|
@@ -30867,7 +30973,7 @@ var LocalTrace = (_class31 = class {
|
|
|
30867
30973
|
await this.ensureSpansReady();
|
|
30868
30974
|
await this.state.login({});
|
|
30869
30975
|
const result = await invoke({
|
|
30870
|
-
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30976
|
+
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _725 => _725.preprocessor]), () => ( "project_default")),
|
|
30871
30977
|
functionType: "preprocessor",
|
|
30872
30978
|
input: {
|
|
30873
30979
|
trace_ref: {
|
|
@@ -31043,10 +31149,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
|
|
|
31043
31149
|
const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
|
|
31044
31150
|
const validate = ajv.compile(schema);
|
|
31045
31151
|
if (!validate(parameters)) {
|
|
31046
|
-
const errorMessages = _optionalChain([validate, 'access',
|
|
31152
|
+
const errorMessages = _optionalChain([validate, 'access', _726 => _726.errors, 'optionalAccess', _727 => _727.map, 'call', _728 => _728((err) => {
|
|
31047
31153
|
const path2 = err.instancePath || "root";
|
|
31048
31154
|
return `${path2}: ${err.message}`;
|
|
31049
|
-
}), 'access',
|
|
31155
|
+
}), 'access', _729 => _729.join, 'call', _730 => _730(", ")]);
|
|
31050
31156
|
throw Error(`Invalid parameters: ${errorMessages}`);
|
|
31051
31157
|
}
|
|
31052
31158
|
return rehydrateRemoteParameters(parameters, schema);
|
|
@@ -31408,7 +31514,7 @@ var defaultErrorScoreHandler = ({
|
|
|
31408
31514
|
};
|
|
31409
31515
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
31410
31516
|
if (enableCache) {
|
|
31411
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess',
|
|
31517
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess', _731 => _731.spanCache, 'optionalAccess', _732 => _732.start, 'call', _733 => _733()]);
|
|
31412
31518
|
}
|
|
31413
31519
|
try {
|
|
31414
31520
|
if (typeof evaluator.data === "string") {
|
|
@@ -31519,7 +31625,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31519
31625
|
objectType: parentComponents ? spanObjectTypeV3ToTypedString(
|
|
31520
31626
|
parentComponents.data.object_type
|
|
31521
31627
|
) : "experiment",
|
|
31522
|
-
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async
|
|
31628
|
+
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _734 => _734.data, 'access', async _735 => _735.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
31523
31629
|
rootSpanId: rootSpan.rootSpanId,
|
|
31524
31630
|
ensureSpansFlushed,
|
|
31525
31631
|
state
|
|
@@ -31549,10 +31655,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31549
31655
|
span,
|
|
31550
31656
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
31551
31657
|
reportProgress: (event) => {
|
|
31552
|
-
_optionalChain([stream, 'optionalCall',
|
|
31658
|
+
_optionalChain([stream, 'optionalCall', _736 => _736({
|
|
31553
31659
|
...event,
|
|
31554
31660
|
id: rootSpan.id,
|
|
31555
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
31661
|
+
origin: _optionalChain([baseEvent, 'access', _737 => _737.event, 'optionalAccess', _738 => _738.origin]),
|
|
31556
31662
|
name: evaluator.evalName,
|
|
31557
31663
|
object_type: "task"
|
|
31558
31664
|
})]);
|
|
@@ -31740,7 +31846,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31740
31846
|
tags: tags.length ? tags : void 0,
|
|
31741
31847
|
metadata,
|
|
31742
31848
|
error,
|
|
31743
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
31849
|
+
origin: _optionalChain([baseEvent, 'access', _739 => _739.event, 'optionalAccess', _740 => _740.origin])
|
|
31744
31850
|
};
|
|
31745
31851
|
collectedResults.push({
|
|
31746
31852
|
...baseResult,
|
|
@@ -31780,7 +31886,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31780
31886
|
break;
|
|
31781
31887
|
}
|
|
31782
31888
|
scheduledTrials++;
|
|
31783
|
-
_optionalChain([progressReporter, 'access',
|
|
31889
|
+
_optionalChain([progressReporter, 'access', _741 => _741.setTotal, 'optionalCall', _742 => _742(evaluator.evalName, scheduledTrials)]);
|
|
31784
31890
|
q.pushAsync({ datum, trialIndex }).catch((e) => {
|
|
31785
31891
|
if (queueErrors.length < 5) {
|
|
31786
31892
|
queueErrors.push(e);
|
|
@@ -31842,7 +31948,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31842
31948
|
} catch (e) {
|
|
31843
31949
|
q.kill();
|
|
31844
31950
|
if (e instanceof InternalAbortError) {
|
|
31845
|
-
if (
|
|
31951
|
+
if (_chunk26JGOELHjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
31846
31952
|
debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
31847
31953
|
}
|
|
31848
31954
|
}
|
|
@@ -31865,9 +31971,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
31865
31971
|
);
|
|
31866
31972
|
} finally {
|
|
31867
31973
|
if (enableCache) {
|
|
31868
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess',
|
|
31869
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
31870
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
31974
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _internalGetGlobalState()))), 'optionalAccess', _743 => _743.spanCache]);
|
|
31975
|
+
_optionalChain([spanCache, 'optionalAccess', _744 => _744.dispose, 'call', _745 => _745()]);
|
|
31976
|
+
_optionalChain([spanCache, 'optionalAccess', _746 => _746.stop, 'call', _747 => _747()]);
|
|
31871
31977
|
}
|
|
31872
31978
|
}
|
|
31873
31979
|
}
|
|
@@ -31960,25 +32066,25 @@ var defaultReporter = {
|
|
|
31960
32066
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
31961
32067
|
}
|
|
31962
32068
|
if (jsonl) {
|
|
31963
|
-
|
|
32069
|
+
_chunk26JGOELHjs.isomorph_default.writeln(JSON.stringify(summary));
|
|
31964
32070
|
} else {
|
|
31965
|
-
|
|
31966
|
-
|
|
32071
|
+
_chunk26JGOELHjs.isomorph_default.writeln("Experiment summary");
|
|
32072
|
+
_chunk26JGOELHjs.isomorph_default.writeln("==================");
|
|
31967
32073
|
if (summary.comparisonExperimentName) {
|
|
31968
|
-
|
|
32074
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
31969
32075
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
31970
32076
|
);
|
|
31971
|
-
|
|
32077
|
+
_chunk26JGOELHjs.isomorph_default.writeln("");
|
|
31972
32078
|
}
|
|
31973
32079
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
31974
32080
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
31975
32081
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
31976
32082
|
if (hasScores || hasMetrics) {
|
|
31977
32083
|
if (hasComparison) {
|
|
31978
|
-
|
|
32084
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
31979
32085
|
"Name Value Change Improvements Regressions"
|
|
31980
32086
|
);
|
|
31981
|
-
|
|
32087
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
31982
32088
|
"----------------------------------------------------------------"
|
|
31983
32089
|
);
|
|
31984
32090
|
}
|
|
@@ -31994,11 +32100,11 @@ var defaultReporter = {
|
|
|
31994
32100
|
}
|
|
31995
32101
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
31996
32102
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
31997
|
-
|
|
32103
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
31998
32104
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
31999
32105
|
);
|
|
32000
32106
|
} else {
|
|
32001
|
-
|
|
32107
|
+
_chunk26JGOELHjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
32002
32108
|
}
|
|
32003
32109
|
}
|
|
32004
32110
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -32014,23 +32120,23 @@ var defaultReporter = {
|
|
|
32014
32120
|
}
|
|
32015
32121
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
32016
32122
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
32017
|
-
|
|
32123
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
32018
32124
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
32019
32125
|
);
|
|
32020
32126
|
} else {
|
|
32021
|
-
|
|
32127
|
+
_chunk26JGOELHjs.isomorph_default.writeln(
|
|
32022
32128
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
32023
32129
|
);
|
|
32024
32130
|
}
|
|
32025
32131
|
}
|
|
32026
32132
|
}
|
|
32027
32133
|
if (summary.experimentUrl) {
|
|
32028
|
-
|
|
32029
|
-
|
|
32030
|
-
|
|
32134
|
+
_chunk26JGOELHjs.isomorph_default.writeln("");
|
|
32135
|
+
_chunk26JGOELHjs.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
32136
|
+
_chunk26JGOELHjs.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
32031
32137
|
}
|
|
32032
32138
|
}
|
|
32033
|
-
|
|
32139
|
+
_chunk26JGOELHjs.isomorph_default.writeln("");
|
|
32034
32140
|
return failingResults.length === 0;
|
|
32035
32141
|
},
|
|
32036
32142
|
async reportRun(evalReports) {
|
|
@@ -32038,6 +32144,34 @@ var defaultReporter = {
|
|
|
32038
32144
|
}
|
|
32039
32145
|
};
|
|
32040
32146
|
|
|
32147
|
+
// src/dataset-pipeline.ts
|
|
32148
|
+
function DatasetPipeline(definition) {
|
|
32149
|
+
if (!globalThis.__braintrust_dataset_pipelines) {
|
|
32150
|
+
globalThis.__braintrust_dataset_pipelines = [];
|
|
32151
|
+
}
|
|
32152
|
+
const storedDefinition = {
|
|
32153
|
+
name: definition.name,
|
|
32154
|
+
source: {
|
|
32155
|
+
projectId: definition.source.projectId,
|
|
32156
|
+
projectName: definition.source.projectName,
|
|
32157
|
+
orgName: definition.source.orgName,
|
|
32158
|
+
filter: definition.source.filter,
|
|
32159
|
+
scope: _nullishCoalesce(definition.source.scope, () => ( "span"))
|
|
32160
|
+
},
|
|
32161
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-explicit-any
|
|
32162
|
+
transform: definition.transform,
|
|
32163
|
+
target: {
|
|
32164
|
+
projectId: definition.target.projectId,
|
|
32165
|
+
projectName: definition.target.projectName,
|
|
32166
|
+
orgName: definition.target.orgName,
|
|
32167
|
+
datasetName: definition.target.datasetName,
|
|
32168
|
+
description: definition.target.description,
|
|
32169
|
+
metadata: definition.target.metadata
|
|
32170
|
+
}
|
|
32171
|
+
};
|
|
32172
|
+
globalThis.__braintrust_dataset_pipelines.push(storedDefinition);
|
|
32173
|
+
}
|
|
32174
|
+
|
|
32041
32175
|
// src/framework2.ts
|
|
32042
32176
|
|
|
32043
32177
|
var currentFilename = typeof __filename !== "undefined" ? __filename : "unknown";
|
|
@@ -32123,7 +32257,7 @@ var ToolBuilder = (_class33 = class {
|
|
|
32123
32257
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
32124
32258
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
32125
32259
|
if (resolvedName.trim().length === 0) {
|
|
32126
|
-
resolvedName = `Tool ${
|
|
32260
|
+
resolvedName = `Tool ${_chunk26JGOELHjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
32127
32261
|
}
|
|
32128
32262
|
const tool = new CodeFunction(this.project, {
|
|
32129
32263
|
handler,
|
|
@@ -32152,7 +32286,7 @@ var ScorerBuilder = (_class34 = class {
|
|
|
32152
32286
|
resolvedName = opts.handler.name;
|
|
32153
32287
|
}
|
|
32154
32288
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
32155
|
-
resolvedName = `Scorer ${
|
|
32289
|
+
resolvedName = `Scorer ${_chunk26JGOELHjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
32156
32290
|
}
|
|
32157
32291
|
const slug = _nullishCoalesce(opts.slug, () => ( slugify(resolvedName, { lower: true, strict: true })));
|
|
32158
32292
|
if ("handler" in opts) {
|
|
@@ -32709,4 +32843,5 @@ configureNode();
|
|
|
32709
32843
|
|
|
32710
32844
|
|
|
32711
32845
|
|
|
32712
|
-
|
|
32846
|
+
|
|
32847
|
+
exports.Attachment = Attachment; exports.AttachmentReference = AttachmentReference; exports.BRAINTRUST_CURRENT_SPAN_STORE = BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BaseAttachment = BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustState = BraintrustState; exports.BraintrustStream = BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = Dataset2; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = Experiment2; exports.ExternalAttachment = ExternalAttachment; exports.FailedHTTPResponse = FailedHTTPResponse; exports.IDGenerator = IDGenerator; exports.JSONAttachment = JSONAttachment; exports.LEGACY_CACHED_HEADER = LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = LazyValue; exports.Logger = Logger; exports.LoginInvalidOrgError = LoginInvalidOrgError; exports.NOOP_SPAN = NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = NOOP_SPAN_PERMALINK; exports.NoopSpan = NoopSpan; exports.ObjectFetcher = ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = Prompt2; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = ReadonlyAttachment; exports.ReadonlyExperiment = ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = SpanImpl; exports.TestBackgroundLogger = TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = UUIDGenerator; exports.X_CACHED_HEADER = X_CACHED_HEADER; exports._exportsForTestingOnly = _exportsForTestingOnly; exports._internalGetGlobalState = _internalGetGlobalState; exports._internalIso = _chunk26JGOELHjs.isomorph_default; exports._internalSetInitialState = _internalSetInitialState; exports.addAzureBlobHeaders = addAzureBlobHeaders; exports.braintrustStreamChunkSchema = braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = configureInstrumentation; exports.constructLogs3OverflowRequest = constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = createFinalValuePassThroughStream; exports.currentExperiment = currentExperiment; exports.currentLogger = currentLogger; exports.currentSpan = currentSpan; exports.deepCopyEvent = deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = deserializePlainStringAsJSON; exports.devNullWritableStream = devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.flush = flush; exports.getContextManager = getContextManager; exports.getIdGenerator = getIdGenerator; exports.getPromptVersions = getPromptVersions; exports.getSpanParentObject = getSpanParentObject; exports.getTemplateRenderer = getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = init; exports.initDataset = initDataset; exports.initExperiment = initExperiment; exports.initFunction = initFunction; exports.initLogger = initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.invoke = invoke; exports.isTemplateFormat = isTemplateFormat; exports.loadParameters = loadParameters; exports.loadPrompt = loadPrompt; exports.log = log; exports.logError = logError; exports.login = login; exports.loginToState = loginToState; exports.logs3OverflowUploadSchema = logs3OverflowUploadSchema; exports.newId = newId; exports.parseCachedHeader = parseCachedHeader; exports.parseTemplateFormat = parseTemplateFormat; exports.permalink = permalink; exports.pickLogs3OverflowObjectIds = pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = registerTemplatePlugin; exports.renderMessage = renderMessage; exports.renderPromptParams = renderPromptParams; exports.renderTemplateContent = renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = setFetch; exports.setMaskingFunction = setMaskingFunction; exports.spanComponentsToObjectId = spanComponentsToObjectId; exports.startSpan = startSpan; exports.summarize = summarize; exports.templateRegistry = templateRegistry; exports.toolFunctionDefinitionSchema = ToolFunctionDefinition; exports.traceable = traceable; exports.traced = traced; exports.updateSpan = updateSpan; exports.uploadLogs3OverflowPayload = uploadLogs3OverflowPayload; exports.utf8ByteLength = utf8ByteLength; exports.withCurrent = withCurrent; exports.withDataset = withDataset; exports.withExperiment = withExperiment; exports.withLogger = withLogger; exports.withParent = withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapFlueContext = wrapFlueContext; exports.wrapFlueSession = wrapFlueSession; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapMastraAgent = wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapTraced = wrapTraced; exports.wrapVitest = wrapVitest;
|