axiom 0.1.3 → 1.0.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/LICENSE.md +21 -0
- package/README.md +61 -123
- package/dist/bin.cjs +486 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +410 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-CKSTM4QJ.js +25 -0
- package/dist/chunk-CKSTM4QJ.js.map +1 -0
- package/dist/chunk-KEXKKQVW.js +41 -0
- package/dist/chunk-KEXKKQVW.js.map +1 -0
- package/dist/chunk-P444X2AY.js +45 -0
- package/dist/chunk-P444X2AY.js.map +1 -0
- package/dist/chunk-VJQQJFVJ.js +311 -0
- package/dist/chunk-VJQQJFVJ.js.map +1 -0
- package/dist/evals.cjs +646 -0
- package/dist/evals.cjs.map +1 -0
- package/dist/evals.d.cts +143 -0
- package/dist/evals.d.ts +143 -0
- package/dist/evals.js +267 -0
- package/dist/evals.js.map +1 -0
- package/dist/handlebars-4NZUZGZE.js +5865 -0
- package/dist/handlebars-4NZUZGZE.js.map +1 -0
- package/dist/index.cjs +7895 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +268 -0
- package/dist/index.d.ts +268 -0
- package/dist/index.js +1669 -0
- package/dist/index.js.map +1 -0
- package/dist/reporter-B9Ly79ok.d.cts +18 -0
- package/dist/reporter-B9Ly79ok.d.ts +18 -0
- package/package.json +96 -31
- package/.npmignore +0 -1
- package/LICENSE +0 -20
- package/bin/axiom +0 -3
- package/index.js +0 -2
- package/lib/bus.coffee +0 -3
- package/lib/cli.coffee +0 -53
- package/lib/core/delegate.coffee +0 -107
- package/lib/core/init.coffee +0 -52
- package/lib/core/internal.coffee +0 -66
- package/lib/core/link.coffee +0 -28
- package/lib/core/listen.coffee +0 -12
- package/lib/core/load.coffee +0 -80
- package/lib/core/loadProcess.coffee +0 -64
- package/lib/core/log.coffee +0 -18
- package/lib/core/logLevels.coffee +0 -16
- package/lib/core/request.coffee +0 -92
- package/lib/core/reset.coffee +0 -7
- package/lib/core/respond.coffee +0 -54
- package/lib/core/respondOnce.coffee +0 -17
- package/lib/core/send.coffee +0 -27
- package/lib/core/wireUpLoggers.coffee +0 -29
- package/lib/core.coffee +0 -11
- package/lib/errorTypes.coffee +0 -57
- package/lib/findProjectRoot.coffee +0 -20
- package/lib/getSafeCore.coffee +0 -22
- package/lib/getSafeRetriever.coffee +0 -11
- package/lib/helpers/ns-replace.coffee +0 -8
- package/lib/retriever.coffee +0 -29
- package/sample/project1/a1/package.json +0 -0
- package/sample/project1/appExtensions/doStuff.coffee +0 -4
- package/sample/project1/b1/b2/b3/.gitinclude +0 -0
- package/sample/project1/config/sample.coffee +0 -2
- package/sample/project1/index.js +0 -2
- package/sample/project1/main.coffee +0 -4
- package/sample/project1/package.json +0 -3
- package/sample/project2/index.js +0 -2
- package/sample/project2/main.coffee +0 -12
- package/sample/project2/package.json +0 -1
- package/sample/protocol/config/connect.coffee +0 -13
- package/sample/protocol/extensions/workInProgress.coffee +0 -4
- package/sample/protocol/index.js +0 -2
- package/sample/protocol/main.coffee +0 -20
- package/sample/protocol/package.json +0 -10
- package/test/cli.coffee +0 -141
- package/test/config.coffee +0 -77
- package/test/core.coffee +0 -437
- package/test/findProjectRoot.coffee +0 -31
- package/test/helpers/mockRetriever.coffee +0 -38
- package/test/init.coffee +0 -118
- package/test/internal.coffee +0 -41
- package/test/link.coffee +0 -66
- package/test/load.coffee +0 -300
- package/test/log.coffee +0 -94
- package/test/mocha.opts +0 -5
- package/test/retriever.coffee +0 -35
- package/tmp/README.md +0 -45
- package/tmp/app.coffee +0 -37
- package/tmp/axiom +0 -28
- package/tmp/cli_usage.md +0 -69
- package/tmp/createServer.coffee +0 -42
- package/tmp/hello.coffee +0 -2
- package/tmp/message.coffee +0 -26
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Axiom, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,139 +1,77 @@
|
|
|
1
|
-
# Axiom
|
|
1
|
+
# Axiom AI
|
|
2
2
|
|
|
3
|
-
Axiom
|
|
3
|
+
Axiom AI SDK provides an API to wrap your AI calls with observability instrumentation.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Model Wrapping
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```ts
|
|
8
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
9
|
+
import { axiomAIMiddleware } from 'axiom';
|
|
10
|
+
import { wrapLanguageModel } from 'ai';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
const openai = createOpenAI({
|
|
13
|
+
apiKey: process.env.OPENAI_API_KEY!,
|
|
14
|
+
compatibility: 'strict',
|
|
15
|
+
});
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
* Processes for:
|
|
14
|
-
* Install/Uninstall
|
|
15
|
-
* Build
|
|
16
|
-
* Test
|
|
17
|
-
* Runtime
|
|
18
|
-
* Feature Scaffolding
|
|
17
|
+
const model = openai('gpt-4o-mini');
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* Yeoman - Used for formalizing workflows, workflows are not extensible, there is no standard for organizing/extending the application runtime.
|
|
25
|
-
* FireShell - Ditto.
|
|
26
|
-
* Anvil.js - Very similar design goals to Axiom, and in fact we use the same underlying message bus (Postal.js). Whereas Anvil.js decided to bake in the lifecycles, we wanted these to be extensible and therefore we have a more lightweight core than Anvil ships with. We also wanted to extend the decoupled approach of tasks to building out the application runtime.
|
|
27
|
-
|
|
28
|
-
# Installation
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install -g axiom
|
|
19
|
+
export const gpt4oMini = wrapLanguageModel({
|
|
20
|
+
model,
|
|
21
|
+
middleware: [axiomAIMiddleware({ model })],
|
|
22
|
+
});
|
|
32
23
|
```
|
|
33
24
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
axiom client test
|
|
62
|
-
axiom server test
|
|
63
|
-
# Again, these assume axioms/tasks that exist with those names.
|
|
25
|
+
## Tool Wrapping
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { tool } from 'ai';
|
|
29
|
+
import { wrapTool } from 'axiom';
|
|
30
|
+
import { z } from 'zod';
|
|
31
|
+
|
|
32
|
+
const getWeather = tool({
|
|
33
|
+
description: 'Get current weather for a city',
|
|
34
|
+
parameters: z.object({
|
|
35
|
+
city: z.string().describe('The city name'),
|
|
36
|
+
country: z.string().describe('The country code'),
|
|
37
|
+
}),
|
|
38
|
+
execute: async ({ city, country }) => {
|
|
39
|
+
// Your tool implementation
|
|
40
|
+
return {
|
|
41
|
+
city,
|
|
42
|
+
country,
|
|
43
|
+
temperature: 22,
|
|
44
|
+
condition: 'sunny',
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Wrap the tool for observability
|
|
50
|
+
const wrappedWeatherTool = wrapTool('weatherTool', weatherTool);
|
|
64
51
|
```
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Services are in the format of:
|
|
82
|
-
|
|
83
|
-
```coffee-script
|
|
84
|
-
(args, done) ->
|
|
85
|
-
{foo, bar} = args
|
|
86
|
-
done null, {message: 'hello'}
|
|
53
|
+
## Making AI Calls
|
|
54
|
+
```ts
|
|
55
|
+
const result = await withSpan(
|
|
56
|
+
{ capability: 'weather_bot', step: 'get_weather' },
|
|
57
|
+
(span) => {
|
|
58
|
+
return generateText({
|
|
59
|
+
model: gpt4oMini,
|
|
60
|
+
messages: [{ role: 'user', content: 'What is the weather in London?' }],
|
|
61
|
+
tools: {
|
|
62
|
+
getWeather: wrappedWeatherTool,
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
)
|
|
87
67
|
```
|
|
88
68
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
https://github.com/torchlightsoftware/law
|
|
92
|
-
|
|
93
|
-
Here's an example module definition using Law:
|
|
94
|
-
|
|
95
|
-
```coffee-script
|
|
96
|
-
law = require 'law'
|
|
97
|
-
serviceDefs = law.load './services'
|
|
98
|
-
|
|
99
|
-
module.exports =
|
|
100
|
-
config:
|
|
101
|
-
test:
|
|
102
|
-
base: 'task'
|
|
103
|
-
stages: ['prepare', 'test', 'cleanup']
|
|
104
|
-
|
|
105
|
-
services: law.create {
|
|
106
|
-
services: serviceDefs
|
|
107
|
-
policy: require './policy'
|
|
108
|
-
}
|
|
69
|
+
## Install
|
|
109
70
|
|
|
71
|
+
```bash
|
|
72
|
+
npm install axiom
|
|
110
73
|
```
|
|
111
74
|
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
Modules in the Axiom ecosystem are the property of their respective authors. We make no guarantee for the quality, usefulness, or intent of any module.
|
|
115
|
-
|
|
116
|
-
## LICENSE
|
|
117
|
-
|
|
118
|
-
(MIT License)
|
|
119
|
-
|
|
120
|
-
Copyright (c) 2013 Torchlight Software <info@torchlightsoftware.com>
|
|
121
|
-
|
|
122
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
123
|
-
a copy of this software and associated documentation files (the
|
|
124
|
-
"Software"), to deal in the Software without restriction, including
|
|
125
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
126
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
127
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
128
|
-
the following conditions:
|
|
129
|
-
|
|
130
|
-
The above copyright notice and this permission notice shall be
|
|
131
|
-
included in all copies or substantial portions of the Software.
|
|
75
|
+
## Documentation
|
|
132
76
|
|
|
133
|
-
|
|
134
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
135
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
136
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
137
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
138
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
139
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
77
|
+
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).
|