ai 6.0.271 → 6.0.273
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 +20 -0
- package/dist/index.d.mts +105 -46
- package/dist/index.d.ts +105 -46
- package/dist/index.js +445 -385
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +376 -315
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +26 -1
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +7 -0
- package/docs/07-reference/05-ai-sdk-errors/ai-tool-choice-violation-error.mdx +38 -0
- package/docs/07-reference/05-ai-sdk-errors/index.mdx +1 -0
- package/package.json +3 -3
- package/src/agent/tool-loop-agent-settings.ts +9 -0
- package/src/error/index.ts +1 -0
- package/src/error/tool-choice-violation-error.ts +80 -0
- package/src/generate-text/generate-text.ts +25 -1
- package/src/generate-text/index.ts +2 -0
- package/src/generate-text/stream-text.ts +99 -52
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.273
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6e632b8: Expose parsed structured output in `streamText` end callbacks.
|
|
8
|
+
- Updated dependencies [5ab6f63]
|
|
9
|
+
- @ai-sdk/gateway@3.0.186
|
|
10
|
+
|
|
11
|
+
## 6.0.272
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- e822a1d: Reject `generateText` responses that do not satisfy a required or specifically selected tool choice, and expose the normalized response content on `ToolChoiceViolationError` for opt-in recovery.
|
|
16
|
+
- 8c51a25: fix(ai): allow tool approval secrets in ToolLoopAgent settings and prepareCall
|
|
17
|
+
- Updated dependencies [cc23556]
|
|
18
|
+
- Updated dependencies [823cc03]
|
|
19
|
+
- Updated dependencies [3f96cf8]
|
|
20
|
+
- @ai-sdk/provider-utils@4.0.50
|
|
21
|
+
- @ai-sdk/gateway@3.0.185
|
|
22
|
+
|
|
3
23
|
## 6.0.271
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV3Middleware, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV3Usage, AISDKError, LanguageModelV3ToolCall, JSONSchema7, LanguageModelV3CallOptions, LanguageModelV3ToolChoice, ProviderV3, JSONParseError, TypeValidationError, Experimental_VideoModelV3, Experimental_VideoModelV3FrameType, EmbeddingModelV3CallOptions, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
|
1
|
+
import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV3Middleware, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV3Usage, AISDKError, LanguageModelV3ToolCall, JSONSchema7, LanguageModelV3CallOptions, LanguageModelV3ToolChoice, ProviderV3, LanguageModelV3Content, JSONParseError, TypeValidationError, Experimental_VideoModelV3, Experimental_VideoModelV3FrameType, EmbeddingModelV3CallOptions, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
|
2
2
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
|
3
3
|
import { GatewayModelId } from '@ai-sdk/gateway';
|
|
4
4
|
export { GatewayModelId, createGateway, gateway } from '@ai-sdk/gateway';
|
|
@@ -590,6 +590,19 @@ type DownloadFunction = (options: Array<{
|
|
|
590
590
|
mediaType: string | undefined;
|
|
591
591
|
} | null>>;
|
|
592
592
|
|
|
593
|
+
/**
|
|
594
|
+
* Infers the complete output type from the output specification.
|
|
595
|
+
*/
|
|
596
|
+
type InferCompleteOutput<OUTPUT extends Output> = OUTPUT extends Output<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
597
|
+
/**
|
|
598
|
+
* Infers the partial output type from the output specification.
|
|
599
|
+
*/
|
|
600
|
+
type InferPartialOutput<OUTPUT extends Output> = OUTPUT extends Output<any, infer PARTIAL_OUTPUT, any> ? PARTIAL_OUTPUT : never;
|
|
601
|
+
/**
|
|
602
|
+
* Infers the element type from an array output specification.
|
|
603
|
+
*/
|
|
604
|
+
type InferElementOutput<OUTPUT extends Output> = OUTPUT extends Output<any, any, infer ELEMENT> ? ELEMENT : never;
|
|
605
|
+
|
|
593
606
|
/**
|
|
594
607
|
* Reasoning output of a text generation. It contains a reasoning.
|
|
595
608
|
*/
|
|
@@ -1038,19 +1051,6 @@ declare function stepCountIs(stepCount: number): StopCondition<any>;
|
|
|
1038
1051
|
declare function isLoopFinished(): StopCondition<any>;
|
|
1039
1052
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
1040
1053
|
|
|
1041
|
-
/**
|
|
1042
|
-
* Infers the complete output type from the output specification.
|
|
1043
|
-
*/
|
|
1044
|
-
type InferCompleteOutput<OUTPUT extends Output> = OUTPUT extends Output<infer COMPLETE_OUTPUT, any, any> ? COMPLETE_OUTPUT : never;
|
|
1045
|
-
/**
|
|
1046
|
-
* Infers the partial output type from the output specification.
|
|
1047
|
-
*/
|
|
1048
|
-
type InferPartialOutput<OUTPUT extends Output> = OUTPUT extends Output<any, infer PARTIAL_OUTPUT, any> ? PARTIAL_OUTPUT : never;
|
|
1049
|
-
/**
|
|
1050
|
-
* Infers the element type from an array output specification.
|
|
1051
|
-
*/
|
|
1052
|
-
type InferElementOutput<OUTPUT extends Output> = OUTPUT extends Output<any, any, infer ELEMENT> ? ELEMENT : never;
|
|
1053
|
-
|
|
1054
1054
|
/**
|
|
1055
1055
|
* The result of a `generateText` call.
|
|
1056
1056
|
* It contains the generated text, the tool calls that were made during the generation, and the results of the tool calls.
|
|
@@ -1179,9 +1179,9 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
|
|
|
1179
1179
|
readonly output: InferCompleteOutput<OUTPUT>;
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
|
-
declare const symbol$
|
|
1182
|
+
declare const symbol$l: unique symbol;
|
|
1183
1183
|
declare class InvalidToolInputError extends AISDKError {
|
|
1184
|
-
private readonly [symbol$
|
|
1184
|
+
private readonly [symbol$l];
|
|
1185
1185
|
readonly toolName: string;
|
|
1186
1186
|
readonly toolInput: string;
|
|
1187
1187
|
constructor({ toolInput, toolName, cause, message, }: {
|
|
@@ -1193,9 +1193,9 @@ declare class InvalidToolInputError extends AISDKError {
|
|
|
1193
1193
|
static isInstance(error: unknown): error is InvalidToolInputError;
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
|
-
declare const symbol$
|
|
1196
|
+
declare const symbol$k: unique symbol;
|
|
1197
1197
|
declare class NoSuchToolError extends AISDKError {
|
|
1198
|
-
private readonly [symbol$
|
|
1198
|
+
private readonly [symbol$k];
|
|
1199
1199
|
readonly toolName: string;
|
|
1200
1200
|
readonly availableTools: string[] | undefined;
|
|
1201
1201
|
constructor({ toolName, availableTools, message, }: {
|
|
@@ -2579,12 +2579,20 @@ type StreamTextOnChunkCallback<TOOLS extends ToolSet> = (event: {
|
|
|
2579
2579
|
type: 'text-delta' | 'reasoning-delta' | 'source' | 'tool-call' | 'tool-input-start' | 'tool-input-delta' | 'tool-result' | 'raw';
|
|
2580
2580
|
}>;
|
|
2581
2581
|
}) => PromiseLike<void> | void;
|
|
2582
|
+
type StreamTextEndEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output = Output> = OnFinishEvent<TOOLS> & {
|
|
2583
|
+
/**
|
|
2584
|
+
* The parsed output when an output setting was provided and parsing
|
|
2585
|
+
* succeeded.
|
|
2586
|
+
*/
|
|
2587
|
+
readonly output?: InferCompleteOutput<OUTPUT>;
|
|
2588
|
+
};
|
|
2589
|
+
type StreamTextOnEndCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output = Output> = (event: StreamTextEndEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
2582
2590
|
/**
|
|
2583
2591
|
* Callback that is set using the `onFinish` option.
|
|
2584
2592
|
*
|
|
2585
2593
|
* @param event - The event that is passed to the callback.
|
|
2586
2594
|
*/
|
|
2587
|
-
type StreamTextOnFinishCallback<TOOLS extends ToolSet
|
|
2595
|
+
type StreamTextOnFinishCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output = Output> = StreamTextOnEndCallback<TOOLS, OUTPUT>;
|
|
2588
2596
|
/**
|
|
2589
2597
|
* Callback that is set using the `onAbort` option.
|
|
2590
2598
|
*
|
|
@@ -2772,7 +2780,7 @@ declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output = Outpu
|
|
|
2772
2780
|
*
|
|
2773
2781
|
* The usage is the combined usage of all steps.
|
|
2774
2782
|
*/
|
|
2775
|
-
onFinish?: StreamTextOnFinishCallback<TOOLS
|
|
2783
|
+
onFinish?: StreamTextOnFinishCallback<NoInfer<TOOLS>, NoInfer<OUTPUT>>;
|
|
2776
2784
|
onAbort?: StreamTextOnAbortCallback<TOOLS>;
|
|
2777
2785
|
/**
|
|
2778
2786
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
@@ -3346,6 +3354,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3346
3354
|
* Callback that is called when all steps are finished and the response is complete.
|
|
3347
3355
|
*/
|
|
3348
3356
|
onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
|
|
3357
|
+
/**
|
|
3358
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
3359
|
+
* signs each approval request at issuance and verifies the signature when
|
|
3360
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
3361
|
+
*/
|
|
3362
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
3349
3363
|
/**
|
|
3350
3364
|
* Additional provider-specific options. They are passed through
|
|
3351
3365
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3385,7 +3399,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3385
3399
|
* }),
|
|
3386
3400
|
* ```
|
|
3387
3401
|
*/
|
|
3388
|
-
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
3402
|
+
prepareCall?: (options: Omit<AgentCallParameters<CALL_OPTIONS, NoInfer<TOOLS>>, 'onStepFinish'> & Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'experimental_toolApprovalSecret' | 'providerOptions' | 'experimental_context' | 'experimental_download'>) => MaybePromiseLike<Pick<ToolLoopAgentSettings<CALL_OPTIONS, TOOLS, OUTPUT>, 'model' | 'tools' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'timeout' | 'headers' | 'instructions' | 'allowSystemInMessages' | 'stopWhen' | 'experimental_telemetry' | 'activeTools' | 'experimental_toolApprovalSecret' | 'providerOptions' | 'experimental_context' | 'experimental_download'> & Omit<Prompt, 'system'>>;
|
|
3389
3403
|
};
|
|
3390
3404
|
|
|
3391
3405
|
/**
|
|
@@ -4575,9 +4589,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
4575
4589
|
maxParallelCalls?: number;
|
|
4576
4590
|
}): Promise<EmbedManyResult>;
|
|
4577
4591
|
|
|
4578
|
-
declare const symbol$
|
|
4592
|
+
declare const symbol$j: unique symbol;
|
|
4579
4593
|
declare class InvalidArgumentError extends AISDKError {
|
|
4580
|
-
private readonly [symbol$
|
|
4594
|
+
private readonly [symbol$j];
|
|
4581
4595
|
readonly parameter: string;
|
|
4582
4596
|
readonly value: unknown;
|
|
4583
4597
|
constructor({ parameter, value, message, }: {
|
|
@@ -4664,9 +4678,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
4664
4678
|
rawValue: unknown;
|
|
4665
4679
|
};
|
|
4666
4680
|
|
|
4667
|
-
declare const symbol$
|
|
4681
|
+
declare const symbol$i: unique symbol;
|
|
4668
4682
|
declare class InvalidStreamPartError extends AISDKError {
|
|
4669
|
-
private readonly [symbol$
|
|
4683
|
+
private readonly [symbol$i];
|
|
4670
4684
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4671
4685
|
constructor({ chunk, message, }: {
|
|
4672
4686
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4675,9 +4689,9 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
4675
4689
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
4676
4690
|
}
|
|
4677
4691
|
|
|
4678
|
-
declare const symbol$
|
|
4692
|
+
declare const symbol$h: unique symbol;
|
|
4679
4693
|
declare class InvalidToolApprovalError extends AISDKError {
|
|
4680
|
-
private readonly [symbol$
|
|
4694
|
+
private readonly [symbol$h];
|
|
4681
4695
|
readonly approvalId: string;
|
|
4682
4696
|
constructor({ approvalId }: {
|
|
4683
4697
|
approvalId: string;
|
|
@@ -4685,9 +4699,9 @@ declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4685
4699
|
static isInstance(error: unknown): error is InvalidToolApprovalError;
|
|
4686
4700
|
}
|
|
4687
4701
|
|
|
4688
|
-
declare const symbol$
|
|
4702
|
+
declare const symbol$g: unique symbol;
|
|
4689
4703
|
declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4690
|
-
private readonly [symbol$
|
|
4704
|
+
private readonly [symbol$g];
|
|
4691
4705
|
readonly approvalId: string;
|
|
4692
4706
|
readonly toolCallId: string;
|
|
4693
4707
|
constructor({ approvalId, toolCallId, reason, }: {
|
|
@@ -4698,9 +4712,9 @@ declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
4698
4712
|
static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
|
|
4699
4713
|
}
|
|
4700
4714
|
|
|
4701
|
-
declare const symbol$
|
|
4715
|
+
declare const symbol$f: unique symbol;
|
|
4702
4716
|
declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
4703
|
-
private readonly [symbol$
|
|
4717
|
+
private readonly [symbol$f];
|
|
4704
4718
|
readonly toolCallId: string;
|
|
4705
4719
|
readonly approvalId: string;
|
|
4706
4720
|
constructor({ toolCallId, approvalId, }: {
|
|
@@ -4710,9 +4724,9 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
4710
4724
|
static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
|
|
4711
4725
|
}
|
|
4712
4726
|
|
|
4713
|
-
declare const symbol$
|
|
4727
|
+
declare const symbol$e: unique symbol;
|
|
4714
4728
|
declare class MissingToolResultsError extends AISDKError {
|
|
4715
|
-
private readonly [symbol$
|
|
4729
|
+
private readonly [symbol$e];
|
|
4716
4730
|
readonly toolCallIds: string[];
|
|
4717
4731
|
constructor({ toolCallIds }: {
|
|
4718
4732
|
toolCallIds: string[];
|
|
@@ -4720,7 +4734,7 @@ declare class MissingToolResultsError extends AISDKError {
|
|
|
4720
4734
|
static isInstance(error: unknown): error is MissingToolResultsError;
|
|
4721
4735
|
}
|
|
4722
4736
|
|
|
4723
|
-
declare const symbol$
|
|
4737
|
+
declare const symbol$d: unique symbol;
|
|
4724
4738
|
/**
|
|
4725
4739
|
* Thrown when no image could be generated. This can have multiple causes:
|
|
4726
4740
|
*
|
|
@@ -4728,7 +4742,7 @@ declare const symbol$c: unique symbol;
|
|
|
4728
4742
|
* - The model generated a response that could not be parsed.
|
|
4729
4743
|
*/
|
|
4730
4744
|
declare class NoImageGeneratedError extends AISDKError {
|
|
4731
|
-
private readonly [symbol$
|
|
4745
|
+
private readonly [symbol$d];
|
|
4732
4746
|
/**
|
|
4733
4747
|
* The response metadata for each call.
|
|
4734
4748
|
*/
|
|
@@ -4741,7 +4755,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
4741
4755
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
4742
4756
|
}
|
|
4743
4757
|
|
|
4744
|
-
declare const symbol$
|
|
4758
|
+
declare const symbol$c: unique symbol;
|
|
4745
4759
|
/**
|
|
4746
4760
|
* Thrown when no object could be generated. This can have several causes:
|
|
4747
4761
|
*
|
|
@@ -4754,7 +4768,7 @@ declare const symbol$b: unique symbol;
|
|
|
4754
4768
|
* - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4755
4769
|
*/
|
|
4756
4770
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
4757
|
-
private readonly [symbol$
|
|
4771
|
+
private readonly [symbol$c];
|
|
4758
4772
|
/**
|
|
4759
4773
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4760
4774
|
*/
|
|
@@ -4782,12 +4796,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
4782
4796
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
4783
4797
|
}
|
|
4784
4798
|
|
|
4785
|
-
declare const symbol$
|
|
4799
|
+
declare const symbol$b: unique symbol;
|
|
4786
4800
|
/**
|
|
4787
4801
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
4788
4802
|
*/
|
|
4789
4803
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
4790
|
-
private readonly [symbol$
|
|
4804
|
+
private readonly [symbol$b];
|
|
4791
4805
|
constructor({ message, cause, }?: {
|
|
4792
4806
|
message?: string;
|
|
4793
4807
|
cause?: Error;
|
|
@@ -4795,12 +4809,12 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
4795
4809
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
4796
4810
|
}
|
|
4797
4811
|
|
|
4798
|
-
declare const symbol$
|
|
4812
|
+
declare const symbol$a: unique symbol;
|
|
4799
4813
|
/**
|
|
4800
4814
|
* Error that is thrown when no speech audio was generated.
|
|
4801
4815
|
*/
|
|
4802
4816
|
declare class NoSpeechGeneratedError extends AISDKError {
|
|
4803
|
-
private readonly [symbol$
|
|
4817
|
+
private readonly [symbol$a];
|
|
4804
4818
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
4805
4819
|
constructor(options: {
|
|
4806
4820
|
responses: Array<SpeechModelResponseMetadata>;
|
|
@@ -4808,12 +4822,12 @@ declare class NoSpeechGeneratedError extends AISDKError {
|
|
|
4808
4822
|
static isInstance(error: unknown): error is NoSpeechGeneratedError;
|
|
4809
4823
|
}
|
|
4810
4824
|
|
|
4811
|
-
declare const symbol$
|
|
4825
|
+
declare const symbol$9: unique symbol;
|
|
4812
4826
|
/**
|
|
4813
4827
|
* Error that is thrown when no transcript was generated.
|
|
4814
4828
|
*/
|
|
4815
4829
|
declare class NoTranscriptGeneratedError extends AISDKError {
|
|
4816
|
-
private readonly [symbol$
|
|
4830
|
+
private readonly [symbol$9];
|
|
4817
4831
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
4818
4832
|
constructor(options: {
|
|
4819
4833
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
@@ -4845,9 +4859,9 @@ type VideoModelResponseMetadata = {
|
|
|
4845
4859
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
4846
4860
|
};
|
|
4847
4861
|
|
|
4848
|
-
declare const symbol$
|
|
4862
|
+
declare const symbol$8: unique symbol;
|
|
4849
4863
|
declare class NoVideoGeneratedError extends AISDKError {
|
|
4850
|
-
private readonly [symbol$
|
|
4864
|
+
private readonly [symbol$8];
|
|
4851
4865
|
readonly responses: Array<VideoModelResponseMetadata>;
|
|
4852
4866
|
constructor({ message, cause, responses, }: {
|
|
4853
4867
|
message?: string;
|
|
@@ -4871,6 +4885,51 @@ declare class NoVideoGeneratedError extends AISDKError {
|
|
|
4871
4885
|
};
|
|
4872
4886
|
}
|
|
4873
4887
|
|
|
4888
|
+
declare const symbol$7: unique symbol;
|
|
4889
|
+
type EnforcedToolChoice = Extract<LanguageModelV3ToolChoice, {
|
|
4890
|
+
type: 'required';
|
|
4891
|
+
} | {
|
|
4892
|
+
type: 'tool';
|
|
4893
|
+
}>;
|
|
4894
|
+
/**
|
|
4895
|
+
* Thrown when a model response does not satisfy an enforced tool choice.
|
|
4896
|
+
*/
|
|
4897
|
+
declare class ToolChoiceViolationError extends AISDKError {
|
|
4898
|
+
private readonly [symbol$7];
|
|
4899
|
+
/**
|
|
4900
|
+
* The tool choice that the model response did not satisfy.
|
|
4901
|
+
*/
|
|
4902
|
+
readonly toolChoice: EnforcedToolChoice;
|
|
4903
|
+
/**
|
|
4904
|
+
* Reason why the model finished generating the response.
|
|
4905
|
+
*/
|
|
4906
|
+
readonly finishReason: FinishReason;
|
|
4907
|
+
/**
|
|
4908
|
+
* The provider that returned the response.
|
|
4909
|
+
*/
|
|
4910
|
+
readonly provider: string;
|
|
4911
|
+
/**
|
|
4912
|
+
* The model that returned the response.
|
|
4913
|
+
*/
|
|
4914
|
+
readonly modelId: string;
|
|
4915
|
+
/**
|
|
4916
|
+
* The normalized content returned by the model.
|
|
4917
|
+
*
|
|
4918
|
+
* This can be inspected to recover a tool call that the provider returned as
|
|
4919
|
+
* text or reasoning instead of a structured tool call.
|
|
4920
|
+
*/
|
|
4921
|
+
readonly content: Array<LanguageModelV3Content>;
|
|
4922
|
+
constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
|
|
4923
|
+
toolChoice: EnforcedToolChoice;
|
|
4924
|
+
finishReason: FinishReason;
|
|
4925
|
+
provider: string;
|
|
4926
|
+
modelId: string;
|
|
4927
|
+
content: Array<LanguageModelV3Content>;
|
|
4928
|
+
message?: string;
|
|
4929
|
+
});
|
|
4930
|
+
static isInstance(error: unknown): error is ToolChoiceViolationError;
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4874
4933
|
declare const symbol$6: unique symbol;
|
|
4875
4934
|
declare class ToolCallRepairError extends AISDKError {
|
|
4876
4935
|
private readonly [symbol$6];
|
|
@@ -6457,4 +6516,4 @@ declare function bindTelemetryIntegration(integration: TelemetryIntegration): Te
|
|
|
6457
6516
|
*/
|
|
6458
6517
|
declare function registerTelemetryIntegration(integration: TelemetryIntegration): void;
|
|
6459
6518
|
|
|
6460
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
|
|
6519
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextEndEvent, StreamTextOnChunkCallback, StreamTextOnEndCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolChoiceViolationError, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamOutcome, UIMessageStreamWriter, UIMessageStreamWriterWithOutcome, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
|