ai 7.0.19 → 7.0.21
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 +16 -0
- package/dist/index.d.ts +20 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/03-agents/07-workflow-agent.mdx +1 -1
- package/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +3 -12
- package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +1 -1
- package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +2 -2
- package/package.json +2 -2
- package/src/agent/tool-loop-agent-settings.ts +7 -0
- package/src/generate-text/generate-text.ts +9 -1
- package/src/generate-text/stream-text.ts +9 -1
- package/src/util/write-to-server-response.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 308a519: chore: enforce consistent imports from `zod/v4` instead of `zod`
|
|
8
|
+
- Updated dependencies [308a519]
|
|
9
|
+
- Updated dependencies [7fe53d2]
|
|
10
|
+
- @ai-sdk/gateway@4.0.16
|
|
11
|
+
|
|
12
|
+
## 7.0.20
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- b9ac19f: Flush compressed Node.js response chunks as they are piped so UI message and text streams remain incremental in Express and Next.js.
|
|
17
|
+
- a4186d6: Promote the `repairToolCall` option to stable, with a deprecated `experimental_repairToolCall` alias for backwards compatibility.
|
|
18
|
+
|
|
3
19
|
## 7.0.19
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -3500,7 +3500,7 @@ type StreamTextOnAbortCallback<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Co
|
|
|
3500
3500
|
* @returns
|
|
3501
3501
|
* A result object for accessing different stream types and additional information.
|
|
3502
3502
|
*/
|
|
3503
|
-
declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string, never>>({ model, tools, toolChoice, instructions, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_sandbox: sandbox, output, toolApproval, experimental_toolApprovalSecret, experimental_telemetry, telemetry, prepareStep, providerOptions, activeTools, toolOrder, experimental_repairToolCall
|
|
3503
|
+
declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string, never>>({ model, tools, toolChoice, instructions, system, prompt, messages, allowSystemInMessages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_sandbox: sandbox, output, toolApproval, experimental_toolApprovalSecret, experimental_telemetry, telemetry, prepareStep, providerOptions, activeTools, toolOrder, experimental_repairToolCall, repairToolCall, experimental_refineToolInput: refineToolInput, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onEnd, onAbort, onStepEnd, onStepFinish, onStart, experimental_onStart, onStepStart, experimental_onStepStart, onLanguageModelCallStart, experimental_onLanguageModelCallStart, onLanguageModelCallEnd, experimental_onLanguageModelCallEnd, onToolExecutionStart, onToolExecutionEnd, experimental_onToolCallStart, experimental_onToolCallFinish, runtimeContext, toolsContext, experimental_include, include, _internal: { now, generateId, generateCallId, }, ...settings }: LanguageModelCallOptions & RequestOptions<TOOLS> & Prompt & ToolsContextParameter<TOOLS> & {
|
|
3504
3504
|
/**
|
|
3505
3505
|
* The language model to use.
|
|
3506
3506
|
*/
|
|
@@ -3585,6 +3585,12 @@ declare function streamText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Conte
|
|
|
3585
3585
|
/**
|
|
3586
3586
|
* A function that attempts to repair a tool call that failed to parse.
|
|
3587
3587
|
*/
|
|
3588
|
+
repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
|
3589
|
+
/**
|
|
3590
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
3591
|
+
*
|
|
3592
|
+
* @deprecated Use `repairToolCall` instead.
|
|
3593
|
+
*/
|
|
3588
3594
|
experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
|
3589
3595
|
/**
|
|
3590
3596
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
|
@@ -4814,7 +4820,7 @@ type GenerateTextInclude = {
|
|
|
4814
4820
|
* @returns
|
|
4815
4821
|
* A result object that contains the generated text, the results of the tool calls, and additional information.
|
|
4816
4822
|
*/
|
|
4817
|
-
declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, instructions, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_sandbox: sandbox, output, toolApproval, experimental_toolApprovalSecret, experimental_telemetry, telemetry, providerOptions, activeTools, toolOrder, prepareStep, experimental_repairToolCall
|
|
4823
|
+
declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, instructions, system, prompt, messages, allowSystemInMessages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_sandbox: sandbox, output, toolApproval, experimental_toolApprovalSecret, experimental_telemetry, telemetry, providerOptions, activeTools, toolOrder, prepareStep, experimental_repairToolCall, repairToolCall, experimental_refineToolInput: refineToolInput, experimental_download: download, runtimeContext, toolsContext, experimental_include, include, _internal: { generateId, generateCallId, now, }, onStart, experimental_onStart, onStepStart, experimental_onStepStart, onLanguageModelCallStart, experimental_onLanguageModelCallStart, onLanguageModelCallEnd, experimental_onLanguageModelCallEnd, onToolExecutionStart, onToolExecutionEnd, experimental_onToolCallStart, experimental_onToolCallFinish, onStepEnd, onStepFinish, onFinish, onEnd, ...settings }: LanguageModelCallOptions & RequestOptions<TOOLS> & Prompt & ToolsContextParameter<TOOLS> & {
|
|
4818
4824
|
/**
|
|
4819
4825
|
* The language model to use.
|
|
4820
4826
|
*/
|
|
@@ -4897,6 +4903,12 @@ declare function generateText<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Con
|
|
|
4897
4903
|
/**
|
|
4898
4904
|
* A function that attempts to repair a tool call that failed to parse.
|
|
4899
4905
|
*/
|
|
4906
|
+
repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
4907
|
+
/**
|
|
4908
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
4909
|
+
*
|
|
4910
|
+
* @deprecated Use `repairToolCall` instead.
|
|
4911
|
+
*/
|
|
4900
4912
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
4901
4913
|
/**
|
|
4902
4914
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
|
@@ -5099,6 +5111,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RUN
|
|
|
5099
5111
|
/**
|
|
5100
5112
|
* A function that attempts to repair a tool call that failed to parse.
|
|
5101
5113
|
*/
|
|
5114
|
+
repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
5115
|
+
/**
|
|
5116
|
+
* A function that attempts to repair a tool call that failed to parse.
|
|
5117
|
+
*
|
|
5118
|
+
* @deprecated Use `repairToolCall` instead.
|
|
5119
|
+
*/
|
|
5102
5120
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
5103
5121
|
/**
|
|
5104
5122
|
* Optional mapping of tool names to functions that refine parsed tool inputs.
|
package/dist/index.js
CHANGED
|
@@ -1089,7 +1089,7 @@ import {
|
|
|
1089
1089
|
} from "@ai-sdk/provider-utils";
|
|
1090
1090
|
|
|
1091
1091
|
// src/version.ts
|
|
1092
|
-
var VERSION = true ? "7.0.
|
|
1092
|
+
var VERSION = true ? "7.0.21" : "0.0.0-test";
|
|
1093
1093
|
|
|
1094
1094
|
// src/util/download/download.ts
|
|
1095
1095
|
var download = async ({
|
|
@@ -5000,7 +5000,8 @@ async function generateText({
|
|
|
5000
5000
|
activeTools,
|
|
5001
5001
|
toolOrder,
|
|
5002
5002
|
prepareStep,
|
|
5003
|
-
experimental_repairToolCall
|
|
5003
|
+
experimental_repairToolCall,
|
|
5004
|
+
repairToolCall = experimental_repairToolCall,
|
|
5004
5005
|
experimental_refineToolInput: refineToolInput,
|
|
5005
5006
|
experimental_download: download2,
|
|
5006
5007
|
runtimeContext = {},
|
|
@@ -6089,6 +6090,10 @@ function writeToServerResponse({
|
|
|
6089
6090
|
if (done)
|
|
6090
6091
|
break;
|
|
6091
6092
|
const canContinue = response.write(value);
|
|
6093
|
+
const flush = response.flush;
|
|
6094
|
+
if (typeof flush === "function") {
|
|
6095
|
+
flush.call(response);
|
|
6096
|
+
}
|
|
6092
6097
|
if (!canContinue) {
|
|
6093
6098
|
await new Promise((resolve3) => {
|
|
6094
6099
|
response.once("drain", resolve3);
|
|
@@ -8431,7 +8436,8 @@ function streamText({
|
|
|
8431
8436
|
providerOptions,
|
|
8432
8437
|
activeTools,
|
|
8433
8438
|
toolOrder,
|
|
8434
|
-
experimental_repairToolCall
|
|
8439
|
+
experimental_repairToolCall,
|
|
8440
|
+
repairToolCall = experimental_repairToolCall,
|
|
8435
8441
|
experimental_refineToolInput: refineToolInput,
|
|
8436
8442
|
experimental_transform: transform,
|
|
8437
8443
|
experimental_download: download2,
|