ai 5.0.56 → 5.1.0-beta.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/CHANGELOG.md +9 -69
- package/dist/index.d.mts +34 -134
- package/dist/index.d.ts +34 -134
- package/dist/index.js +24 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -38
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +7 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,83 +1,23 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
-
## 5.0.
|
|
3
|
+
## 5.1.0-beta.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- a7f6f81: Add safeValidateUIMessages utility to validate UI messages without throwing, returning a success/failure result object like Zod’s safeParse
|
|
8
8
|
|
|
9
|
-
## 5.0.
|
|
9
|
+
## 5.1.0-beta.0
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
- 85da29e: fix(ai): remove outdated jsdoc param descriptions
|
|
14
|
-
|
|
15
|
-
## 5.0.54
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- bc5ed71: chore: update zod peer depenedency version
|
|
20
|
-
- Updated dependencies [bc5ed71]
|
|
21
|
-
- @ai-sdk/provider-utils@3.0.10
|
|
22
|
-
- @ai-sdk/gateway@1.0.30
|
|
23
|
-
|
|
24
|
-
## 5.0.53
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
27
|
-
|
|
28
|
-
- d335191: Extend addToolResult to support error results
|
|
29
|
-
|
|
30
|
-
## 5.0.52
|
|
31
|
-
|
|
32
|
-
### Patch Changes
|
|
33
|
-
|
|
34
|
-
- c56822d: fix(ai): update `uiMessageChunkSchema` to satisfy the `UIMessageChunk` type
|
|
35
|
-
- 930399b: fix(ai): download files when intermediate file cannot be downloaded
|
|
36
|
-
- Updated dependencies [7ca78f1]
|
|
37
|
-
- @ai-sdk/gateway@1.0.29
|
|
38
|
-
|
|
39
|
-
## 5.0.51
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- 27645bb: Export `parseJsonEventStream` and `uiMessageChunkSchema` from "ai" package
|
|
44
|
-
- Updated dependencies [322901b]
|
|
45
|
-
- @ai-sdk/gateway@1.0.28
|
|
46
|
-
|
|
47
|
-
## 5.0.50
|
|
48
|
-
|
|
49
|
-
### Patch Changes
|
|
50
|
-
|
|
51
|
-
- Updated dependencies [c5f403a]
|
|
52
|
-
- @ai-sdk/gateway@1.0.27
|
|
53
|
-
|
|
54
|
-
## 5.0.49
|
|
55
|
-
|
|
56
|
-
### Patch Changes
|
|
57
|
-
|
|
58
|
-
- Updated dependencies [e304478]
|
|
59
|
-
- @ai-sdk/gateway@1.0.26
|
|
60
|
-
|
|
61
|
-
## 5.0.48
|
|
62
|
-
|
|
63
|
-
### Patch Changes
|
|
64
|
-
|
|
65
|
-
- Updated dependencies [4d3ff64]
|
|
66
|
-
- @ai-sdk/gateway@1.0.25
|
|
67
|
-
|
|
68
|
-
## 5.0.47
|
|
69
|
-
|
|
70
|
-
### Patch Changes
|
|
71
|
-
|
|
72
|
-
- Updated dependencies [c86e0f7]
|
|
73
|
-
- Updated dependencies [6bbae01]
|
|
74
|
-
- @ai-sdk/gateway@1.0.24
|
|
11
|
+
### Minor Changes
|
|
75
12
|
|
|
76
|
-
|
|
13
|
+
- 78928cb: release: start 5.1 beta
|
|
77
14
|
|
|
78
15
|
### Patch Changes
|
|
79
16
|
|
|
80
|
-
-
|
|
17
|
+
- Updated dependencies [78928cb]
|
|
18
|
+
- @ai-sdk/gateway@1.1.0-beta.0
|
|
19
|
+
- @ai-sdk/provider@2.1.0-beta.0
|
|
20
|
+
- @ai-sdk/provider-utils@3.1.0-beta.0
|
|
81
21
|
|
|
82
22
|
## 5.0.45
|
|
83
23
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { createGateway, gateway } from '@ai-sdk/gateway';
|
|
2
2
|
import { ModelMessage, Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, Schema, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, InferSchema, FlexibleSchema, DataContent, Validator, StandardSchemaV1, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema,
|
|
3
|
+
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, tool, zodSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
|
5
|
-
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
6
5
|
import { EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, SpeechModelV2CallWarning, TranscriptionModelV2, TranscriptionModelV2CallWarning, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
|
|
7
6
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
|
8
7
|
import * as z3 from 'zod/v3';
|
|
@@ -1594,115 +1593,6 @@ type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
|
1594
1593
|
dynamic: true;
|
|
1595
1594
|
});
|
|
1596
1595
|
|
|
1597
|
-
declare const uiMessageChunkSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1598
|
-
type: z.ZodLiteral<"text-start">;
|
|
1599
|
-
id: z.ZodString;
|
|
1600
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1601
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1602
|
-
type: z.ZodLiteral<"text-delta">;
|
|
1603
|
-
id: z.ZodString;
|
|
1604
|
-
delta: z.ZodString;
|
|
1605
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1606
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1607
|
-
type: z.ZodLiteral<"text-end">;
|
|
1608
|
-
id: z.ZodString;
|
|
1609
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1610
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1611
|
-
type: z.ZodLiteral<"error">;
|
|
1612
|
-
errorText: z.ZodString;
|
|
1613
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1614
|
-
type: z.ZodLiteral<"tool-input-start">;
|
|
1615
|
-
toolCallId: z.ZodString;
|
|
1616
|
-
toolName: z.ZodString;
|
|
1617
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1618
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1619
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1620
|
-
type: z.ZodLiteral<"tool-input-delta">;
|
|
1621
|
-
toolCallId: z.ZodString;
|
|
1622
|
-
inputTextDelta: z.ZodString;
|
|
1623
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1624
|
-
type: z.ZodLiteral<"tool-input-available">;
|
|
1625
|
-
toolCallId: z.ZodString;
|
|
1626
|
-
toolName: z.ZodString;
|
|
1627
|
-
input: z.ZodUnknown;
|
|
1628
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1629
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1630
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1631
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1632
|
-
type: z.ZodLiteral<"tool-input-error">;
|
|
1633
|
-
toolCallId: z.ZodString;
|
|
1634
|
-
toolName: z.ZodString;
|
|
1635
|
-
input: z.ZodUnknown;
|
|
1636
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1637
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1638
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1639
|
-
errorText: z.ZodString;
|
|
1640
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1641
|
-
type: z.ZodLiteral<"tool-output-available">;
|
|
1642
|
-
toolCallId: z.ZodString;
|
|
1643
|
-
output: z.ZodUnknown;
|
|
1644
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1645
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1646
|
-
preliminary: z.ZodOptional<z.ZodBoolean>;
|
|
1647
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1648
|
-
type: z.ZodLiteral<"tool-output-error">;
|
|
1649
|
-
toolCallId: z.ZodString;
|
|
1650
|
-
errorText: z.ZodString;
|
|
1651
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1652
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1653
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1654
|
-
type: z.ZodLiteral<"reasoning-start">;
|
|
1655
|
-
id: z.ZodString;
|
|
1656
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1657
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1658
|
-
type: z.ZodLiteral<"reasoning-delta">;
|
|
1659
|
-
id: z.ZodString;
|
|
1660
|
-
delta: z.ZodString;
|
|
1661
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1662
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1663
|
-
type: z.ZodLiteral<"reasoning-end">;
|
|
1664
|
-
id: z.ZodString;
|
|
1665
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1666
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1667
|
-
type: z.ZodLiteral<"source-url">;
|
|
1668
|
-
sourceId: z.ZodString;
|
|
1669
|
-
url: z.ZodString;
|
|
1670
|
-
title: z.ZodOptional<z.ZodString>;
|
|
1671
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1672
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1673
|
-
type: z.ZodLiteral<"source-document">;
|
|
1674
|
-
sourceId: z.ZodString;
|
|
1675
|
-
mediaType: z.ZodString;
|
|
1676
|
-
title: z.ZodString;
|
|
1677
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
1678
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1679
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1680
|
-
type: z.ZodLiteral<"file">;
|
|
1681
|
-
url: z.ZodString;
|
|
1682
|
-
mediaType: z.ZodString;
|
|
1683
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1684
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1685
|
-
type: z.ZodCustom<`data-${string}`, `data-${string}`>;
|
|
1686
|
-
id: z.ZodOptional<z.ZodString>;
|
|
1687
|
-
data: z.ZodUnknown;
|
|
1688
|
-
transient: z.ZodOptional<z.ZodBoolean>;
|
|
1689
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1690
|
-
type: z.ZodLiteral<"start-step">;
|
|
1691
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1692
|
-
type: z.ZodLiteral<"finish-step">;
|
|
1693
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1694
|
-
type: z.ZodLiteral<"start">;
|
|
1695
|
-
messageId: z.ZodOptional<z.ZodString>;
|
|
1696
|
-
messageMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
1697
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1698
|
-
type: z.ZodLiteral<"finish">;
|
|
1699
|
-
messageMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
1700
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1701
|
-
type: z.ZodLiteral<"abort">;
|
|
1702
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1703
|
-
type: z.ZodLiteral<"message-metadata">;
|
|
1704
|
-
messageMetadata: z.ZodUnknown;
|
|
1705
|
-
}, z.core.$strict>]>;
|
|
1706
1596
|
type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1707
1597
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1708
1598
|
type: `data-${NAME}`;
|
|
@@ -1797,7 +1687,6 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
|
|
|
1797
1687
|
type: 'file';
|
|
1798
1688
|
url: string;
|
|
1799
1689
|
mediaType: string;
|
|
1800
|
-
providerMetadata?: ProviderMetadata;
|
|
1801
1690
|
} | DataUIMessageChunk<DATA_TYPES> | {
|
|
1802
1691
|
type: 'start-step';
|
|
1803
1692
|
} | {
|
|
@@ -2072,28 +1961,47 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
|
|
|
2072
1961
|
*/
|
|
2073
1962
|
consumeStream(options?: ConsumeStreamOptions): Promise<void>;
|
|
2074
1963
|
/**
|
|
2075
|
-
|
|
1964
|
+
Converts the result to a UI message stream.
|
|
2076
1965
|
|
|
2077
|
-
|
|
1966
|
+
@param options.getErrorMessage an optional function that converts an error to an error message.
|
|
1967
|
+
@param options.sendUsage whether to send the usage information to the client. Defaults to true.
|
|
1968
|
+
@param options.sendReasoning whether to send the reasoning information to the client. Defaults to false.
|
|
1969
|
+
@param options.sendSources whether to send the sources information to the client. Defaults to false.
|
|
1970
|
+
@param options.experimental_sendFinish whether to send the finish information to the client. Defaults to true.
|
|
1971
|
+
@param options.experimental_sendStart whether to send the start information to the client. Defaults to true.
|
|
1972
|
+
|
|
1973
|
+
@return A UI message stream.
|
|
2078
1974
|
*/
|
|
2079
1975
|
toUIMessageStream<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamOptions<UI_MESSAGE>): AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;
|
|
2080
1976
|
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
1977
|
+
Writes UI message stream output to a Node.js response-like object.
|
|
1978
|
+
@param response A Node.js response-like object (ServerResponse).
|
|
1979
|
+
@param options.status The status code.
|
|
1980
|
+
@param options.statusText The status text.
|
|
1981
|
+
@param options.headers The headers.
|
|
1982
|
+
@param options.getErrorMessage An optional function that converts an error to an error message.
|
|
1983
|
+
@param options.sendUsage Whether to send the usage information to the client. Defaults to true.
|
|
1984
|
+
@param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
|
|
1985
|
+
*/
|
|
2083
1986
|
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void;
|
|
2084
1987
|
/**
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
@param init Optional headers, status code, and status text.
|
|
1988
|
+
Writes text delta output to a Node.js response-like object.
|
|
1989
|
+
It sets a `Content-Type` header to `text/plain; charset=utf-8` and
|
|
1990
|
+
writes each text delta as a separate chunk.
|
|
1991
|
+
@param response A Node.js response-like object (ServerResponse).
|
|
1992
|
+
@param init Optional headers, status code, and status text.
|
|
2091
1993
|
*/
|
|
2092
1994
|
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void;
|
|
2093
1995
|
/**
|
|
2094
|
-
|
|
1996
|
+
Converts the result to a streamed response object with a stream data part stream.
|
|
2095
1997
|
|
|
2096
|
-
|
|
1998
|
+
@param options.status The status code.
|
|
1999
|
+
@param options.statusText The status text.
|
|
2000
|
+
@param options.headers The headers.
|
|
2001
|
+
@param options.getErrorMessage An optional function that converts an error to an error message.
|
|
2002
|
+
@param options.sendUsage Whether to send the usage information to the client. Defaults to true.
|
|
2003
|
+
@param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
|
|
2004
|
+
@return A response object.
|
|
2097
2005
|
*/
|
|
2098
2006
|
toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Response;
|
|
2099
2007
|
/**
|
|
@@ -4308,18 +4216,10 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4308
4216
|
* Clear the error state and set the status to ready if the chat is in an error state.
|
|
4309
4217
|
*/
|
|
4310
4218
|
clearError: () => void;
|
|
4311
|
-
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({
|
|
4312
|
-
state?: "output-available";
|
|
4219
|
+
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
|
|
4313
4220
|
tool: TOOL;
|
|
4314
4221
|
toolCallId: string;
|
|
4315
4222
|
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
4316
|
-
errorText?: never;
|
|
4317
|
-
} | {
|
|
4318
|
-
state: "output-error";
|
|
4319
|
-
tool: TOOL;
|
|
4320
|
-
toolCallId: string;
|
|
4321
|
-
output?: never;
|
|
4322
|
-
errorText: string;
|
|
4323
4223
|
}) => Promise<void>;
|
|
4324
4224
|
/**
|
|
4325
4225
|
* Abort the current request immediately, keep the generated tokens if any.
|
|
@@ -4610,4 +4510,4 @@ declare global {
|
|
|
4610
4510
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
4611
4511
|
}
|
|
4612
4512
|
|
|
4613
|
-
export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema,
|
|
4513
|
+
export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { createGateway, gateway } from '@ai-sdk/gateway';
|
|
2
2
|
import { ModelMessage, Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, Schema, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, InferSchema, FlexibleSchema, DataContent, Validator, StandardSchemaV1, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema,
|
|
3
|
+
export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, tool, zodSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
|
5
|
-
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
6
5
|
import { EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, SpeechModelV2CallWarning, TranscriptionModelV2, TranscriptionModelV2CallWarning, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
|
|
7
6
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
|
8
7
|
import * as z3 from 'zod/v3';
|
|
@@ -1594,115 +1593,6 @@ type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
|
|
|
1594
1593
|
dynamic: true;
|
|
1595
1594
|
});
|
|
1596
1595
|
|
|
1597
|
-
declare const uiMessageChunkSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1598
|
-
type: z.ZodLiteral<"text-start">;
|
|
1599
|
-
id: z.ZodString;
|
|
1600
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1601
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1602
|
-
type: z.ZodLiteral<"text-delta">;
|
|
1603
|
-
id: z.ZodString;
|
|
1604
|
-
delta: z.ZodString;
|
|
1605
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1606
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1607
|
-
type: z.ZodLiteral<"text-end">;
|
|
1608
|
-
id: z.ZodString;
|
|
1609
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1610
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1611
|
-
type: z.ZodLiteral<"error">;
|
|
1612
|
-
errorText: z.ZodString;
|
|
1613
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1614
|
-
type: z.ZodLiteral<"tool-input-start">;
|
|
1615
|
-
toolCallId: z.ZodString;
|
|
1616
|
-
toolName: z.ZodString;
|
|
1617
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1618
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1619
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1620
|
-
type: z.ZodLiteral<"tool-input-delta">;
|
|
1621
|
-
toolCallId: z.ZodString;
|
|
1622
|
-
inputTextDelta: z.ZodString;
|
|
1623
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1624
|
-
type: z.ZodLiteral<"tool-input-available">;
|
|
1625
|
-
toolCallId: z.ZodString;
|
|
1626
|
-
toolName: z.ZodString;
|
|
1627
|
-
input: z.ZodUnknown;
|
|
1628
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1629
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1630
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1631
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1632
|
-
type: z.ZodLiteral<"tool-input-error">;
|
|
1633
|
-
toolCallId: z.ZodString;
|
|
1634
|
-
toolName: z.ZodString;
|
|
1635
|
-
input: z.ZodUnknown;
|
|
1636
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1637
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1638
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1639
|
-
errorText: z.ZodString;
|
|
1640
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1641
|
-
type: z.ZodLiteral<"tool-output-available">;
|
|
1642
|
-
toolCallId: z.ZodString;
|
|
1643
|
-
output: z.ZodUnknown;
|
|
1644
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1645
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1646
|
-
preliminary: z.ZodOptional<z.ZodBoolean>;
|
|
1647
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1648
|
-
type: z.ZodLiteral<"tool-output-error">;
|
|
1649
|
-
toolCallId: z.ZodString;
|
|
1650
|
-
errorText: z.ZodString;
|
|
1651
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
1652
|
-
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
1653
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1654
|
-
type: z.ZodLiteral<"reasoning-start">;
|
|
1655
|
-
id: z.ZodString;
|
|
1656
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1657
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1658
|
-
type: z.ZodLiteral<"reasoning-delta">;
|
|
1659
|
-
id: z.ZodString;
|
|
1660
|
-
delta: z.ZodString;
|
|
1661
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1662
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1663
|
-
type: z.ZodLiteral<"reasoning-end">;
|
|
1664
|
-
id: z.ZodString;
|
|
1665
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1666
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1667
|
-
type: z.ZodLiteral<"source-url">;
|
|
1668
|
-
sourceId: z.ZodString;
|
|
1669
|
-
url: z.ZodString;
|
|
1670
|
-
title: z.ZodOptional<z.ZodString>;
|
|
1671
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1672
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1673
|
-
type: z.ZodLiteral<"source-document">;
|
|
1674
|
-
sourceId: z.ZodString;
|
|
1675
|
-
mediaType: z.ZodString;
|
|
1676
|
-
title: z.ZodString;
|
|
1677
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
1678
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1679
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1680
|
-
type: z.ZodLiteral<"file">;
|
|
1681
|
-
url: z.ZodString;
|
|
1682
|
-
mediaType: z.ZodString;
|
|
1683
|
-
providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
|
|
1684
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1685
|
-
type: z.ZodCustom<`data-${string}`, `data-${string}`>;
|
|
1686
|
-
id: z.ZodOptional<z.ZodString>;
|
|
1687
|
-
data: z.ZodUnknown;
|
|
1688
|
-
transient: z.ZodOptional<z.ZodBoolean>;
|
|
1689
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1690
|
-
type: z.ZodLiteral<"start-step">;
|
|
1691
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1692
|
-
type: z.ZodLiteral<"finish-step">;
|
|
1693
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1694
|
-
type: z.ZodLiteral<"start">;
|
|
1695
|
-
messageId: z.ZodOptional<z.ZodString>;
|
|
1696
|
-
messageMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
1697
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1698
|
-
type: z.ZodLiteral<"finish">;
|
|
1699
|
-
messageMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
1700
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1701
|
-
type: z.ZodLiteral<"abort">;
|
|
1702
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1703
|
-
type: z.ZodLiteral<"message-metadata">;
|
|
1704
|
-
messageMetadata: z.ZodUnknown;
|
|
1705
|
-
}, z.core.$strict>]>;
|
|
1706
1596
|
type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
|
|
1707
1597
|
[NAME in keyof DATA_TYPES & string]: {
|
|
1708
1598
|
type: `data-${NAME}`;
|
|
@@ -1797,7 +1687,6 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
|
|
|
1797
1687
|
type: 'file';
|
|
1798
1688
|
url: string;
|
|
1799
1689
|
mediaType: string;
|
|
1800
|
-
providerMetadata?: ProviderMetadata;
|
|
1801
1690
|
} | DataUIMessageChunk<DATA_TYPES> | {
|
|
1802
1691
|
type: 'start-step';
|
|
1803
1692
|
} | {
|
|
@@ -2072,28 +1961,47 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
|
|
|
2072
1961
|
*/
|
|
2073
1962
|
consumeStream(options?: ConsumeStreamOptions): Promise<void>;
|
|
2074
1963
|
/**
|
|
2075
|
-
|
|
1964
|
+
Converts the result to a UI message stream.
|
|
2076
1965
|
|
|
2077
|
-
|
|
1966
|
+
@param options.getErrorMessage an optional function that converts an error to an error message.
|
|
1967
|
+
@param options.sendUsage whether to send the usage information to the client. Defaults to true.
|
|
1968
|
+
@param options.sendReasoning whether to send the reasoning information to the client. Defaults to false.
|
|
1969
|
+
@param options.sendSources whether to send the sources information to the client. Defaults to false.
|
|
1970
|
+
@param options.experimental_sendFinish whether to send the finish information to the client. Defaults to true.
|
|
1971
|
+
@param options.experimental_sendStart whether to send the start information to the client. Defaults to true.
|
|
1972
|
+
|
|
1973
|
+
@return A UI message stream.
|
|
2078
1974
|
*/
|
|
2079
1975
|
toUIMessageStream<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamOptions<UI_MESSAGE>): AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;
|
|
2080
1976
|
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
1977
|
+
Writes UI message stream output to a Node.js response-like object.
|
|
1978
|
+
@param response A Node.js response-like object (ServerResponse).
|
|
1979
|
+
@param options.status The status code.
|
|
1980
|
+
@param options.statusText The status text.
|
|
1981
|
+
@param options.headers The headers.
|
|
1982
|
+
@param options.getErrorMessage An optional function that converts an error to an error message.
|
|
1983
|
+
@param options.sendUsage Whether to send the usage information to the client. Defaults to true.
|
|
1984
|
+
@param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
|
|
1985
|
+
*/
|
|
2083
1986
|
pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void;
|
|
2084
1987
|
/**
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
@param init Optional headers, status code, and status text.
|
|
1988
|
+
Writes text delta output to a Node.js response-like object.
|
|
1989
|
+
It sets a `Content-Type` header to `text/plain; charset=utf-8` and
|
|
1990
|
+
writes each text delta as a separate chunk.
|
|
1991
|
+
@param response A Node.js response-like object (ServerResponse).
|
|
1992
|
+
@param init Optional headers, status code, and status text.
|
|
2091
1993
|
*/
|
|
2092
1994
|
pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void;
|
|
2093
1995
|
/**
|
|
2094
|
-
|
|
1996
|
+
Converts the result to a streamed response object with a stream data part stream.
|
|
2095
1997
|
|
|
2096
|
-
|
|
1998
|
+
@param options.status The status code.
|
|
1999
|
+
@param options.statusText The status text.
|
|
2000
|
+
@param options.headers The headers.
|
|
2001
|
+
@param options.getErrorMessage An optional function that converts an error to an error message.
|
|
2002
|
+
@param options.sendUsage Whether to send the usage information to the client. Defaults to true.
|
|
2003
|
+
@param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
|
|
2004
|
+
@return A response object.
|
|
2097
2005
|
*/
|
|
2098
2006
|
toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Response;
|
|
2099
2007
|
/**
|
|
@@ -4308,18 +4216,10 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4308
4216
|
* Clear the error state and set the status to ready if the chat is in an error state.
|
|
4309
4217
|
*/
|
|
4310
4218
|
clearError: () => void;
|
|
4311
|
-
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({
|
|
4312
|
-
state?: "output-available";
|
|
4219
|
+
addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
|
|
4313
4220
|
tool: TOOL;
|
|
4314
4221
|
toolCallId: string;
|
|
4315
4222
|
output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
|
|
4316
|
-
errorText?: never;
|
|
4317
|
-
} | {
|
|
4318
|
-
state: "output-error";
|
|
4319
|
-
tool: TOOL;
|
|
4320
|
-
toolCallId: string;
|
|
4321
|
-
output?: never;
|
|
4322
|
-
errorText: string;
|
|
4323
4223
|
}) => Promise<void>;
|
|
4324
4224
|
/**
|
|
4325
4225
|
* Abort the current request immediately, keep the generated tokens if any.
|
|
@@ -4610,4 +4510,4 @@ declare global {
|
|
|
4610
4510
|
var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
|
|
4611
4511
|
}
|
|
4612
4512
|
|
|
4613
|
-
export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema,
|
|
4513
|
+
export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
|