@atgs/tapeworm 0.1.1 → 0.1.3

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 (2) hide show
  1. package/README.md +33 -40
  2. package/package.json +5 -1
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- ![Tapeworm Logo](./tapeworm.svg)
1
+ ![Tapeworm Logo](https://raw.githubusercontent.com/andygrace227/tapeworm/main/tapeworm.svg)
2
2
 
3
3
  # Tapeworm
4
4
 
5
- Tapeworm is an in-browser and node agent framework.
5
+ Tapeworm is an in-browser and Node agent framework.
6
6
 
7
7
  This is the root package for Tapeworm. You can consume other packages like @atgs/tapeworm_bedrock for AWS Bedrock support.
8
8
 
@@ -16,47 +16,40 @@ It provides an object-oriented API to create agents that run either on Node or w
16
16
  - Supports `function` tools
17
17
  - Supports Ollama models
18
18
 
19
- ## Example
20
-
21
- ```
22
- import {Agent, OllamaModel, Parameter, Tool, ToolSchema} from '../../dist/tapeworm.es.js';
23
-
24
- class SomeTool extends Tool {
25
-
26
- // Get the name of the function
27
- getName() {
28
- return "AdditionTool";
29
- }
30
-
31
- // Tell models what this function does
32
- getDescription() {
33
- return "Adds two numbers together.";
34
- }
35
-
36
- // Define the tool schema
37
- getToolSchema() {
38
-
39
- }
40
-
41
- // Actually run the code!
42
- execute(input) {
43
- let a = input.a;
44
- let b = input.b;
45
- return a + b;
46
- }
47
-
19
+ ## Example (uses Babel plugin @atgs/babel-plugin-tapeworm-decorator)
20
+
21
+ ```js
22
+ @Tool({ description: "Adds 2 numbers together" })
23
+ class AdditionTool extends Tool {
24
+ @TParam({
25
+ name: "a",
26
+ description: "The first number to add",
27
+ required: true,
28
+ type: "number",
29
+ })
30
+ @TParam({
31
+ name: "b",
32
+ description: "The second number to add",
33
+ required: true,
34
+ type: "number",
35
+ })
36
+ @TOutput("The sum of inputs a and b")
37
+ execute(input) {
38
+ let a = +input.a;
39
+ let b = +input.b;
40
+ console.log("Adding " + a + " and " + b + ": " + (a + b));
41
+ return a + b;
42
+ }
48
43
  }
49
44
 
50
- const ollama = new Model();
51
-
52
- const agent = new Agent();
53
- agent.name = "agent";
54
- agent.tools = [new YourTool(), new YourOtherTool()]
55
- agent.system_prompt = "You are an agent "
56
- agent.model = ollama;
57
-
58
- await agent.invoke("What is 9 + 10"); // Most likely doesn't print 21.
45
+ const agent = Agent.builder()
46
+ .name("calculatorAgent")
47
+ .tools([new AdditionTool()])
48
+ .systemPrompt("You are an agent that runs math operations.")
49
+ .model(ollama)
50
+ .build();
59
51
 
52
+ await agent.invoke("What is 9 + 10?");
60
53
  ```
61
54
 
62
55
  ## Roadmap
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@atgs/tapeworm",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "dist/tapeworm.cjs.js",
6
6
  "module": "dist/tapeworm.es.js",
7
7
  "browser": "dist/tapeworm.umd.js",
8
+ "exports": {
9
+ "import": "./dist/tapeworm.es.js",
10
+ "require": "./dist/tapeworm.cjs.js"
11
+ },
8
12
  "types": "dist/index.d.ts",
9
13
  "files": [
10
14
  "dist",