axiom 0.19.0 → 0.20.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/dist/bin.cjs +36 -41
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +4 -4
- package/dist/{chunk-EZQDL7ZI.js → chunk-I42N5ZVU.js} +30 -34
- package/dist/chunk-I42N5ZVU.js.map +1 -0
- package/dist/{chunk-MYRR62TJ.js → chunk-KDJRDUK4.js} +4 -2
- package/dist/chunk-KDJRDUK4.js.map +1 -0
- package/dist/evals.cjs +33 -37
- package/dist/evals.cjs.map +1 -1
- package/dist/evals.js +2 -2
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EZQDL7ZI.js.map +0 -1
- package/dist/chunk-MYRR62TJ.js.map +0 -1
package/dist/bin.cjs
CHANGED
|
@@ -349,8 +349,8 @@ var loadPullCommand = (program2) => {
|
|
|
349
349
|
).option("--version <version>", "The version to pull, default: latest", "latest").option("--output <path>", "Output file path (optional, defaults to <slug>.prompt.ts)").action(async (slug, options) => {
|
|
350
350
|
try {
|
|
351
351
|
console.log(`Pulling prompt: ${slug} (version: ${options.version})`);
|
|
352
|
-
const
|
|
353
|
-
const response = await fetch(
|
|
352
|
+
const url = `${process.env.AXIOM_URL}/v1/prompts/${slug}`;
|
|
353
|
+
const response = await fetch(url, {
|
|
354
354
|
method: "GET",
|
|
355
355
|
headers: {
|
|
356
356
|
Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
|
|
@@ -479,11 +479,16 @@ var r = process.env.FORCE_TTY !== void 0 || (0, import_tty.isatty)(1);
|
|
|
479
479
|
var u = p(r);
|
|
480
480
|
|
|
481
481
|
// src/evals/eval.service.ts
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
|
|
482
|
+
var getEnvVars = () => {
|
|
483
|
+
return {
|
|
484
|
+
datasetName: process.env.AXIOM_DATASET ?? "",
|
|
485
|
+
url: process.env.AXIOM_URL ?? "https://api.axiom.co",
|
|
486
|
+
token: process.env.AXIOM_TOKEN
|
|
487
|
+
};
|
|
488
|
+
};
|
|
485
489
|
var findEvaluationCases = async (evalId) => {
|
|
486
490
|
try {
|
|
491
|
+
const { datasetName, url, token } = getEnvVars();
|
|
487
492
|
const apl = `['${datasetName}'] | where trace_id == "${evalId}" | order by _time`;
|
|
488
493
|
const headers = new Headers({
|
|
489
494
|
Authorization: `Bearer ${token}`,
|
|
@@ -689,7 +694,7 @@ var AxiomReporter = class {
|
|
|
689
694
|
console.log(" ", u.dim("Start at"), new Date(this.startTime).toTimeString());
|
|
690
695
|
console.log(" ", u.dim("Duration"), `${duration}s`);
|
|
691
696
|
const meta = testSuite.meta();
|
|
692
|
-
const
|
|
697
|
+
const url = `https://app.axiom.co/evaluations/${meta.evaluation.name}/${meta.evaluation.id}`;
|
|
693
698
|
for (const test of testSuite.children) {
|
|
694
699
|
if (test.type !== "test") return;
|
|
695
700
|
this.printCaseResult(test);
|
|
@@ -697,7 +702,7 @@ var AxiomReporter = class {
|
|
|
697
702
|
console.log("");
|
|
698
703
|
console.log(
|
|
699
704
|
" ",
|
|
700
|
-
`see results for ${meta.evaluation.name}-${meta.evaluation.version} at ${
|
|
705
|
+
`see results for ${meta.evaluation.name}-${meta.evaluation.version} at ${url}`
|
|
701
706
|
);
|
|
702
707
|
console.log(
|
|
703
708
|
" ",
|
|
@@ -772,7 +777,7 @@ var import_api2 = require("@opentelemetry/api");
|
|
|
772
777
|
// package.json
|
|
773
778
|
var package_default = {
|
|
774
779
|
name: "axiom",
|
|
775
|
-
version: "0.
|
|
780
|
+
version: "0.20.0",
|
|
776
781
|
type: "module",
|
|
777
782
|
author: "Axiom, Inc.",
|
|
778
783
|
contributors: [
|
|
@@ -934,12 +939,12 @@ var processor = new import_sdk_trace_node.BatchSpanProcessor(exporter, {
|
|
|
934
939
|
var provider = new import_sdk_trace_node.NodeTracerProvider({
|
|
935
940
|
resource: (0, import_resources.resourceFromAttributes)({
|
|
936
941
|
["service.name"]: "axiom",
|
|
937
|
-
["service.version"]: "0.
|
|
942
|
+
["service.version"]: "0.20.0"
|
|
938
943
|
}),
|
|
939
944
|
spanProcessors: [processor]
|
|
940
945
|
});
|
|
941
946
|
provider.register();
|
|
942
|
-
var tracer = import_api3.trace.getTracer("axiom", "0.
|
|
947
|
+
var tracer = import_api3.trace.getTracer("axiom", "0.20.0");
|
|
943
948
|
var flush = async () => {
|
|
944
949
|
await provider.forceFlush();
|
|
945
950
|
};
|
|
@@ -985,36 +990,28 @@ var import_node_fs = require("fs");
|
|
|
985
990
|
var import_api10 = require("@opentelemetry/api");
|
|
986
991
|
|
|
987
992
|
// src/evals/context/manager.ts
|
|
993
|
+
var import_node_module = require("module");
|
|
988
994
|
var import_meta = {};
|
|
989
995
|
var CONTEXT_MANAGER_SYMBOL = Symbol.for("axiom.context_manager");
|
|
990
996
|
function getGlobalContextManager() {
|
|
991
997
|
return globalThis[CONTEXT_MANAGER_SYMBOL];
|
|
992
998
|
}
|
|
993
|
-
function setGlobalContextManager(
|
|
994
|
-
globalThis[CONTEXT_MANAGER_SYMBOL] =
|
|
999
|
+
function setGlobalContextManager(manager) {
|
|
1000
|
+
globalThis[CONTEXT_MANAGER_SYMBOL] = manager;
|
|
995
1001
|
}
|
|
996
|
-
var isNodeJS = typeof process !== "undefined" && process.versions
|
|
1002
|
+
var isNodeJS = typeof process !== "undefined" && !!process.versions?.node;
|
|
997
1003
|
function getContextManager() {
|
|
998
1004
|
const existing = getGlobalContextManager();
|
|
999
|
-
if (existing)
|
|
1000
|
-
return existing;
|
|
1001
|
-
}
|
|
1005
|
+
if (existing) return existing;
|
|
1002
1006
|
let manager;
|
|
1003
1007
|
if (isNodeJS) {
|
|
1004
1008
|
try {
|
|
1005
1009
|
let AsyncLocalStorage;
|
|
1010
|
+
const req = (0, import_node_module.createRequire)(import_meta.url);
|
|
1006
1011
|
try {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
try {
|
|
1011
|
-
const requireFn = eval("require");
|
|
1012
|
-
const { createRequire } = requireFn("module");
|
|
1013
|
-
const dynamicRequire = createRequire(import_meta.url);
|
|
1014
|
-
AsyncLocalStorage = dynamicRequire("async_hooks").AsyncLocalStorage;
|
|
1015
|
-
} catch (_createRequireError) {
|
|
1016
|
-
throw directError;
|
|
1017
|
-
}
|
|
1012
|
+
AsyncLocalStorage = req("node:async_hooks").AsyncLocalStorage;
|
|
1013
|
+
} catch {
|
|
1014
|
+
AsyncLocalStorage = req("async_hooks").AsyncLocalStorage;
|
|
1018
1015
|
}
|
|
1019
1016
|
manager = new AsyncLocalStorage();
|
|
1020
1017
|
} catch (error) {
|
|
@@ -1022,6 +1019,7 @@ function getContextManager() {
|
|
|
1022
1019
|
manager = createFallbackManager();
|
|
1023
1020
|
}
|
|
1024
1021
|
} else {
|
|
1022
|
+
console.warn("AsyncLocalStorage not available, using fallback context manager");
|
|
1025
1023
|
manager = createFallbackManager();
|
|
1026
1024
|
}
|
|
1027
1025
|
setGlobalContextManager(manager);
|
|
@@ -1045,21 +1043,18 @@ function createFallbackManager() {
|
|
|
1045
1043
|
function createAsyncHook(_name) {
|
|
1046
1044
|
return {
|
|
1047
1045
|
get() {
|
|
1048
|
-
const
|
|
1049
|
-
if (
|
|
1050
|
-
return
|
|
1046
|
+
const manager = getContextManager();
|
|
1047
|
+
if (manager.getStore) {
|
|
1048
|
+
return manager.getStore();
|
|
1051
1049
|
}
|
|
1052
1050
|
return void 0;
|
|
1053
1051
|
},
|
|
1054
1052
|
run(value, fn) {
|
|
1055
|
-
const
|
|
1056
|
-
return
|
|
1053
|
+
const manager = getContextManager();
|
|
1054
|
+
return manager.run(value, fn);
|
|
1057
1055
|
}
|
|
1058
1056
|
};
|
|
1059
1057
|
}
|
|
1060
|
-
function __resetContextManagerForTests() {
|
|
1061
|
-
delete globalThis[CONTEXT_MANAGER_SYMBOL];
|
|
1062
|
-
}
|
|
1063
1058
|
|
|
1064
1059
|
// src/evals/context/global-flags.ts
|
|
1065
1060
|
var GLOBAL_OVERRIDES_SYMBOL = Symbol.for("axiom.global_flag_overrides");
|
|
@@ -1277,9 +1272,9 @@ function extractOverrides(argv) {
|
|
|
1277
1272
|
let hasCliFlags = false;
|
|
1278
1273
|
let configPathCount = 0;
|
|
1279
1274
|
for (let i = 0; i < argv.length; i++) {
|
|
1280
|
-
const
|
|
1281
|
-
const configMatch =
|
|
1282
|
-
const flagMatch =
|
|
1275
|
+
const token = argv[i];
|
|
1276
|
+
const configMatch = token.match(CONFIG_RE);
|
|
1277
|
+
const flagMatch = token.match(FLAG_RE);
|
|
1283
1278
|
if (configMatch) {
|
|
1284
1279
|
configPathCount++;
|
|
1285
1280
|
if (configPathCount > 1) {
|
|
@@ -1304,7 +1299,7 @@ function extractOverrides(argv) {
|
|
|
1304
1299
|
const finalValue = value === void 0 ? "true" : value;
|
|
1305
1300
|
overrides2[key] = coerceValue(finalValue);
|
|
1306
1301
|
} else {
|
|
1307
|
-
cleanedArgv2.push(
|
|
1302
|
+
cleanedArgv2.push(token);
|
|
1308
1303
|
}
|
|
1309
1304
|
}
|
|
1310
1305
|
if (configPath && hasCliFlags) {
|
|
@@ -1329,7 +1324,7 @@ var import_commander4 = require("commander");
|
|
|
1329
1324
|
var loadVersionCommand = (program2) => {
|
|
1330
1325
|
return program2.addCommand(
|
|
1331
1326
|
new import_commander4.Command("version").description("cli version").action(() => {
|
|
1332
|
-
console.log("0.
|
|
1327
|
+
console.log("0.20.0");
|
|
1333
1328
|
})
|
|
1334
1329
|
);
|
|
1335
1330
|
};
|
|
@@ -1339,7 +1334,7 @@ var { loadEnvConfig } = import_env.default;
|
|
|
1339
1334
|
loadEnvConfig(process.cwd());
|
|
1340
1335
|
var { cleanedArgv, overrides } = extractOverrides(process.argv.slice(2));
|
|
1341
1336
|
var program = new import_commander5.Command();
|
|
1342
|
-
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.
|
|
1337
|
+
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.20.0");
|
|
1343
1338
|
loadPushCommand(program);
|
|
1344
1339
|
loadPullCommand(program);
|
|
1345
1340
|
loadEvalCommand(program, overrides);
|