ai 5.0.0-canary.14 → 5.0.0-canary.15
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 +17 -0
- package/dist/index.d.mts +98 -160
- package/dist/index.d.ts +98 -160
- package/dist/index.js +85 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -86
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +24 -60
- package/dist/internal/index.d.ts +24 -60
- package/dist/internal/index.js +10 -67
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +5 -48
- package/dist/internal/index.mjs.map +1 -1
- package/dist/test/index.d.mts +4 -3
- package/dist/test/index.d.ts +4 -3
- package/dist/test/index.js +5 -2
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +5 -2
- package/dist/test/index.mjs.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ToolCall, ToolResult, FetchFunction,
|
2
|
-
export { IDGenerator, ToolCall, ToolResult, createIdGenerator, generateId } from '@ai-sdk/provider-utils';
|
3
|
-
import
|
4
|
-
|
1
|
+
import { ToolCall, ToolResult, FetchFunction, Schema, IDGenerator } from '@ai-sdk/provider-utils';
|
2
|
+
export { IDGenerator, Schema, ToolCall, ToolResult, asSchema, createIdGenerator, generateId, jsonSchema } from '@ai-sdk/provider-utils';
|
3
|
+
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
4
|
+
import { EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, SharedV2ProviderMetadata, SharedV2ProviderOptions, SpeechModelV1, SpeechModelV1CallWarning, TranscriptionModelV1, TranscriptionModelV1CallWarning, JSONObject, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, LanguageModelV2Middleware, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
5
|
+
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
5
6
|
import { ServerResponse } from 'node:http';
|
6
7
|
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
7
8
|
import { z } from 'zod';
|
8
|
-
import { JSONSchema7 } from 'json-schema';
|
9
9
|
import { ServerResponse as ServerResponse$1 } from 'http';
|
10
10
|
|
11
11
|
/**
|
@@ -42,6 +42,8 @@ type ImageModelResponseMetadata = {
|
|
42
42
|
headers?: Record<string, string>;
|
43
43
|
};
|
44
44
|
|
45
|
+
type JSONValue = JSONValue$1;
|
46
|
+
|
45
47
|
/**
|
46
48
|
Language model that is used by the AI SDK Core functions.
|
47
49
|
*/
|
@@ -159,36 +161,63 @@ provider-specific functionality that can be fully encapsulated in the provider.
|
|
159
161
|
type ProviderOptions = SharedV2ProviderOptions;
|
160
162
|
|
161
163
|
/**
|
162
|
-
|
163
|
-
|
164
|
-
type
|
164
|
+
Speech model that is used by the AI SDK Core functions.
|
165
|
+
*/
|
166
|
+
type SpeechModel = SpeechModelV1;
|
167
|
+
/**
|
168
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
169
|
+
some settings might not be supported, which can lead to suboptimal results.
|
170
|
+
*/
|
171
|
+
type SpeechWarning = SpeechModelV1CallWarning;
|
172
|
+
|
173
|
+
type SpeechModelResponseMetadata = {
|
165
174
|
/**
|
166
|
-
|
175
|
+
Timestamp for the start of the generated response.
|
167
176
|
*/
|
168
|
-
|
177
|
+
timestamp: Date;
|
169
178
|
/**
|
170
|
-
The
|
171
|
-
|
172
|
-
|
179
|
+
The ID of the response model that was used to generate the response.
|
180
|
+
*/
|
181
|
+
modelId: string;
|
173
182
|
/**
|
174
|
-
|
183
|
+
Response headers.
|
175
184
|
*/
|
176
|
-
|
185
|
+
headers?: Record<string, string>;
|
186
|
+
/**
|
187
|
+
Response body.
|
188
|
+
*/
|
189
|
+
body?: unknown;
|
177
190
|
};
|
191
|
+
|
178
192
|
/**
|
179
|
-
|
180
|
-
|
181
|
-
type
|
193
|
+
Transcription model that is used by the AI SDK Core functions.
|
194
|
+
*/
|
195
|
+
type TranscriptionModel = TranscriptionModelV1;
|
196
|
+
/**
|
197
|
+
Warning from the model provider for this call. The call will proceed, but e.g.
|
198
|
+
some settings might not be supported, which can lead to suboptimal results.
|
199
|
+
*/
|
200
|
+
type TranscriptionWarning = TranscriptionModelV1CallWarning;
|
201
|
+
|
202
|
+
type TranscriptionModelResponseMetadata = {
|
182
203
|
/**
|
183
|
-
|
204
|
+
Timestamp for the start of the generated response.
|
184
205
|
*/
|
185
|
-
|
206
|
+
timestamp: Date;
|
207
|
+
/**
|
208
|
+
The ID of the response model that was used to generate the response.
|
209
|
+
*/
|
210
|
+
modelId: string;
|
211
|
+
/**
|
212
|
+
Response headers.
|
213
|
+
*/
|
214
|
+
headers?: Record<string, string>;
|
186
215
|
};
|
187
216
|
|
188
217
|
/**
|
189
218
|
Represents the number of tokens used in a prompt and completion.
|
190
219
|
*/
|
191
|
-
type LanguageModelUsage = {
|
220
|
+
type LanguageModelUsage$1 = {
|
192
221
|
/**
|
193
222
|
The number of tokens used in the prompt.
|
194
223
|
*/
|
@@ -258,12 +287,6 @@ interface Message {
|
|
258
287
|
*/
|
259
288
|
content: string;
|
260
289
|
/**
|
261
|
-
Reasoning for the message.
|
262
|
-
|
263
|
-
@deprecated Use `parts` instead.
|
264
|
-
*/
|
265
|
-
reasoning?: string;
|
266
|
-
/**
|
267
290
|
* Additional attachments to be sent along with the message.
|
268
291
|
*/
|
269
292
|
experimental_attachments?: Attachment[];
|
@@ -272,15 +295,9 @@ interface Message {
|
|
272
295
|
*/
|
273
296
|
role: 'system' | 'user' | 'assistant' | 'data';
|
274
297
|
/**
|
275
|
-
For data messages.
|
276
|
-
|
277
|
-
@deprecated Data messages will be removed.
|
278
|
-
*/
|
279
|
-
data?: JSONValue;
|
280
|
-
/**
|
281
298
|
* Additional message-specific information added on the server via StreamData
|
282
299
|
*/
|
283
|
-
annotations?: JSONValue[] | undefined;
|
300
|
+
annotations?: JSONValue$1[] | undefined;
|
284
301
|
/**
|
285
302
|
Tool invocations (that can be tool calls or tool results, depending on whether or not the invocation has finished)
|
286
303
|
that the assistant made as part of this message.
|
@@ -390,7 +407,7 @@ type ChatRequest = {
|
|
390
407
|
/**
|
391
408
|
Additional data to be sent to the server.
|
392
409
|
*/
|
393
|
-
data?: JSONValue;
|
410
|
+
data?: JSONValue$1;
|
394
411
|
};
|
395
412
|
type RequestOptions = {
|
396
413
|
/**
|
@@ -414,7 +431,7 @@ type ChatRequestOptions = {
|
|
414
431
|
/**
|
415
432
|
Additional data to be sent to the API endpoint.
|
416
433
|
*/
|
417
|
-
data?: JSONValue;
|
434
|
+
data?: JSONValue$1;
|
418
435
|
/**
|
419
436
|
* Additional files to be sent to the server.
|
420
437
|
*/
|
@@ -472,7 +489,7 @@ type UseChatOptions = {
|
|
472
489
|
* @param options.finishReason The finish reason of the message.
|
473
490
|
*/
|
474
491
|
onFinish?: (message: Message, options: {
|
475
|
-
usage: LanguageModelUsage;
|
492
|
+
usage: LanguageModelUsage$1;
|
476
493
|
finishReason: LanguageModelV2FinishReason;
|
477
494
|
}) => void;
|
478
495
|
/**
|
@@ -588,66 +605,32 @@ type UseCompletionOptions = {
|
|
588
605
|
*/
|
589
606
|
fetch?: FetchFunction;
|
590
607
|
};
|
591
|
-
/**
|
592
|
-
A JSON value can be a string, number, boolean, object, array, or null.
|
593
|
-
JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
|
594
|
-
*/
|
595
|
-
type JSONValue = null | string | number | boolean | {
|
596
|
-
[value: string]: JSONValue;
|
597
|
-
} | Array<JSONValue>;
|
598
608
|
|
599
609
|
/**
|
600
|
-
|
601
|
-
|
602
|
-
type
|
603
|
-
/**
|
604
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
605
|
-
some settings might not be supported, which can lead to suboptimal results.
|
606
|
-
*/
|
607
|
-
type TranscriptionWarning = TranscriptionModelV1CallWarning;
|
608
|
-
|
609
|
-
type TranscriptionModelResponseMetadata = {
|
610
|
+
Represents the number of tokens used in a prompt and completion.
|
611
|
+
*/
|
612
|
+
type LanguageModelUsage = {
|
610
613
|
/**
|
611
|
-
|
614
|
+
The number of tokens used in the prompt.
|
612
615
|
*/
|
613
|
-
|
616
|
+
promptTokens: number;
|
614
617
|
/**
|
615
|
-
The
|
616
|
-
|
617
|
-
|
618
|
+
The number of tokens used in the completion.
|
619
|
+
*/
|
620
|
+
completionTokens: number;
|
618
621
|
/**
|
619
|
-
|
622
|
+
The total number of tokens used (promptTokens + completionTokens).
|
620
623
|
*/
|
621
|
-
|
624
|
+
totalTokens: number;
|
622
625
|
};
|
623
|
-
|
624
|
-
/**
|
625
|
-
Speech model that is used by the AI SDK Core functions.
|
626
|
-
*/
|
627
|
-
type SpeechModel = SpeechModelV1;
|
628
626
|
/**
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
type SpeechWarning = SpeechModelV1CallWarning;
|
633
|
-
|
634
|
-
type SpeechModelResponseMetadata = {
|
635
|
-
/**
|
636
|
-
Timestamp for the start of the generated response.
|
637
|
-
*/
|
638
|
-
timestamp: Date;
|
639
|
-
/**
|
640
|
-
The ID of the response model that was used to generate the response.
|
641
|
-
*/
|
642
|
-
modelId: string;
|
643
|
-
/**
|
644
|
-
Response headers.
|
645
|
-
*/
|
646
|
-
headers?: Record<string, string>;
|
627
|
+
Represents the number of tokens used in an embedding.
|
628
|
+
*/
|
629
|
+
type EmbeddingModelUsage = {
|
647
630
|
/**
|
648
|
-
|
631
|
+
The number of tokens used in the embedding.
|
649
632
|
*/
|
650
|
-
|
633
|
+
tokens: number;
|
651
634
|
};
|
652
635
|
|
653
636
|
declare const getOriginalFetch$1: () => typeof fetch;
|
@@ -662,7 +645,7 @@ declare function callChatApi({ api, body, streamProtocol, credentials, headers,
|
|
662
645
|
onResponse: ((response: Response) => void | Promise<void>) | undefined;
|
663
646
|
onUpdate: (options: {
|
664
647
|
message: UIMessage;
|
665
|
-
data: JSONValue[] | undefined;
|
648
|
+
data: JSONValue$1[] | undefined;
|
666
649
|
replaceLastMessage: boolean;
|
667
650
|
}) => void;
|
668
651
|
onFinish: UseChatOptions['onFinish'];
|
@@ -700,7 +683,7 @@ interface DataStreamPart<CODE extends string, NAME extends string, TYPE> {
|
|
700
683
|
value: TYPE;
|
701
684
|
};
|
702
685
|
}
|
703
|
-
declare const dataStreamParts: readonly [DataStreamPart<"0", "text", string>, DataStreamPart<"2", "data", JSONValue[]>, DataStreamPart<"3", "error", string>, DataStreamPart<"8", "message_annotations", JSONValue[]>, DataStreamPart<"9", "tool_call", ToolCall<string, any>>, DataStreamPart<"a", "tool_result", Omit<ToolResult<string, any, any>, "args" | "toolName">>, DataStreamPart<"b", "tool_call_streaming_start", {
|
686
|
+
declare const dataStreamParts: readonly [DataStreamPart<"0", "text", string>, DataStreamPart<"2", "data", _ai_sdk_provider.JSONValue[]>, DataStreamPart<"3", "error", string>, DataStreamPart<"8", "message_annotations", _ai_sdk_provider.JSONValue[]>, DataStreamPart<"9", "tool_call", ToolCall<string, any>>, DataStreamPart<"a", "tool_result", Omit<ToolResult<string, any, any>, "args" | "toolName">>, DataStreamPart<"b", "tool_call_streaming_start", {
|
704
687
|
toolCallId: string;
|
705
688
|
toolName: string;
|
706
689
|
}>, DataStreamPart<"c", "tool_call_delta", {
|
@@ -874,39 +857,19 @@ declare function processTextStream({ stream, onTextPart, }: {
|
|
874
857
|
}): Promise<void>;
|
875
858
|
|
876
859
|
/**
|
877
|
-
*
|
878
|
-
*/
|
879
|
-
declare const schemaSymbol: unique symbol;
|
880
|
-
type Schema<OBJECT = unknown> = Validator<OBJECT> & {
|
881
|
-
/**
|
882
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
883
|
-
*/
|
884
|
-
[schemaSymbol]: true;
|
885
|
-
/**
|
886
|
-
* Schema type for inference.
|
887
|
-
*/
|
888
|
-
_type: OBJECT;
|
889
|
-
/**
|
890
|
-
* The JSON Schema for the schema. It is passed to the providers.
|
891
|
-
*/
|
892
|
-
readonly jsonSchema: JSONSchema7;
|
893
|
-
};
|
894
|
-
/**
|
895
|
-
* Create a schema using a JSON Schema.
|
860
|
+
* Updates the result of a specific tool invocation in the last message of the given messages array.
|
896
861
|
*
|
897
|
-
* @param
|
898
|
-
* @param
|
862
|
+
* @param {object} params - The parameters object.
|
863
|
+
* @param {UIMessage[]} params.messages - An array of messages, from which the last one is updated.
|
864
|
+
* @param {string} params.toolCallId - The unique identifier for the tool invocation to update.
|
865
|
+
* @param {unknown} params.toolResult - The result object to attach to the tool invocation.
|
866
|
+
* @returns {void} This function does not return anything.
|
899
867
|
*/
|
900
|
-
declare function
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
success: false;
|
906
|
-
error: Error;
|
907
|
-
};
|
908
|
-
}): Schema<OBJECT>;
|
909
|
-
declare function asSchema<OBJECT>(schema: z.Schema<OBJECT, z.ZodTypeDef, any> | Schema<OBJECT> | undefined): Schema<OBJECT>;
|
868
|
+
declare function updateToolCallResult({ messages, toolCallId, toolResult: result, }: {
|
869
|
+
messages: UIMessage[];
|
870
|
+
toolCallId: string;
|
871
|
+
toolResult: unknown;
|
872
|
+
}): void;
|
910
873
|
|
911
874
|
declare function shouldResubmitMessages({ originalMaxToolInvocationStep, originalMessageCount, maxSteps, messages, }: {
|
912
875
|
originalMaxToolInvocationStep: number | undefined;
|
@@ -923,31 +886,6 @@ declare function isAssistantMessageWithCompletedToolCalls(message: UIMessage): m
|
|
923
886
|
role: 'assistant';
|
924
887
|
};
|
925
888
|
|
926
|
-
/**
|
927
|
-
* Updates the result of a specific tool invocation in the last message of the given messages array.
|
928
|
-
*
|
929
|
-
* @param {object} params - The parameters object.
|
930
|
-
* @param {UIMessage[]} params.messages - An array of messages, from which the last one is updated.
|
931
|
-
* @param {string} params.toolCallId - The unique identifier for the tool invocation to update.
|
932
|
-
* @param {unknown} params.toolResult - The result object to attach to the tool invocation.
|
933
|
-
* @returns {void} This function does not return anything.
|
934
|
-
*/
|
935
|
-
declare function updateToolCallResult({ messages, toolCallId, toolResult: result, }: {
|
936
|
-
messages: UIMessage[];
|
937
|
-
toolCallId: string;
|
938
|
-
toolResult: unknown;
|
939
|
-
}): void;
|
940
|
-
|
941
|
-
declare function zodSchema<OBJECT>(zodSchema: z.Schema<OBJECT, z.ZodTypeDef, any>, options?: {
|
942
|
-
/**
|
943
|
-
* Enables support for references in the schema.
|
944
|
-
* This is required for recursive schemas, e.g. with `z.lazy`.
|
945
|
-
* However, not all language models and providers support such references.
|
946
|
-
* Defaults to `false`.
|
947
|
-
*/
|
948
|
-
useReferences?: boolean;
|
949
|
-
}): Schema<OBJECT>;
|
950
|
-
|
951
889
|
interface DataStreamWriter {
|
952
890
|
/**
|
953
891
|
* Appends a data part to the stream.
|
@@ -2792,7 +2730,7 @@ type StepResult<TOOLS extends ToolSet> = {
|
|
2792
2730
|
/**
|
2793
2731
|
The token usage of the generated text.
|
2794
2732
|
*/
|
2795
|
-
readonly usage: LanguageModelUsage
|
2733
|
+
readonly usage: LanguageModelUsage;
|
2796
2734
|
/**
|
2797
2735
|
Warnings from the model provider (e.g. unsupported settings).
|
2798
2736
|
*/
|
@@ -2880,7 +2818,7 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
|
|
2880
2818
|
/**
|
2881
2819
|
The token usage of the generated text.
|
2882
2820
|
*/
|
2883
|
-
readonly usage: LanguageModelUsage
|
2821
|
+
readonly usage: LanguageModelUsage;
|
2884
2822
|
/**
|
2885
2823
|
Warnings from the model provider (e.g. unsupported settings)
|
2886
2824
|
*/
|
@@ -2933,7 +2871,7 @@ interface Output$1<OUTPUT, PARTIAL> {
|
|
2933
2871
|
text: string;
|
2934
2872
|
}, context: {
|
2935
2873
|
response: LanguageModelResponseMetadata;
|
2936
|
-
usage: LanguageModelUsage
|
2874
|
+
usage: LanguageModelUsage;
|
2937
2875
|
finishReason: FinishReason;
|
2938
2876
|
}): Promise<OUTPUT>;
|
2939
2877
|
}
|
@@ -3035,7 +2973,7 @@ type ToolCallRepairFunction<TOOLS extends ToolSet> = (options: {
|
|
3035
2973
|
tools: TOOLS;
|
3036
2974
|
parameterSchema: (options: {
|
3037
2975
|
toolName: string;
|
3038
|
-
}) => JSONSchema7
|
2976
|
+
}) => JSONSchema7;
|
3039
2977
|
error: NoSuchToolError | InvalidToolArgumentsError;
|
3040
2978
|
}) => Promise<LanguageModelV2ToolCall | null>;
|
3041
2979
|
|
@@ -3253,7 +3191,7 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
|
|
3253
3191
|
|
3254
3192
|
Resolved when the response is finished.
|
3255
3193
|
*/
|
3256
|
-
readonly usage: Promise<LanguageModelUsage
|
3194
|
+
readonly usage: Promise<LanguageModelUsage>;
|
3257
3195
|
/**
|
3258
3196
|
Sources that have been used as input to generate the response.
|
3259
3197
|
For multi-step generation, the sources are accumulated from all steps.
|
@@ -3470,14 +3408,14 @@ type TextStreamPart<TOOLS extends ToolSet> = {
|
|
3470
3408
|
request: LanguageModelRequestMetadata;
|
3471
3409
|
warnings: CallWarning[] | undefined;
|
3472
3410
|
response: LanguageModelResponseMetadata;
|
3473
|
-
usage: LanguageModelUsage
|
3411
|
+
usage: LanguageModelUsage;
|
3474
3412
|
finishReason: FinishReason;
|
3475
3413
|
providerMetadata: ProviderMetadata | undefined;
|
3476
3414
|
isContinued: boolean;
|
3477
3415
|
} | {
|
3478
3416
|
type: 'finish';
|
3479
3417
|
finishReason: FinishReason;
|
3480
|
-
usage: LanguageModelUsage
|
3418
|
+
usage: LanguageModelUsage;
|
3481
3419
|
providerMetadata: ProviderMetadata | undefined;
|
3482
3420
|
/**
|
3483
3421
|
* @deprecated use response on step-finish instead
|
@@ -3790,7 +3728,7 @@ declare function generateImage({ model, prompt, n, size, aspectRatio, seed, prov
|
|
3790
3728
|
}
|
3791
3729
|
```
|
3792
3730
|
*/
|
3793
|
-
providerOptions?:
|
3731
|
+
providerOptions?: ProviderOptions;
|
3794
3732
|
/**
|
3795
3733
|
Maximum number of retries per embedding model call. Set to 0 to disable retries.
|
3796
3734
|
|
@@ -3823,7 +3761,7 @@ interface GenerateObjectResult<OBJECT> {
|
|
3823
3761
|
/**
|
3824
3762
|
The token usage of the generated text.
|
3825
3763
|
*/
|
3826
|
-
readonly usage: LanguageModelUsage
|
3764
|
+
readonly usage: LanguageModelUsage;
|
3827
3765
|
/**
|
3828
3766
|
Warnings from the model provider (e.g. unsupported settings).
|
3829
3767
|
*/
|
@@ -3951,7 +3889,7 @@ interface StreamObjectResult<PARTIAL, RESULT, ELEMENT_STREAM> {
|
|
3951
3889
|
/**
|
3952
3890
|
The token usage of the generated response. Resolved when the response is finished.
|
3953
3891
|
*/
|
3954
|
-
readonly usage: Promise<LanguageModelUsage
|
3892
|
+
readonly usage: Promise<LanguageModelUsage>;
|
3955
3893
|
/**
|
3956
3894
|
Additional provider-specific metadata. They are passed through
|
3957
3895
|
from the provider to the AI SDK and enable provider-specific
|
@@ -4022,7 +3960,7 @@ type ObjectStreamPart<PARTIAL> = {
|
|
4022
3960
|
} | {
|
4023
3961
|
type: 'finish';
|
4024
3962
|
finishReason: FinishReason;
|
4025
|
-
usage: LanguageModelUsage
|
3963
|
+
usage: LanguageModelUsage;
|
4026
3964
|
response: LanguageModelResponseMetadata;
|
4027
3965
|
providerMetadata?: ProviderMetadata;
|
4028
3966
|
};
|
@@ -4044,7 +3982,7 @@ type StreamObjectOnFinishCallback<RESULT> = (event: {
|
|
4044
3982
|
/**
|
4045
3983
|
The token usage of the generated response.
|
4046
3984
|
*/
|
4047
|
-
usage: LanguageModelUsage
|
3985
|
+
usage: LanguageModelUsage;
|
4048
3986
|
/**
|
4049
3987
|
The generated object. Can be undefined if the final object does not match the schema.
|
4050
3988
|
*/
|
@@ -4556,7 +4494,7 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
4556
4494
|
} | {
|
4557
4495
|
type: 'finish';
|
4558
4496
|
finishReason: FinishReason;
|
4559
|
-
usage: LanguageModelUsage
|
4497
|
+
usage: LanguageModelUsage;
|
4560
4498
|
providerMetadata?: ProviderMetadata;
|
4561
4499
|
} | {
|
4562
4500
|
type: 'error';
|
@@ -4620,7 +4558,7 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
4620
4558
|
/**
|
4621
4559
|
The usage of the model.
|
4622
4560
|
*/
|
4623
|
-
readonly usage: LanguageModelUsage
|
4561
|
+
readonly usage: LanguageModelUsage | undefined;
|
4624
4562
|
/**
|
4625
4563
|
Reason why the model finished generating a response.
|
4626
4564
|
*/
|
@@ -4630,7 +4568,7 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
4630
4568
|
cause?: Error;
|
4631
4569
|
text?: string;
|
4632
4570
|
response: LanguageModelResponseMetadata;
|
4633
|
-
usage: LanguageModelUsage
|
4571
|
+
usage: LanguageModelUsage;
|
4634
4572
|
finishReason: FinishReason;
|
4635
4573
|
});
|
4636
4574
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
@@ -4755,4 +4693,4 @@ declare class RetryError extends AISDKError {
|
|
4755
4693
|
static isInstance(error: unknown): error is RetryError;
|
4756
4694
|
}
|
4757
4695
|
|
4758
|
-
export { AssistantContent, Attachment, CallSettings, CallWarning, ChatRequest, ChatRequestOptions, ChunkDetector, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateMessage, DataContent, DataStreamOptions, DataStreamPart, DataStreamString, DataStreamWriter, DeepPartial, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, IdGenerator, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage
|
4696
|
+
export { AssistantContent, Attachment, CallSettings, CallWarning, ChatRequest, ChatRequestOptions, ChunkDetector, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateMessage, DataContent, DataStreamOptions, DataStreamPart, DataStreamString, DataStreamWriter, DeepPartial, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, IdGenerator, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, Message, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RequestOptions, RetryError, SourceUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIMessage, UseChatOptions, UseCompletionOptions, UserContent, appendClientMessage, appendResponseMessages, callChatApi, callCompletionApi, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, createProviderRegistry, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, fillMessageParts, formatDataStreamPart, generateObject, generateText, getMessageParts, getTextFromDataUrl, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, parseDataStreamPart, parsePartialJson, pipeDataStreamToResponse, prepareAttachmentsForRequest, processDataStream, processTextStream, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, updateToolCallResult, wrapLanguageModel };
|