ai 5.0.288 → 5.0.290
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 +19 -0
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +576 -335
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +483 -237
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 5.0.290
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4107bc6: Keep failed tool call error text consistent with the model's message history by default. Set `redactToolErrors: true` to replace it with the result of `onError`.
|
|
8
|
+
- ec9c246: Prevent excessive memory and CPU usage when validating malformed UI messages. `validateUIMessages` and `safeValidateUIMessages` reported the issues of every part schema for every invalid part, so a small request with many malformed parts could exhaust memory. Each part is now validated against the schemas for its type only, validation stops at the first invalid message or part, and an invalid JSON value in provider metadata is reported as a single issue.
|
|
9
|
+
- Updated dependencies [09657bb]
|
|
10
|
+
- Updated dependencies [f046ed8]
|
|
11
|
+
- @ai-sdk/gateway@2.0.181
|
|
12
|
+
|
|
13
|
+
## 5.0.289
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- bdbf015: Fix excessive CPU usage when streaming long arrays with `streamObject` array output. Parse and validate completed elements incrementally instead of repeatedly processing the entire accumulated array on every text chunk.
|
|
18
|
+
- Updated dependencies [71955f0]
|
|
19
|
+
- Updated dependencies [7d50c2f]
|
|
20
|
+
- @ai-sdk/gateway@2.0.180
|
|
21
|
+
|
|
3
22
|
## 5.0.288
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1994,9 +1994,32 @@ type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
|
|
|
1994
1994
|
/**
|
|
1995
1995
|
* Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
|
|
1996
1996
|
*
|
|
1997
|
-
*
|
|
1997
|
+
* This callback handles stream errors. It also handles failed tool calls
|
|
1998
|
+
* (tool execution errors and invalid tool calls) when `redactToolErrors` is
|
|
1999
|
+
* enabled, which is the default when this callback is provided.
|
|
2000
|
+
*
|
|
2001
|
+
* Tool execution errors marked `providerExecuted: true` bypass this callback.
|
|
2002
|
+
* Their strings pass through unchanged; other values are JSON-stringified to
|
|
2003
|
+
* preserve provider error data for model-message round trips. Invalid tool
|
|
2004
|
+
* calls of provider-executed tools always use it.
|
|
2005
|
+
*
|
|
2006
|
+
* @returns error message to include in the data stream.
|
|
1998
2007
|
*/
|
|
1999
2008
|
onError?: (error: unknown) => string;
|
|
2009
|
+
/**
|
|
2010
|
+
* Replace the error text of failed tool calls (tool execution errors and
|
|
2011
|
+
* invalid tool calls) with the result of `onError`.
|
|
2012
|
+
*
|
|
2013
|
+
* By default, the client receives the same error text as the model. UI
|
|
2014
|
+
* messages are sent back to the model on the next request, so a different
|
|
2015
|
+
* text changes the history that the model's reasoning and answers are based
|
|
2016
|
+
* on. Some models reject such a history, for example Anthropic models with
|
|
2017
|
+
* preserved thinking. To keep error details away from the client, throw a
|
|
2018
|
+
* safe error from the tool's `execute` function.
|
|
2019
|
+
*
|
|
2020
|
+
* Defaults to `true` when `onError` is provided, and `false` otherwise.
|
|
2021
|
+
*/
|
|
2022
|
+
redactToolErrors?: boolean;
|
|
2000
2023
|
};
|
|
2001
2024
|
type ConsumeStreamOptions = {
|
|
2002
2025
|
onError?: ErrorHandler;
|
package/dist/index.d.ts
CHANGED
|
@@ -1994,9 +1994,32 @@ type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
|
|
|
1994
1994
|
/**
|
|
1995
1995
|
* Process an error, e.g. to log it. Default to `() => 'An error occurred.'`.
|
|
1996
1996
|
*
|
|
1997
|
-
*
|
|
1997
|
+
* This callback handles stream errors. It also handles failed tool calls
|
|
1998
|
+
* (tool execution errors and invalid tool calls) when `redactToolErrors` is
|
|
1999
|
+
* enabled, which is the default when this callback is provided.
|
|
2000
|
+
*
|
|
2001
|
+
* Tool execution errors marked `providerExecuted: true` bypass this callback.
|
|
2002
|
+
* Their strings pass through unchanged; other values are JSON-stringified to
|
|
2003
|
+
* preserve provider error data for model-message round trips. Invalid tool
|
|
2004
|
+
* calls of provider-executed tools always use it.
|
|
2005
|
+
*
|
|
2006
|
+
* @returns error message to include in the data stream.
|
|
1998
2007
|
*/
|
|
1999
2008
|
onError?: (error: unknown) => string;
|
|
2009
|
+
/**
|
|
2010
|
+
* Replace the error text of failed tool calls (tool execution errors and
|
|
2011
|
+
* invalid tool calls) with the result of `onError`.
|
|
2012
|
+
*
|
|
2013
|
+
* By default, the client receives the same error text as the model. UI
|
|
2014
|
+
* messages are sent back to the model on the next request, so a different
|
|
2015
|
+
* text changes the history that the model's reasoning and answers are based
|
|
2016
|
+
* on. Some models reject such a history, for example Anthropic models with
|
|
2017
|
+
* preserved thinking. To keep error details away from the client, throw a
|
|
2018
|
+
* safe error from the tool's `execute` function.
|
|
2019
|
+
*
|
|
2020
|
+
* Defaults to `true` when `onError` is provided, and `false` otherwise.
|
|
2021
|
+
*/
|
|
2022
|
+
redactToolErrors?: boolean;
|
|
2000
2023
|
};
|
|
2001
2024
|
type ConsumeStreamOptions = {
|
|
2002
2025
|
onError?: ErrorHandler;
|