llm-advanced-tools 0.1.0 β 0.1.1
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 +21 -0
- package/README.md +10 -22
- package/package.json +22 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 hetpatel-11
|
|
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
|
@@ -8,9 +8,10 @@ A TypeScript library that brings Anthropic's advanced tool use features to all m
|
|
|
8
8
|
Dynamically discover and load tools on-demand instead of loading everything upfront.
|
|
9
9
|
|
|
10
10
|
**Benefits:**
|
|
11
|
-
-
|
|
11
|
+
- Reduces token usage by deferring tool loading
|
|
12
12
|
- Improved accuracy with large tool sets
|
|
13
13
|
- Scale to hundreds or thousands of tools
|
|
14
|
+
- *Anthropic reports 85%+ token reduction in their testing*
|
|
14
15
|
|
|
15
16
|
### π Programmatic Tool Calling
|
|
16
17
|
Orchestrate tools through code execution rather than individual API calls.
|
|
@@ -19,26 +20,26 @@ Orchestrate tools through code execution rather than individual API calls.
|
|
|
19
20
|
- Keep intermediate results out of LLM context
|
|
20
21
|
- Parallel tool execution
|
|
21
22
|
- Better control flow with loops, conditionals, data transformations
|
|
22
|
-
- 37%+
|
|
23
|
+
- *Anthropic reports 37%+ token reduction on complex tasks in their testing*
|
|
23
24
|
|
|
24
25
|
### π Tool Use Examples
|
|
25
26
|
Provide sample invocations to improve tool call accuracy.
|
|
26
27
|
|
|
27
28
|
**Benefits:**
|
|
28
|
-
- 18%+ accuracy improvement on complex parameters
|
|
29
29
|
- Show proper usage patterns
|
|
30
30
|
- Clarify format conventions and optional parameters
|
|
31
|
+
- *Anthropic reports 18%+ accuracy improvement on complex parameters in their testing*
|
|
31
32
|
|
|
32
33
|
## Installation
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
|
-
npm install advanced-tools
|
|
36
|
+
npm install llm-advanced-tools
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
## Quick Start
|
|
39
40
|
|
|
40
41
|
```typescript
|
|
41
|
-
import { Client, ToolRegistry, OpenAIAdapter, ToolDefinition } from 'advanced-tools';
|
|
42
|
+
import { Client, ToolRegistry, OpenAIAdapter, ToolDefinition } from 'llm-advanced-tools';
|
|
42
43
|
|
|
43
44
|
// 1. Create a tool registry
|
|
44
45
|
const registry = new ToolRegistry({
|
|
@@ -92,7 +93,7 @@ console.log(response);
|
|
|
92
93
|
Use the latest Vercel AI SDK with any provider:
|
|
93
94
|
|
|
94
95
|
```typescript
|
|
95
|
-
import { Client, ToolRegistry, VercelAIAdapter } from 'advanced-tools';
|
|
96
|
+
import { Client, ToolRegistry, VercelAIAdapter } from 'llm-advanced-tools';
|
|
96
97
|
import { openai } from '@ai-sdk/openai';
|
|
97
98
|
import { anthropic } from '@ai-sdk/anthropic';
|
|
98
99
|
|
|
@@ -133,7 +134,7 @@ const response = await openaiClient.ask("What's the weather?");
|
|
|
133
134
|
β
|
|
134
135
|
βΌ
|
|
135
136
|
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
136
|
-
β Unified Tool Interface
|
|
137
|
+
β Unified Tool Interface β
|
|
137
138
|
β β’ ToolRegistry (search, defer loading) β
|
|
138
139
|
β β’ CodeExecutor (programmatic calling) β
|
|
139
140
|
β β’ ToolDefinition (with examples) β
|
|
@@ -141,7 +142,7 @@ const response = await openaiClient.ask("What's the weather?");
|
|
|
141
142
|
β
|
|
142
143
|
βΌ
|
|
143
144
|
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
144
|
-
β Provider Adapters
|
|
145
|
+
β Provider Adapters β
|
|
145
146
|
β ββββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ β
|
|
146
147
|
β β OpenAI βAnthropic β Google β Ollama β β
|
|
147
148
|
β ββββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ β
|
|
@@ -223,7 +224,6 @@ The LLM learns proper usage patterns from the examples.
|
|
|
223
224
|
| β³ Google | β (emulated) | β (emulated) | β (emulated) | β
via AI SDK |
|
|
224
225
|
| β³ Others | β (emulated) | β (emulated) | β (emulated) | β
via AI SDK |
|
|
225
226
|
| OpenAI (direct) | β (emulated) | β (emulated) | β (emulated) | β
Ready |
|
|
226
|
-
| Anthropic (direct) | β
| β
| β
| π§ Coming |
|
|
227
227
|
| Ollama | β (emulated) | β (emulated) | β (emulated) | π§ Coming |
|
|
228
228
|
|
|
229
229
|
## Configuration
|
|
@@ -311,17 +311,6 @@ class Client {
|
|
|
311
311
|
}
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
-
## Performance
|
|
315
|
-
|
|
316
|
-
Based on internal testing:
|
|
317
|
-
|
|
318
|
-
| Metric | Traditional | With Advanced Tools | Improvement |
|
|
319
|
-
|--------|------------|---------------------|-------------|
|
|
320
|
-
| Token usage (large tool set) | ~77K tokens | ~8.7K tokens | **88% reduction** |
|
|
321
|
-
| Token usage (complex workflows) | 43,588 tokens | 27,297 tokens | **37% reduction** |
|
|
322
|
-
| Tool selection accuracy | 79.5% | 88.1% | **+8.6 points** |
|
|
323
|
-
| Parameter accuracy | 72% | 90% | **+18 points** |
|
|
324
|
-
|
|
325
314
|
## When to Use Each Feature
|
|
326
315
|
|
|
327
316
|
### Tool Search Tool
|
|
@@ -376,7 +365,6 @@ The default VM executor is **NOT secure** for untrusted code. For production:
|
|
|
376
365
|
## Roadmap
|
|
377
366
|
|
|
378
367
|
- [x] Core library with OpenAI adapter
|
|
379
|
-
- [ ] Anthropic adapter (native features)
|
|
380
368
|
- [ ] Google/Gemini adapter
|
|
381
369
|
- [ ] Ollama adapter with model capability detection
|
|
382
370
|
- [ ] Docker-based executor
|
|
@@ -397,6 +385,6 @@ MIT
|
|
|
397
385
|
## Credits
|
|
398
386
|
|
|
399
387
|
This library implements features described in Anthropic's blog post:
|
|
400
|
-
[Introducing advanced tool use on the Claude Developer Platform](https://www.anthropic.com/
|
|
388
|
+
[Introducing advanced tool use on the Claude Developer Platform](https://www.anthropic.com/engineering/advanced-tool-use)
|
|
401
389
|
|
|
402
390
|
The implementation is provider-agnostic and works with any LLM that supports function calling.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-advanced-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Provider-agnostic advanced tool use library for LLMs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,19 +29,35 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"openai": "^4.0.0",
|
|
32
|
-
"
|
|
32
|
+
"natural": "^6.0.0",
|
|
33
|
+
"zod": "^3.22.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
33
36
|
"ai": "^4.0.0",
|
|
34
37
|
"@ai-sdk/openai": "^1.0.0",
|
|
35
|
-
"@ai-sdk/anthropic": "^1.0.0"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
"@ai-sdk/anthropic": "^1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"ai": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"@ai-sdk/openai": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@ai-sdk/anthropic": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
38
50
|
},
|
|
39
51
|
"devDependencies": {
|
|
40
|
-
"@
|
|
52
|
+
"@ai-sdk/anthropic": "^1.0.0",
|
|
53
|
+
"@ai-sdk/openai": "^1.0.0",
|
|
54
|
+
"@anthropic-ai/sdk": "^0.27.0",
|
|
41
55
|
"@types/jest": "^29.0.0",
|
|
42
56
|
"@types/natural": "^5.1.0",
|
|
57
|
+
"@types/node": "^20.0.0",
|
|
43
58
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
44
59
|
"@typescript-eslint/parser": "^6.0.0",
|
|
60
|
+
"ai": "^4.0.0",
|
|
45
61
|
"eslint": "^8.0.0",
|
|
46
62
|
"jest": "^29.0.0",
|
|
47
63
|
"prettier": "^3.0.0",
|