ai 3.0.19 → 3.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/anthropic/dist/index.d.mts +1 -319
- package/anthropic/dist/index.d.ts +1 -319
- package/anthropic/dist/index.js +44 -216
- package/anthropic/dist/index.js.map +1 -1
- package/anthropic/dist/index.mjs +32 -200
- package/anthropic/dist/index.mjs.map +1 -1
- package/dist/index.d.mts +60 -333
- package/dist/index.d.ts +60 -333
- package/dist/index.js +152 -441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -412
- package/dist/index.mjs.map +1 -1
- package/google/dist/index.d.mts +1 -319
- package/google/dist/index.d.ts +1 -319
- package/google/dist/index.js +75 -229
- package/google/dist/index.js.map +1 -1
- package/google/dist/index.mjs +63 -213
- package/google/dist/index.mjs.map +1 -1
- package/mistral/dist/index.d.mts +1 -319
- package/mistral/dist/index.d.ts +1 -319
- package/mistral/dist/index.js +32 -205
- package/mistral/dist/index.js.map +1 -1
- package/mistral/dist/index.mjs +20 -189
- package/mistral/dist/index.mjs.map +1 -1
- package/openai/dist/index.d.mts +2 -320
- package/openai/dist/index.d.ts +2 -320
- package/openai/dist/index.js +69 -280
- package/openai/dist/index.js.map +1 -1
- package/openai/dist/index.mjs +57 -260
- package/openai/dist/index.mjs.map +1 -1
- package/package.json +4 -10
- package/react/dist/index.d.mts +8 -4
- package/react/dist/index.d.ts +12 -6
- package/react/dist/index.js +23 -105
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +22 -105
- package/react/dist/index.mjs.map +1 -1
- package/react/dist/index.server.d.mts +4 -2
- package/react/dist/index.server.d.ts +4 -2
- package/react/dist/index.server.js.map +1 -1
- package/react/dist/index.server.mjs.map +1 -1
- package/rsc/dist/rsc-server.mjs +6 -16
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/solid/dist/index.d.mts +1 -1
- package/solid/dist/index.d.ts +1 -1
- package/solid/dist/index.js +19 -104
- package/solid/dist/index.js.map +1 -1
- package/solid/dist/index.mjs +19 -104
- package/solid/dist/index.mjs.map +1 -1
- package/svelte/dist/index.d.mts +1 -1
- package/svelte/dist/index.d.ts +1 -1
- package/svelte/dist/index.js +19 -104
- package/svelte/dist/index.js.map +1 -1
- package/svelte/dist/index.mjs +19 -104
- package/svelte/dist/index.mjs.map +1 -1
- package/vue/dist/index.d.mts +1 -1
- package/vue/dist/index.d.ts +1 -1
- package/vue/dist/index.js +19 -104
- package/vue/dist/index.js.map +1 -1
- package/vue/dist/index.mjs +19 -104
- package/vue/dist/index.mjs.map +1 -1
- package/spec/dist/index.d.mts +0 -752
- package/spec/dist/index.d.ts +0 -752
- package/spec/dist/index.js +0 -873
- package/spec/dist/index.js.map +0 -1
- package/spec/dist/index.mjs +0 -807
- package/spec/dist/index.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
@@ -1,328 +1,10 @@
|
|
1
|
+
import { LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1CallWarning } from '@ai-sdk/provider';
|
1
2
|
import { z } from 'zod';
|
2
|
-
import { JSONSchema7 } from 'json-schema';
|
3
3
|
import { AssistantStream } from 'openai/lib/AssistantStream';
|
4
4
|
import { Run } from 'openai/resources/beta/threads/runs/runs';
|
5
5
|
import { ChatCompletionResponseChunk } from '@mistralai/mistralai';
|
6
6
|
import { ServerResponse } from 'node:http';
|
7
7
|
|
8
|
-
/**
|
9
|
-
A tool has a name, a description, and a set of parameters.
|
10
|
-
|
11
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
12
|
-
map the user-facing tool definitions to this format.
|
13
|
-
*/
|
14
|
-
type LanguageModelV1FunctionTool = {
|
15
|
-
/**
|
16
|
-
The type of the tool. Only functions for now, but this gives us room to
|
17
|
-
add more specific tool types in the future and use a discriminated union.
|
18
|
-
*/
|
19
|
-
type: 'function';
|
20
|
-
/**
|
21
|
-
The name of the tool. Unique within this model call.
|
22
|
-
*/
|
23
|
-
name: string;
|
24
|
-
description?: string;
|
25
|
-
parameters: JSONSchema7;
|
26
|
-
};
|
27
|
-
|
28
|
-
type LanguageModelV1CallSettings = {
|
29
|
-
/**
|
30
|
-
* Maximum number of tokens to generate.
|
31
|
-
*/
|
32
|
-
maxTokens?: number;
|
33
|
-
/**
|
34
|
-
* Temperature setting. This is a number between 0 (almost no randomness) and
|
35
|
-
* 1 (very random).
|
36
|
-
*
|
37
|
-
* Different LLM providers have different temperature
|
38
|
-
* scales, so they'd need to map it (without mapping, the same temperature has
|
39
|
-
* different effects on different models). The provider can also chose to map
|
40
|
-
* this to topP, potentially even using a custom setting on their model.
|
41
|
-
*
|
42
|
-
* Note: This is an example of a setting that requires a clear specification of
|
43
|
-
* the semantics.
|
44
|
-
*/
|
45
|
-
temperature?: number;
|
46
|
-
/**
|
47
|
-
* Nucleus sampling. This is a number between 0 and 1.
|
48
|
-
*
|
49
|
-
* E.g. 0.1 would mean that only tokens with the top 10% probability mass
|
50
|
-
* are considered.
|
51
|
-
*
|
52
|
-
* It is recommended to set either `temperature` or `topP`, but not both.
|
53
|
-
*/
|
54
|
-
topP?: number;
|
55
|
-
/**
|
56
|
-
* Presence penalty setting. It affects the likelihood of the model to
|
57
|
-
* repeat information that is already in the prompt.
|
58
|
-
*
|
59
|
-
* The presence penalty is a number between -1 (increase repetition)
|
60
|
-
* and 1 (maximum penalty, decrease repetition). 0 means no penalty.
|
61
|
-
*/
|
62
|
-
presencePenalty?: number;
|
63
|
-
/**
|
64
|
-
* Frequency penalty setting. It affects the likelihood of the model
|
65
|
-
* to repeatedly use the same words or phrases.
|
66
|
-
*
|
67
|
-
* The frequency penalty is a number between -1 (increase repetition)
|
68
|
-
* and 1 (maximum penalty, decrease repetition). 0 means no penalty.
|
69
|
-
*/
|
70
|
-
frequencyPenalty?: number;
|
71
|
-
/**
|
72
|
-
* The seed (integer) to use for random sampling. If set and supported
|
73
|
-
* by the model, calls will generate deterministic results.
|
74
|
-
*/
|
75
|
-
seed?: number;
|
76
|
-
/**
|
77
|
-
* Abort signal for cancelling the operation.
|
78
|
-
*/
|
79
|
-
abortSignal?: AbortSignal;
|
80
|
-
};
|
81
|
-
|
82
|
-
/**
|
83
|
-
* A prompt is a list of messages.
|
84
|
-
*
|
85
|
-
* Note: Not all models and prompt formats support multi-modal inputs and
|
86
|
-
* tool calls. The validation happens at runtime.
|
87
|
-
*
|
88
|
-
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
89
|
-
* user-facing prompt types such as chat or instruction prompts to this format.
|
90
|
-
*/
|
91
|
-
type LanguageModelV1Prompt = Array<LanguageModelV1Message>;
|
92
|
-
type LanguageModelV1Message = {
|
93
|
-
role: 'system';
|
94
|
-
content: string;
|
95
|
-
} | {
|
96
|
-
role: 'user';
|
97
|
-
content: Array<LanguageModelV1TextPart | LanguageModelV1ImagePart>;
|
98
|
-
} | {
|
99
|
-
role: 'assistant';
|
100
|
-
content: Array<LanguageModelV1TextPart | LanguageModelV1ToolCallPart>;
|
101
|
-
} | {
|
102
|
-
role: 'tool';
|
103
|
-
content: Array<LanguageModelV1ToolResultPart>;
|
104
|
-
};
|
105
|
-
interface LanguageModelV1TextPart {
|
106
|
-
type: 'text';
|
107
|
-
/**
|
108
|
-
* The text content.
|
109
|
-
*/
|
110
|
-
text: string;
|
111
|
-
}
|
112
|
-
interface LanguageModelV1ImagePart {
|
113
|
-
type: 'image';
|
114
|
-
/**
|
115
|
-
* Image data as a Uint8Array (e.g. from a Blob or Buffer) or a URL.
|
116
|
-
*/
|
117
|
-
image: Uint8Array | URL;
|
118
|
-
/**
|
119
|
-
* Optional mime type of the image.
|
120
|
-
*/
|
121
|
-
mimeType?: string;
|
122
|
-
}
|
123
|
-
interface LanguageModelV1ToolCallPart {
|
124
|
-
type: 'tool-call';
|
125
|
-
toolCallId: string;
|
126
|
-
toolName: string;
|
127
|
-
args: unknown;
|
128
|
-
}
|
129
|
-
interface LanguageModelV1ToolResultPart {
|
130
|
-
type: 'tool-result';
|
131
|
-
toolCallId: string;
|
132
|
-
toolName: string;
|
133
|
-
result: unknown;
|
134
|
-
}
|
135
|
-
|
136
|
-
type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
|
137
|
-
/**
|
138
|
-
* Whether the user provided the input as messages or as
|
139
|
-
* a prompt. This can help guide non-chat models in the
|
140
|
-
* expansion, bc different expansions can be needed for
|
141
|
-
* chat/non-chat use cases.
|
142
|
-
*/
|
143
|
-
inputFormat: 'messages' | 'prompt';
|
144
|
-
/**
|
145
|
-
* The mode affects the behavior of the language model. It is required to
|
146
|
-
* support provider-independent streaming and generation of structured objects.
|
147
|
-
* The model can take this information and e.g. configure json mode, the correct
|
148
|
-
* low level grammar, etc. It can also be used to optimize the efficiency of the
|
149
|
-
* streaming, e.g. tool-delta stream parts are only needed in the
|
150
|
-
* object-tool mode.
|
151
|
-
*/
|
152
|
-
mode: {
|
153
|
-
type: 'regular';
|
154
|
-
tools?: Array<LanguageModelV1FunctionTool>;
|
155
|
-
} | {
|
156
|
-
type: 'object-json';
|
157
|
-
} | {
|
158
|
-
type: 'object-grammar';
|
159
|
-
schema: JSONSchema7;
|
160
|
-
} | {
|
161
|
-
type: 'object-tool';
|
162
|
-
tool: LanguageModelV1FunctionTool;
|
163
|
-
};
|
164
|
-
/**
|
165
|
-
* A language mode prompt is a standardized prompt type.
|
166
|
-
*
|
167
|
-
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
168
|
-
* user-facing prompt types such as chat or instruction prompts to this format.
|
169
|
-
* That approach allows us to evolve the user facing prompts without breaking
|
170
|
-
* the language model interface.
|
171
|
-
*/
|
172
|
-
prompt: LanguageModelV1Prompt;
|
173
|
-
};
|
174
|
-
|
175
|
-
/**
|
176
|
-
* Warning from the model provider for this call. The call will proceed, but e.g.
|
177
|
-
* some settings might not be supported, which can lead to suboptimal results.
|
178
|
-
*/
|
179
|
-
type LanguageModelV1CallWarning = {
|
180
|
-
type: 'unsupported-setting';
|
181
|
-
setting: keyof LanguageModelV1CallSettings;
|
182
|
-
} | {
|
183
|
-
type: 'other';
|
184
|
-
message: string;
|
185
|
-
};
|
186
|
-
|
187
|
-
type LanguageModelV1FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
|
188
|
-
|
189
|
-
type LanguageModelV1FunctionToolCall = {
|
190
|
-
toolCallType: 'function';
|
191
|
-
toolCallId: string;
|
192
|
-
toolName: string;
|
193
|
-
/**
|
194
|
-
* Stringified JSON object with the tool call arguments. Must match the
|
195
|
-
* parameters schema of the tool.
|
196
|
-
*/
|
197
|
-
args: string;
|
198
|
-
};
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Experimental: Specification for a language model that implements the language model
|
202
|
-
* interface version 1.
|
203
|
-
*/
|
204
|
-
type LanguageModelV1 = {
|
205
|
-
/**
|
206
|
-
* The language model must specify which language model interface
|
207
|
-
* version it implements. This will allow us to evolve the language
|
208
|
-
* model interface and retain backwards compatibility. The different
|
209
|
-
* implementation versions can be handled as a discriminated union
|
210
|
-
* on our side.
|
211
|
-
*/
|
212
|
-
readonly specificationVersion: 'v1';
|
213
|
-
/**
|
214
|
-
* Name of the provider for logging purposes.
|
215
|
-
*/
|
216
|
-
readonly provider: string;
|
217
|
-
/**
|
218
|
-
* Provider-specific model ID for logging purposes.
|
219
|
-
*/
|
220
|
-
readonly modelId: string;
|
221
|
-
/**
|
222
|
-
* Default object generation mode that should be used with this model when
|
223
|
-
* no mode is specified. Should be the mode with the best results for this
|
224
|
-
* model. `undefined` can be returned if object generation is not supported.
|
225
|
-
*
|
226
|
-
* This is needed to generate the best objects possible w/o requiring the
|
227
|
-
* user to explicitly specify the object generation mode.
|
228
|
-
*/
|
229
|
-
readonly defaultObjectGenerationMode: 'json' | 'tool' | 'grammar' | undefined;
|
230
|
-
/**
|
231
|
-
* Generates a language model output (non-streaming).
|
232
|
-
*
|
233
|
-
* Naming: "do" prefix to prevent accidental direct usage of the method
|
234
|
-
* by the user.
|
235
|
-
*/
|
236
|
-
doGenerate(options: LanguageModelV1CallOptions): PromiseLike<{
|
237
|
-
/**
|
238
|
-
* Text that the model has generated. Can be undefined if the model
|
239
|
-
* has only generated tool calls.
|
240
|
-
*/
|
241
|
-
text?: string;
|
242
|
-
/**
|
243
|
-
* Tool calls that the model has generated. Can be undefined if the
|
244
|
-
* model has only generated text.
|
245
|
-
*/
|
246
|
-
toolCalls?: Array<LanguageModelV1FunctionToolCall>;
|
247
|
-
/**
|
248
|
-
* Finish reason.
|
249
|
-
*/
|
250
|
-
finishReason: LanguageModelV1FinishReason;
|
251
|
-
/**
|
252
|
-
* Usage information.
|
253
|
-
*/
|
254
|
-
usage: {
|
255
|
-
promptTokens: number;
|
256
|
-
completionTokens: number;
|
257
|
-
};
|
258
|
-
/**
|
259
|
-
* Raw prompt and setting information for observability provider integration.
|
260
|
-
*/
|
261
|
-
rawCall: {
|
262
|
-
/**
|
263
|
-
* Raw prompt after expansion and conversion to the format that the
|
264
|
-
* provider uses to send the information to their API.
|
265
|
-
*/
|
266
|
-
rawPrompt: unknown;
|
267
|
-
/**
|
268
|
-
* Raw settings that are used for the API call. Includes provider-specific
|
269
|
-
* settings.
|
270
|
-
*/
|
271
|
-
rawSettings: Record<string, unknown>;
|
272
|
-
};
|
273
|
-
warnings?: LanguageModelV1CallWarning[];
|
274
|
-
}>;
|
275
|
-
/**
|
276
|
-
* Generates a language model output (streaming).
|
277
|
-
*
|
278
|
-
* Naming: "do" prefix to prevent accidental direct usage of the method
|
279
|
-
* by the user.
|
280
|
-
*
|
281
|
-
* @return A stream of higher-level language model output parts.
|
282
|
-
*/
|
283
|
-
doStream(options: LanguageModelV1CallOptions): PromiseLike<{
|
284
|
-
stream: ReadableStream<LanguageModelV1StreamPart>;
|
285
|
-
/**
|
286
|
-
* Raw prompt and setting information for observability provider integration.
|
287
|
-
*/
|
288
|
-
rawCall: {
|
289
|
-
/**
|
290
|
-
* Raw prompt after expansion and conversion to the format that the
|
291
|
-
* provider uses to send the information to their API.
|
292
|
-
*/
|
293
|
-
rawPrompt: unknown;
|
294
|
-
/**
|
295
|
-
* Raw settings that are used for the API call. Includes provider-specific
|
296
|
-
* settings.
|
297
|
-
*/
|
298
|
-
rawSettings: Record<string, unknown>;
|
299
|
-
};
|
300
|
-
warnings?: LanguageModelV1CallWarning[];
|
301
|
-
}>;
|
302
|
-
};
|
303
|
-
type LanguageModelV1StreamPart = {
|
304
|
-
type: 'text-delta';
|
305
|
-
textDelta: string;
|
306
|
-
} | ({
|
307
|
-
type: 'tool-call';
|
308
|
-
} & LanguageModelV1FunctionToolCall) | {
|
309
|
-
type: 'tool-call-delta';
|
310
|
-
toolCallType: 'function';
|
311
|
-
toolCallId: string;
|
312
|
-
toolName: string;
|
313
|
-
argsTextDelta: string;
|
314
|
-
} | {
|
315
|
-
type: 'finish';
|
316
|
-
finishReason: LanguageModelV1FinishReason;
|
317
|
-
usage: {
|
318
|
-
promptTokens: number;
|
319
|
-
completionTokens: number;
|
320
|
-
};
|
321
|
-
} | {
|
322
|
-
type: 'error';
|
323
|
-
error: unknown;
|
324
|
-
};
|
325
|
-
|
326
8
|
type TokenUsage = {
|
327
9
|
promptTokens: number;
|
328
10
|
completionTokens: number;
|
@@ -470,6 +152,10 @@ interface ToolResultPart {
|
|
470
152
|
Result of the tool call. This is a JSON-serializable object.
|
471
153
|
*/
|
472
154
|
result: unknown;
|
155
|
+
/**
|
156
|
+
Optional flag if the result is an error or an error message.
|
157
|
+
*/
|
158
|
+
isError?: boolean;
|
473
159
|
}
|
474
160
|
|
475
161
|
/**
|
@@ -997,6 +683,12 @@ declare class StreamTextResult<TOOLS extends Record<string, ExperimentalTool>> {
|
|
997
683
|
@returns an `AIStream` object.
|
998
684
|
*/
|
999
685
|
toAIStream(callbacks?: AIStreamCallbacksAndOptions): ReadableStream<any>;
|
686
|
+
/**
|
687
|
+
Creates a simple text stream response.
|
688
|
+
Each text delta is encoded as UTF-8 and sent as a separate chunk.
|
689
|
+
Non-text-delta events are ignored.
|
690
|
+
*/
|
691
|
+
toTextStreamResponse(init?: ResponseInit): Response;
|
1000
692
|
}
|
1001
693
|
|
1002
694
|
interface FunctionCall {
|
@@ -1350,10 +1042,6 @@ declare function createChunkDecoder(complex?: boolean): (chunk: Uint8Array | und
|
|
1350
1042
|
|
1351
1043
|
declare const isStreamStringEqualToType: (type: keyof typeof StreamStringPrefixes, value: string) => value is `0:${string}\n` | `1:${string}\n` | `2:${string}\n` | `3:${string}\n` | `4:${string}\n` | `5:${string}\n` | `6:${string}\n` | `7:${string}\n` | `8:${string}\n`;
|
1352
1044
|
type StreamString = `${(typeof StreamStringPrefixes)[keyof typeof StreamStringPrefixes]}:${string}\n`;
|
1353
|
-
/**
|
1354
|
-
* A header sent to the client so it knows how to handle parsing the stream (as a deprecated text response or using the new prefixed protocol)
|
1355
|
-
*/
|
1356
|
-
declare const COMPLEX_HEADER = "X-Experimental-Stream-Data";
|
1357
1045
|
|
1358
1046
|
declare interface AzureChatCompletions {
|
1359
1047
|
id: string;
|
@@ -1607,10 +1295,8 @@ interface AIStreamCallbacksAndOptions {
|
|
1607
1295
|
/** `onText`: Called for each text chunk. */
|
1608
1296
|
onText?: (text: string) => Promise<void> | void;
|
1609
1297
|
/**
|
1610
|
-
*
|
1611
|
-
*
|
1612
|
-
*
|
1613
|
-
* When StreamData is rolled out, this will be removed and the new protocol will be used by default.
|
1298
|
+
* @deprecated This flag is no longer used and only retained for backwards compatibility.
|
1299
|
+
* You can remove it from your code.
|
1614
1300
|
*/
|
1615
1301
|
experimental_streamData?: boolean;
|
1616
1302
|
}
|
@@ -1797,18 +1483,54 @@ interface MessageStopEvent {
|
|
1797
1483
|
*/
|
1798
1484
|
declare function AnthropicStream(res: Response | AsyncIterable<CompletionChunk> | AsyncIterable<MessageStreamEvent>, cb?: AIStreamCallbacksAndOptions): ReadableStream;
|
1799
1485
|
|
1486
|
+
/**
|
1487
|
+
You can pass the thread and the latest message into the `AssistantResponse`. This establishes the context for the response.
|
1488
|
+
*/
|
1800
1489
|
type AssistantResponseSettings = {
|
1490
|
+
/**
|
1491
|
+
The thread ID that the response is associated with.
|
1492
|
+
*/
|
1801
1493
|
threadId: string;
|
1494
|
+
/**
|
1495
|
+
The ID of the latest message that the response is associated with.
|
1496
|
+
*/
|
1802
1497
|
messageId: string;
|
1803
1498
|
};
|
1499
|
+
/**
|
1500
|
+
The process parameter is a callback in which you can run the assistant on threads, and send messages and data messages to the client.
|
1501
|
+
*/
|
1804
1502
|
type AssistantResponseCallback = (options: {
|
1503
|
+
/**
|
1504
|
+
@deprecated use variable from outer scope instead.
|
1505
|
+
*/
|
1805
1506
|
threadId: string;
|
1507
|
+
/**
|
1508
|
+
@deprecated use variable from outer scope instead.
|
1509
|
+
*/
|
1806
1510
|
messageId: string;
|
1511
|
+
/**
|
1512
|
+
Forwards an assistant message (non-streaming) to the client.
|
1513
|
+
*/
|
1807
1514
|
sendMessage: (message: AssistantMessage) => void;
|
1515
|
+
/**
|
1516
|
+
Send a data message to the client. You can use this to provide information for rendering custom UIs while the assistant is processing the thread.
|
1517
|
+
*/
|
1808
1518
|
sendDataMessage: (message: DataMessage) => void;
|
1519
|
+
/**
|
1520
|
+
Forwards the assistant response stream to the client. Returns the `Run` object after it completes, or when it requires an action.
|
1521
|
+
*/
|
1809
1522
|
forwardStream: (stream: AssistantStream) => Promise<Run | undefined>;
|
1810
1523
|
}) => Promise<void>;
|
1811
|
-
|
1524
|
+
/**
|
1525
|
+
The `AssistantResponse` allows you to send a stream of assistant update to `useAssistant`.
|
1526
|
+
It is designed to facilitate streaming assistant responses to the `useAssistant` hook.
|
1527
|
+
It receives an assistant thread and a current message, and can send messages and data messages to the client.
|
1528
|
+
*/
|
1529
|
+
declare function AssistantResponse({ threadId, messageId }: AssistantResponseSettings, process: AssistantResponseCallback): Response;
|
1530
|
+
/**
|
1531
|
+
@deprecated Use `AssistantResponse` instead.
|
1532
|
+
*/
|
1533
|
+
declare const experimental_AssistantResponse: typeof AssistantResponse;
|
1812
1534
|
|
1813
1535
|
interface AWSBedrockResponse {
|
1814
1536
|
body?: AsyncIterable<{
|
@@ -1933,7 +1655,7 @@ declare function ReplicateStream(res: Prediction, cb?: AIStreamCallbacksAndOptio
|
|
1933
1655
|
/**
|
1934
1656
|
* A stream wrapper to send custom JSON-encoded data back to the client.
|
1935
1657
|
*/
|
1936
|
-
declare class
|
1658
|
+
declare class StreamData {
|
1937
1659
|
private encoder;
|
1938
1660
|
private controller;
|
1939
1661
|
stream: TransformStream<Uint8Array, Uint8Array>;
|
@@ -1951,7 +1673,12 @@ declare class experimental_StreamData {
|
|
1951
1673
|
* A TransformStream for LLMs that do not have their own transform stream handlers managing encoding (e.g. OpenAIStream has one for function call handling).
|
1952
1674
|
* This assumes every chunk is a 'text' chunk.
|
1953
1675
|
*/
|
1954
|
-
declare function createStreamDataTransformer(
|
1676
|
+
declare function createStreamDataTransformer(): TransformStream<any, any>;
|
1677
|
+
/**
|
1678
|
+
@deprecated Use `StreamData` instead.
|
1679
|
+
*/
|
1680
|
+
declare class experimental_StreamData extends StreamData {
|
1681
|
+
}
|
1955
1682
|
|
1956
1683
|
/**
|
1957
1684
|
* This is a naive implementation of the streaming React response API.
|
@@ -1980,7 +1707,7 @@ declare class experimental_StreamingReactResponse {
|
|
1980
1707
|
content: string;
|
1981
1708
|
data?: JSONValue[];
|
1982
1709
|
}) => UINode | Promise<UINode>;
|
1983
|
-
data?:
|
1710
|
+
data?: StreamData;
|
1984
1711
|
generateId?: IdGenerator;
|
1985
1712
|
});
|
1986
1713
|
}
|
@@ -1989,7 +1716,7 @@ declare class experimental_StreamingReactResponse {
|
|
1989
1716
|
* A utility class for streaming text responses.
|
1990
1717
|
*/
|
1991
1718
|
declare class StreamingTextResponse extends Response {
|
1992
|
-
constructor(res: ReadableStream, init?: ResponseInit, data?:
|
1719
|
+
constructor(res: ReadableStream, init?: ResponseInit, data?: StreamData);
|
1993
1720
|
}
|
1994
1721
|
/**
|
1995
1722
|
* A utility function to stream a ReadableStream to a Node.js response-like object.
|
@@ -1999,4 +1726,4 @@ declare function streamToResponse(res: ReadableStream, response: ServerResponse,
|
|
1999
1726
|
status?: number;
|
2000
1727
|
}): void;
|
2001
1728
|
|
2002
|
-
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantMessage,
|
1729
|
+
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantMessage, AssistantResponse, ChatRequest, ChatRequestOptions, CohereStream, CompletionUsage, CreateMessage, DataContent, DataMessage, DeepPartial, ErrorStreamPart, ExperimentalAssistantMessage, ExperimentalMessage, ExperimentalTool, ExperimentalToolMessage, ExperimentalUserMessage, Function, FunctionCall, FunctionCallHandler, FunctionCallPayload, GenerateObjectResult, GenerateTextResult, GoogleGenerativeAIStream, HuggingFaceStream, IdGenerator, ImagePart, InkeepAIStreamCallbacksAndOptions, InkeepChatResultCallbacks, InkeepOnFinalMetadata, InkeepStream, JSONValue, LangChainStream, Message$1 as Message, MistralStream, OpenAIStream, OpenAIStreamCallbacks, ReactResponseRow, ReplicateStream, RequestOptions, StreamData, StreamObjectResult, StreamString, StreamTextResult, StreamingTextResponse, TextPart$1 as TextPart, TextStreamPart, Tool, ToolCall, ToolCallHandler, ToolCallPart, ToolCallPayload, ToolChoice, ToolContent, ToolResultPart, UseChatOptions, UseCompletionOptions, UserContent, convertDataContentToBase64String, convertDataContentToUint8Array, createCallbacksTransformer, createChunkDecoder, createEventStreamTransformer, createStreamDataTransformer, experimental_AssistantResponse, experimental_StreamData, experimental_StreamingReactResponse, experimental_generateObject, experimental_generateText, experimental_streamObject, experimental_streamText, generateId, isStreamStringEqualToType, generateId as nanoid, readableFromAsyncIterable, streamToResponse, tool, trimStartOfStreamHelper };
|