@atgs/tapeworm 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  # Tapeworm
4
4
 
5
- Tapeworm is an in-browser and Node agent framework.
5
+ <h3>In-browser and Node agent framework.</h3>
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@atgs/tapeworm.svg?style=flat-square)](https://www.npmjs.org/package/@atgs/tapeworm.svg)
8
+
9
+ [![npm downloads](https://img.shields.io/npm/dm/@atgs/tapeworm?style=flat-square)](https://npm-stat.com/charts.html?package=@atgs/tapeworm)
10
+
11
+ [repo link](https://github.com/andygrace227/tapeworm)
6
12
 
7
13
  This is the root package for Tapeworm. You can consume other packages like @atgs/tapeworm_bedrock for AWS Bedrock support.
8
14
 
@@ -12,11 +18,14 @@ It provides an object-oriented API to create agents that run either on Node or w
12
18
 
13
19
  ## Current Features
14
20
 
15
- - Base API Defined
16
- - Supports `function` tools
17
- - Supports Ollama models
21
+ - Base API Defined.
22
+ - Supports `function` tools.
23
+ - Supports Ollama models.
24
+ - Has a Babel plugin to make tool creation really easy.
18
25
 
19
- ## Example (uses Babel plugin @atgs/babel-plugin-tapeworm-decorator)
26
+ ## Examples
27
+
28
+ #### With the babel plugin (@atgs/@atgs/babel-plugin-tapeworm-decorator) (recommended, super concise)
20
29
 
21
30
  ```js
22
31
  @Tool({ description: "Adds 2 numbers together" })
@@ -42,6 +51,10 @@ class AdditionTool extends Tool {
42
51
  }
43
52
  }
44
53
 
54
+ const ollama = new OllamaModel("http://localhost:11434", "gpt-oss:20b", {
55
+ stream: false,
56
+ });
57
+
45
58
  const agent = Agent.builder()
46
59
  .name("calculatorAgent")
47
60
  .tools([new AdditionTool()])
@@ -52,6 +65,81 @@ const agent = Agent.builder()
52
65
  await agent.invoke("What is 9 + 10?");
53
66
  ```
54
67
 
68
+ #### Without the plugin (still pretty readable.)
69
+
70
+ ```js
71
+ import {
72
+ Agent,
73
+ OllamaModel,
74
+ Parameter,
75
+ Tool,
76
+ ToolSchema,
77
+ } from "../../dist/tapeworm.es.js";
78
+
79
+ class AdditionTool extends Tool {
80
+ /**
81
+ * Unique name used to reference this tool.
82
+ * @returns Tool identifier string.
83
+ */
84
+ getName() {
85
+ return "AdditionTool";
86
+ }
87
+
88
+ /**
89
+ * Short description provided to the model.
90
+ * @returns Human-readable explanation of the tool.
91
+ */
92
+ getDescription() {
93
+ return "Adds two numbers together.";
94
+ }
95
+
96
+ getToolSchema() {
97
+ return (
98
+ ToolSchema.builder()
99
+ .addParameter(
100
+ Parameter.builder()
101
+ .name("a")
102
+ .description("The first number to add.")
103
+ .required(true)
104
+ .type("number")
105
+ .build(),
106
+ )
107
+ //... more parameter additions.
108
+ .output("A number that is equal to a + b")
109
+ .build()
110
+ );
111
+ }
112
+
113
+ execute(input) {
114
+ let a = +input.a;
115
+ let b = +input.b;
116
+ console.log("Adding " + a + " and " + b + ": " + (a + b));
117
+ return a + b;
118
+ }
119
+ }
120
+
121
+ // Because this is a test file, we are going to run this locally using Ollama
122
+
123
+ const ollama = new OllamaModel("http://localhost:11434", "gpt-oss:20b", {
124
+ stream: false,
125
+ });
126
+
127
+ const agent = Agent.builder()
128
+ .name("calculatorAgent")
129
+ .tools([new AdditionTool()])
130
+ .systemPrompt("You are an agent that runs math operations.")
131
+ .model(ollama)
132
+ .build();
133
+
134
+ await agent.invoke("What is 9 + 10");
135
+ ```
136
+
137
+ ## Tapeworm's Tenets
138
+
139
+ - **Be the most ergonomic agentic solution for Node and the browser.** Each commit should make it easier to develop and deploy agentic AI solutions.
140
+ - **Be as model-agnostic as possible.** Use your own machine, AWS, Google, a literal potato... we don't care.
141
+ - **Keep things light.** We already waste so much water and energy with AI. The overhead from Tapeworm should be kept to a minimum when possible.
142
+
55
143
  ## Roadmap
56
144
 
57
145
  Tapeworm seeks to be the most ergonomic agentic solution for Node and the browser.
@@ -60,12 +148,6 @@ It has a long way to go before this project is there, but I believe we're off to
60
148
 
61
149
  Here are the main areas that will be addressed:
62
150
 
63
- ### Better Agent Definitions
64
-
65
- Agents will have a dedicated builder, and I will attempt to make tool definitions a lot easier to write so that the `getName()`, `getDescription()`, and `getToolSchema()` can be generated from your JSDoc or with annotations.
66
-
67
- In the meantime, schemas are easy to define with builders. See the example calculator bot for an example.
68
-
69
151
  ### More documentation and examples
70
152
 
71
153
  We will build JS Docs and expose them, and more examples.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file contains TypeScript decorator functions for Tapeworm.
3
+ *
4
+ * They are different from the Babel decorators in @atgs/babel-plugin-tapeworm-decorator, but they achieve the same functionality.
5
+ *
6
+ *
7
+ */
8
+ export declare function ToolName(name: String): (toolClass: Function) => void;
9
+ export declare function ToolDescription(description: String): (toolClass: Function) => void;
10
+ interface ShortHandParameter {
11
+ name: string;
12
+ description: string;
13
+ required: boolean;
14
+ type: string;
15
+ }
16
+ export declare function ToolParameter(parameter: ShortHandParameter): (toolClass: Function) => void;
17
+ export declare function ToolOutput(output: string): (toolClass: Function) => void;
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atgs/tapeworm",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "dist/tapeworm.cjs.js",
6
6
  "module": "dist/tapeworm.es.js",