ai 6.0.39 → 6.0.41
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 84b6e6d: Revert "feat(ai): expose token usage in useChat onFinish callback#11871
|
|
8
|
+
|
|
9
|
+
## 6.0.40
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ab57783: Add usage information to onFinish callback in useChat
|
|
14
|
+
|
|
3
15
|
## 6.0.39
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1049,7 +1049,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
1049
1049
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1050
1050
|
|
|
1051
1051
|
// src/version.ts
|
|
1052
|
-
var VERSION = true ? "6.0.
|
|
1052
|
+
var VERSION = true ? "6.0.41" : "0.0.0-test";
|
|
1053
1053
|
|
|
1054
1054
|
// src/util/download/download.ts
|
|
1055
1055
|
var download = async ({ url }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -944,7 +944,7 @@ import {
|
|
|
944
944
|
} from "@ai-sdk/provider-utils";
|
|
945
945
|
|
|
946
946
|
// src/version.ts
|
|
947
|
-
var VERSION = true ? "6.0.
|
|
947
|
+
var VERSION = true ? "6.0.41" : "0.0.0-test";
|
|
948
948
|
|
|
949
949
|
// src/util/download/download.ts
|
|
950
950
|
var download = async ({ url }) => {
|
package/dist/internal/index.js
CHANGED
|
@@ -153,7 +153,7 @@ var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
|
153
153
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
154
154
|
|
|
155
155
|
// src/version.ts
|
|
156
|
-
var VERSION = true ? "6.0.
|
|
156
|
+
var VERSION = true ? "6.0.41" : "0.0.0-test";
|
|
157
157
|
|
|
158
158
|
// src/util/download/download.ts
|
|
159
159
|
var download = async ({ url }) => {
|
package/dist/internal/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
} from "@ai-sdk/provider-utils";
|
|
129
129
|
|
|
130
130
|
// src/version.ts
|
|
131
|
-
var VERSION = true ? "6.0.
|
|
131
|
+
var VERSION = true ? "6.0.41" : "0.0.0-test";
|
|
132
132
|
|
|
133
133
|
// src/util/download/download.ts
|
|
134
134
|
var download = async ({ url }) => {
|
|
@@ -87,6 +87,7 @@ The open-source community has created the following providers:
|
|
|
87
87
|
- [ACP Provider](/providers/community-providers/acp) (`@mcpc-tech/acp-ai-provider`)
|
|
88
88
|
- [OpenCode Provider](/providers/community-providers/opencode-sdk) (`ai-sdk-provider-opencode-sdk`)
|
|
89
89
|
- [Codex CLI Provider](/providers/community-providers/codex-cli) (`ai-sdk-provider-codex-cli`)
|
|
90
|
+
- [Soniox Provider](/providers/community-providers/soniox) (`@soniox/vercel-ai-sdk-provider`)
|
|
90
91
|
- [Zhipu (Z.AI) Provider](/providers/community-providers/zhipu) (`zhipu-ai-provider`)
|
|
91
92
|
|
|
92
93
|
## Self-Hosted Models
|
|
@@ -39,6 +39,95 @@ The output of the tool calls are returned using tool result objects.
|
|
|
39
39
|
You can automatically pass tool results back to the LLM
|
|
40
40
|
using [multi-step calls](/docs/ai-sdk-core/tools-and-tool-calling#multi-step-calls) with `streamText` and `generateText`.
|
|
41
41
|
|
|
42
|
+
## Types of Tools
|
|
43
|
+
|
|
44
|
+
The AI SDK supports three types of tools, each with different trade-offs:
|
|
45
|
+
|
|
46
|
+
### Custom Tools
|
|
47
|
+
|
|
48
|
+
Custom tools are tools you define entirely yourself, including the description, input schema, and execute function. They are provider-agnostic and give you full control.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { tool } from 'ai';
|
|
52
|
+
import { z } from 'zod';
|
|
53
|
+
|
|
54
|
+
const weatherTool = tool({
|
|
55
|
+
description: 'Get the weather in a location',
|
|
56
|
+
inputSchema: z.object({
|
|
57
|
+
location: z.string().describe('The location to get the weather for'),
|
|
58
|
+
}),
|
|
59
|
+
execute: async ({ location }) => {
|
|
60
|
+
// Your implementation
|
|
61
|
+
return { temperature: 72, conditions: 'sunny' };
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**When to use**: When you need full control, want provider portability, or are implementing application-specific functionality.
|
|
67
|
+
|
|
68
|
+
### Provider-Defined Tools
|
|
69
|
+
|
|
70
|
+
Provider-defined tools are tools where the provider specifies the tool's `inputSchema` and `description`, but you provide the `execute` function. These are sometimes called "client tools" because execution happens on your side.
|
|
71
|
+
|
|
72
|
+
Examples include Anthropic's `bash` and `text_editor` tools. The model has been specifically trained to use these tools effectively, which can result in better performance for supported tasks.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
76
|
+
import { generateText } from 'ai';
|
|
77
|
+
|
|
78
|
+
const result = await generateText({
|
|
79
|
+
model: anthropic('claude-opus-4-5'),
|
|
80
|
+
tools: {
|
|
81
|
+
bash: anthropic.tools.bash_20250124({
|
|
82
|
+
execute: async ({ command }) => {
|
|
83
|
+
// Your implementation to run the command
|
|
84
|
+
return runCommand(command);
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
88
|
+
prompt: 'List files in the current directory',
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**When to use**: When the provider offers a tool the model is trained to use well, and you want better performance for that specific task.
|
|
93
|
+
|
|
94
|
+
### Provider-Executed Tools
|
|
95
|
+
|
|
96
|
+
Provider-executed tools are tools that run entirely on the provider's servers. You configure them, but the provider handles execution. These are sometimes called "server-side tools".
|
|
97
|
+
|
|
98
|
+
Examples include OpenAI's web search and Anthropic's code execution. These provide out-of-the-box functionality without requiring you to set up infrastructure.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { openai } from '@ai-sdk/openai';
|
|
102
|
+
import { generateText } from 'ai';
|
|
103
|
+
|
|
104
|
+
const result = await generateText({
|
|
105
|
+
model: openai('gpt-5.2'),
|
|
106
|
+
tools: {
|
|
107
|
+
web_search: openai.tools.webSearch(),
|
|
108
|
+
},
|
|
109
|
+
prompt: 'What happened in the news today?',
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**When to use**: When you want powerful functionality (like web search or sandboxed code execution) without managing the infrastructure yourself.
|
|
114
|
+
|
|
115
|
+
### Comparison
|
|
116
|
+
|
|
117
|
+
| Aspect | Custom Tools | Provider-Defined Tools | Provider-Executed Tools |
|
|
118
|
+
| ------------------ | ------------------------ | ---------------------- | ----------------------- |
|
|
119
|
+
| **Execution** | Your code | Your code | Provider's servers |
|
|
120
|
+
| **Schema** | You define | Provider defines | Provider defines |
|
|
121
|
+
| **Portability** | Works with any provider | Provider-specific | Provider-specific |
|
|
122
|
+
| **Model Training** | General tool use | Optimized for the tool | Optimized for the tool |
|
|
123
|
+
| **Setup** | You implement everything | You implement execute | Configuration only |
|
|
124
|
+
|
|
125
|
+
<Note>
|
|
126
|
+
Provider-defined and provider-executed tools are documented in each provider's
|
|
127
|
+
page. See [Anthropic Provider](/providers/ai-sdk-providers/anthropic) and
|
|
128
|
+
[OpenAI Provider](/providers/ai-sdk-providers/openai) for examples.
|
|
129
|
+
</Note>
|
|
130
|
+
|
|
42
131
|
## Schemas
|
|
43
132
|
|
|
44
133
|
Schemas are used to define and validate the [tool input](/docs/ai-sdk-core/tools-and-tool-calling), tools outputs, and structured output generation.
|