ai 6.0.229 → 6.0.230
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 +9 -0
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/20-tool.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +1 -1
- package/package.json +3 -3
- package/src/generate-text/generate-text.ts +10 -1
package/dist/internal/index.js
CHANGED
|
@@ -152,7 +152,7 @@ function detectMediaType({
|
|
|
152
152
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var VERSION = true ? "6.0.
|
|
155
|
+
var VERSION = true ? "6.0.230" : "0.0.0-test";
|
|
156
156
|
|
|
157
157
|
// src/util/download/download.ts
|
|
158
158
|
var download = async ({
|
package/dist/internal/index.mjs
CHANGED
|
@@ -723,7 +723,7 @@ The following tool input lifecycle hooks are available:
|
|
|
723
723
|
- **`onInputDelta`**: Called for each chunk of text as the input is streamed
|
|
724
724
|
- **`onInputAvailable`**: Called when the complete input is available and validated
|
|
725
725
|
|
|
726
|
-
`onInputStart`
|
|
726
|
+
`onInputStart` is always called before `onInputAvailable`, including when using `generateText`. `onInputDelta` is only called in streaming contexts (when using `streamText`).
|
|
727
727
|
|
|
728
728
|
### Example
|
|
729
729
|
|
|
@@ -146,7 +146,7 @@ export const weatherTool = tool({
|
|
|
146
146
|
isOptional: true,
|
|
147
147
|
type: '(options: ToolExecutionOptions) => void | PromiseLike<void>',
|
|
148
148
|
description:
|
|
149
|
-
'Optional function that is called when the
|
|
149
|
+
'Optional function that is called when the model starts generating the tool input. In non-streaming contexts, it is called immediately before onInputAvailable.',
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
name: 'onInputDelta',
|
|
@@ -131,7 +131,7 @@ export const customTool = dynamicTool({
|
|
|
131
131
|
isOptional: true,
|
|
132
132
|
type: '(options: ToolExecutionOptions) => void | PromiseLike<void>',
|
|
133
133
|
description:
|
|
134
|
-
'Optional function that is called when the
|
|
134
|
+
'Optional function that is called when the model starts generating the tool input. In non-streaming contexts, it is called immediately before onInputAvailable.'
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
name: 'onInputDelta',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.230",
|
|
4
4
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "^1.9.0",
|
|
48
|
-
"@ai-sdk/gateway": "3.0.
|
|
48
|
+
"@ai-sdk/gateway": "3.0.153",
|
|
49
49
|
"@ai-sdk/provider": "3.0.14",
|
|
50
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
50
|
+
"@ai-sdk/provider-utils": "4.0.40"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@edge-runtime/vm": "^5.0.0",
|
|
@@ -942,7 +942,16 @@ export async function generateText<
|
|
|
942
942
|
continue;
|
|
943
943
|
}
|
|
944
944
|
|
|
945
|
-
if (tool
|
|
945
|
+
if (tool.onInputStart != null) {
|
|
946
|
+
await tool.onInputStart({
|
|
947
|
+
toolCallId: toolCall.toolCallId,
|
|
948
|
+
messages: stepInputMessages,
|
|
949
|
+
abortSignal: mergedAbortSignal,
|
|
950
|
+
experimental_context,
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
if (tool.onInputAvailable != null) {
|
|
946
955
|
await tool.onInputAvailable({
|
|
947
956
|
input: toolCall.input,
|
|
948
957
|
toolCallId: toolCall.toolCallId,
|