axiom 0.40.0 → 0.42.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.
Files changed (42) hide show
  1. package/README.md +25 -0
  2. package/dist/{app-scope-DPtynE6Y.d.cts → app-scope-BgNUnFZY.d.cts} +1 -81
  3. package/dist/{app-scope-DPtynE6Y.d.ts → app-scope-BgNUnFZY.d.ts} +1 -81
  4. package/dist/bin.cjs +16 -6
  5. package/dist/bin.cjs.map +1 -1
  6. package/dist/bin.js +5 -4
  7. package/dist/bin.js.map +1 -1
  8. package/dist/chunk-3THTOTTP.js +370 -0
  9. package/dist/chunk-3THTOTTP.js.map +1 -0
  10. package/dist/{chunk-5LY2WKZ7.js → chunk-7AIWUQUO.js} +3 -3
  11. package/dist/{chunk-AVSJ5VRQ.js → chunk-AF26RXVP.js} +6 -6
  12. package/dist/chunk-AF26RXVP.js.map +1 -0
  13. package/dist/{chunk-LFIQPMXJ.js → chunk-DL77W2XP.js} +15 -365
  14. package/dist/chunk-DL77W2XP.js.map +1 -0
  15. package/dist/chunk-N6WWQZ4E.js +59 -0
  16. package/dist/chunk-N6WWQZ4E.js.map +1 -0
  17. package/dist/evals/scorers.cjs +380 -0
  18. package/dist/evals/scorers.cjs.map +1 -0
  19. package/dist/evals/scorers.d.cts +2 -0
  20. package/dist/evals/scorers.d.ts +2 -0
  21. package/dist/evals/scorers.js +15 -0
  22. package/dist/evals/scorers.js.map +1 -0
  23. package/dist/evals.cjs +15 -5
  24. package/dist/evals.cjs.map +1 -1
  25. package/dist/evals.d.cts +5 -82
  26. package/dist/evals.d.ts +5 -82
  27. package/dist/evals.js +10 -53
  28. package/dist/evals.js.map +1 -1
  29. package/dist/index.cjs +294 -121
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +120 -9
  32. package/dist/index.d.ts +120 -9
  33. package/dist/index.js +121 -4
  34. package/dist/index.js.map +1 -1
  35. package/dist/{run-vitest-TRFZ365W.js → run-vitest-TX7FOGF2.js} +5 -4
  36. package/dist/{run-vitest-TRFZ365W.js.map → run-vitest-TX7FOGF2.js.map} +1 -1
  37. package/dist/scorers-BQJ3Xrf7.d.ts +162 -0
  38. package/dist/scorers-CiX7MIog.d.cts +162 -0
  39. package/package.json +11 -1
  40. package/dist/chunk-AVSJ5VRQ.js.map +0 -1
  41. package/dist/chunk-LFIQPMXJ.js.map +0 -1
  42. /package/dist/{chunk-5LY2WKZ7.js.map → chunk-7AIWUQUO.js.map} +0 -0
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Axiom AI SDK provides
4
4
  - an API to wrap your AI calls with observability instrumentation.
5
5
  - offline evals
6
+ - online evals
6
7
 
7
8
  ## Install
8
9
 
@@ -76,6 +77,30 @@ const result = await withSpan(
76
77
  )
77
78
  ```
78
79
 
80
+ ## Online Evals
81
+
82
+ For running scorers in production (without vitest dependency):
83
+
84
+ ```ts
85
+ import { withSpan, onlineEval } from 'axiom/ai';
86
+ import { Scorer } from 'axiom/ai/evals/scorers';
87
+
88
+ const formatScorer = Scorer('format-check', ({ output }: { output: string }) => {
89
+ return output.length > 0;
90
+ });
91
+
92
+ await withSpan({ capability: 'qa', step: 'answer' }, async () => {
93
+ const response = await generateText({ model, messages });
94
+ void onlineEval(
95
+ { capability: 'qa', step: 'answer' },
96
+ { output: response.text, scorers: [formatScorer] }
97
+ );
98
+ return response.text;
99
+ });
100
+ ```
101
+
102
+ > For offline evals that use `Eval()`, continue importing from `axiom/ai/evals`.
103
+
79
104
  ## Documentation
80
105
 
81
106
  For more information about how to set up and use the Axiom JavaScript SDK, read documentation on [axiom.co/docs/ai-engineering/quickstart](https://axiom.co/docs/ai-engineering/quickstart).
@@ -1,85 +1,5 @@
1
1
  import { ZodObject, ZodDefault, z } from 'zod';
2
2
 
3
- type ValidChars =
4
- | 'a'
5
- | 'b'
6
- | 'c'
7
- | 'd'
8
- | 'e'
9
- | 'f'
10
- | 'g'
11
- | 'h'
12
- | 'i'
13
- | 'j'
14
- | 'k'
15
- | 'l'
16
- | 'm'
17
- | 'n'
18
- | 'o'
19
- | 'p'
20
- | 'q'
21
- | 'r'
22
- | 's'
23
- | 't'
24
- | 'u'
25
- | 'v'
26
- | 'w'
27
- | 'x'
28
- | 'y'
29
- | 'z'
30
- | 'A'
31
- | 'B'
32
- | 'C'
33
- | 'D'
34
- | 'E'
35
- | 'F'
36
- | 'G'
37
- | 'H'
38
- | 'I'
39
- | 'J'
40
- | 'K'
41
- | 'L'
42
- | 'M'
43
- | 'N'
44
- | 'O'
45
- | 'P'
46
- | 'Q'
47
- | 'R'
48
- | 'S'
49
- | 'T'
50
- | 'U'
51
- | 'V'
52
- | 'W'
53
- | 'X'
54
- | 'Y'
55
- | 'Z'
56
- | '0'
57
- | '1'
58
- | '2'
59
- | '3'
60
- | '4'
61
- | '5'
62
- | '6'
63
- | '7'
64
- | '8'
65
- | '9'
66
- | '-'
67
- | '_';
68
-
69
- type ValidateName<T extends string, Original extends string = T> =
70
- // For widened strings, don't attempt validation – let them flow through unchanged
71
- string extends T // string is not wider than T, ie T is string
72
- ? T
73
- : T extends ''
74
- ? Original extends ''
75
- ? '❌ Name cannot be empty'
76
- : Original
77
- : T extends `${infer First}${infer Rest}`
78
- ? First extends ValidChars
79
- ? ValidateName<Rest, Original>
80
- : `❌ Invalid character in "${Original}". Only A-Z, a-z, 0-9, -, _ allowed`
81
- : never;
82
-
83
3
  type DefaultMaxDepth = 8;
84
4
  type HasDefaults<S> = S extends {
85
5
  _zod: {
@@ -204,4 +124,4 @@ declare function createAppScope<FlagSchema extends ZodObject<any>, FactSchema ex
204
124
  __error__: 'createAppScope: flagSchema must have .default() for all leaf fields';
205
125
  }): AppScope<FlagSchema, FactSchema>;
206
126
 
207
- export { type ValidateName as V, createAppScope as c };
127
+ export { createAppScope as c };
@@ -1,85 +1,5 @@
1
1
  import { ZodObject, ZodDefault, z } from 'zod';
2
2
 
3
- type ValidChars =
4
- | 'a'
5
- | 'b'
6
- | 'c'
7
- | 'd'
8
- | 'e'
9
- | 'f'
10
- | 'g'
11
- | 'h'
12
- | 'i'
13
- | 'j'
14
- | 'k'
15
- | 'l'
16
- | 'm'
17
- | 'n'
18
- | 'o'
19
- | 'p'
20
- | 'q'
21
- | 'r'
22
- | 's'
23
- | 't'
24
- | 'u'
25
- | 'v'
26
- | 'w'
27
- | 'x'
28
- | 'y'
29
- | 'z'
30
- | 'A'
31
- | 'B'
32
- | 'C'
33
- | 'D'
34
- | 'E'
35
- | 'F'
36
- | 'G'
37
- | 'H'
38
- | 'I'
39
- | 'J'
40
- | 'K'
41
- | 'L'
42
- | 'M'
43
- | 'N'
44
- | 'O'
45
- | 'P'
46
- | 'Q'
47
- | 'R'
48
- | 'S'
49
- | 'T'
50
- | 'U'
51
- | 'V'
52
- | 'W'
53
- | 'X'
54
- | 'Y'
55
- | 'Z'
56
- | '0'
57
- | '1'
58
- | '2'
59
- | '3'
60
- | '4'
61
- | '5'
62
- | '6'
63
- | '7'
64
- | '8'
65
- | '9'
66
- | '-'
67
- | '_';
68
-
69
- type ValidateName<T extends string, Original extends string = T> =
70
- // For widened strings, don't attempt validation – let them flow through unchanged
71
- string extends T // string is not wider than T, ie T is string
72
- ? T
73
- : T extends ''
74
- ? Original extends ''
75
- ? '❌ Name cannot be empty'
76
- : Original
77
- : T extends `${infer First}${infer Rest}`
78
- ? First extends ValidChars
79
- ? ValidateName<Rest, Original>
80
- : `❌ Invalid character in "${Original}". Only A-Z, a-z, 0-9, -, _ allowed`
81
- : never;
82
-
83
3
  type DefaultMaxDepth = 8;
84
4
  type HasDefaults<S> = S extends {
85
5
  _zod: {
@@ -204,4 +124,4 @@ declare function createAppScope<FlagSchema extends ZodObject<any>, FactSchema ex
204
124
  __error__: 'createAppScope: flagSchema must have .default() for all leaf fields';
205
125
  }): AppScope<FlagSchema, FactSchema>;
206
126
 
207
- export { type ValidateName as V, createAppScope as c };
127
+ export { createAppScope as c };
package/dist/bin.cjs CHANGED
@@ -553,7 +553,7 @@ var init_package = __esm({
553
553
  "package.json"() {
554
554
  package_default = {
555
555
  name: "axiom",
556
- version: "0.40.0",
556
+ version: "0.42.0",
557
557
  type: "module",
558
558
  author: "Axiom, Inc.",
559
559
  contributors: [
@@ -609,6 +609,16 @@ var init_package = __esm({
609
609
  default: "./dist/evals/aggregations.cjs"
610
610
  }
611
611
  },
612
+ "./ai/evals/scorers": {
613
+ import: {
614
+ types: "./dist/evals/scorers.d.ts",
615
+ default: "./dist/evals/scorers.js"
616
+ },
617
+ require: {
618
+ types: "./dist/evals/scorers.d.cts",
619
+ default: "./dist/evals/scorers.cjs"
620
+ }
621
+ },
612
622
  "./ai/config": {
613
623
  import: {
614
624
  types: "./dist/config.d.ts",
@@ -2480,11 +2490,11 @@ function setupEvalProvider(connection) {
2480
2490
  axiomProvider = new import_sdk_trace_node.NodeTracerProvider({
2481
2491
  resource: (0, import_resources.resourceFromAttributes)({
2482
2492
  ["service.name"]: "axiom",
2483
- ["service.version"]: "0.40.0"
2493
+ ["service.version"]: "0.42.0"
2484
2494
  }),
2485
2495
  spanProcessors: [processor]
2486
2496
  });
2487
- axiomTracer = axiomProvider.getTracer("axiom", "0.40.0");
2497
+ axiomTracer = axiomProvider.getTracer("axiom", "0.42.0");
2488
2498
  }
2489
2499
  async function initInstrumentation(config) {
2490
2500
  if (initialized) {
@@ -2496,7 +2506,7 @@ async function initInstrumentation(config) {
2496
2506
  }
2497
2507
  initializationPromise = (async () => {
2498
2508
  if (!config.enabled) {
2499
- axiomTracer = import_api10.trace.getTracer("axiom", "0.40.0");
2509
+ axiomTracer = import_api10.trace.getTracer("axiom", "0.42.0");
2500
2510
  initialized = true;
2501
2511
  return;
2502
2512
  }
@@ -3239,7 +3249,7 @@ var import_commander2 = require("commander");
3239
3249
  var loadVersionCommand = (program2) => {
3240
3250
  return program2.addCommand(
3241
3251
  new import_commander2.Command("version").description("cli version").action(() => {
3242
- console.log("0.40.0");
3252
+ console.log("0.42.0");
3243
3253
  })
3244
3254
  );
3245
3255
  };
@@ -3249,7 +3259,7 @@ var { loadEnvConfig } = import_env.default;
3249
3259
  loadEnvConfig(process.cwd());
3250
3260
  var { cleanedArgv, overrides } = extractOverrides(process.argv.slice(2));
3251
3261
  var program = new import_commander3.Command();
3252
- program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.40.0");
3262
+ program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.42.0");
3253
3263
  program.hook("preAction", async (_, actionCommand) => {
3254
3264
  const commandName = actionCommand.name();
3255
3265
  const parentCommand = actionCommand.parent;