ai 6.0.271 → 6.0.272
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 +12 -0
- package/dist/index.d.mts +82 -31
- package/dist/index.d.ts +82 -31
- package/dist/index.js +384 -341
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -271
- 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/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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.272
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- 8c51a25: fix(ai): allow tool approval secrets in ToolLoopAgent settings and prepareCall
|
|
9
|
+
- Updated dependencies [cc23556]
|
|
10
|
+
- Updated dependencies [823cc03]
|
|
11
|
+
- Updated dependencies [3f96cf8]
|
|
12
|
+
- @ai-sdk/provider-utils@4.0.50
|
|
13
|
+
- @ai-sdk/gateway@3.0.185
|
|
14
|
+
|
|
3
15
|
## 6.0.271
|
|
4
16
|
|
|
5
17
|
### 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';
|
|
@@ -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, }: {
|
|
@@ -3346,6 +3346,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3346
3346
|
* Callback that is called when all steps are finished and the response is complete.
|
|
3347
3347
|
*/
|
|
3348
3348
|
onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
|
|
3349
|
+
/**
|
|
3350
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
3351
|
+
* signs each approval request at issuance and verifies the signature when
|
|
3352
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
3353
|
+
*/
|
|
3354
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
3349
3355
|
/**
|
|
3350
3356
|
* Additional provider-specific options. They are passed through
|
|
3351
3357
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3385,7 +3391,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3385
3391
|
* }),
|
|
3386
3392
|
* ```
|
|
3387
3393
|
*/
|
|
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'>>;
|
|
3394
|
+
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
3395
|
};
|
|
3390
3396
|
|
|
3391
3397
|
/**
|
|
@@ -4575,9 +4581,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
4575
4581
|
maxParallelCalls?: number;
|
|
4576
4582
|
}): Promise<EmbedManyResult>;
|
|
4577
4583
|
|
|
4578
|
-
declare const symbol$
|
|
4584
|
+
declare const symbol$j: unique symbol;
|
|
4579
4585
|
declare class InvalidArgumentError extends AISDKError {
|
|
4580
|
-
private readonly [symbol$
|
|
4586
|
+
private readonly [symbol$j];
|
|
4581
4587
|
readonly parameter: string;
|
|
4582
4588
|
readonly value: unknown;
|
|
4583
4589
|
constructor({ parameter, value, message, }: {
|
|
@@ -4664,9 +4670,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
4664
4670
|
rawValue: unknown;
|
|
4665
4671
|
};
|
|
4666
4672
|
|
|
4667
|
-
declare const symbol$
|
|
4673
|
+
declare const symbol$i: unique symbol;
|
|
4668
4674
|
declare class InvalidStreamPartError extends AISDKError {
|
|
4669
|
-
private readonly [symbol$
|
|
4675
|
+
private readonly [symbol$i];
|
|
4670
4676
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4671
4677
|
constructor({ chunk, message, }: {
|
|
4672
4678
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4675,9 +4681,9 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
4675
4681
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
4676
4682
|
}
|
|
4677
4683
|
|
|
4678
|
-
declare const symbol$
|
|
4684
|
+
declare const symbol$h: unique symbol;
|
|
4679
4685
|
declare class InvalidToolApprovalError extends AISDKError {
|
|
4680
|
-
private readonly [symbol$
|
|
4686
|
+
private readonly [symbol$h];
|
|
4681
4687
|
readonly approvalId: string;
|
|
4682
4688
|
constructor({ approvalId }: {
|
|
4683
4689
|
approvalId: string;
|
|
@@ -4685,9 +4691,9 @@ declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4685
4691
|
static isInstance(error: unknown): error is InvalidToolApprovalError;
|
|
4686
4692
|
}
|
|
4687
4693
|
|
|
4688
|
-
declare const symbol$
|
|
4694
|
+
declare const symbol$g: unique symbol;
|
|
4689
4695
|
declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4690
|
-
private readonly [symbol$
|
|
4696
|
+
private readonly [symbol$g];
|
|
4691
4697
|
readonly approvalId: string;
|
|
4692
4698
|
readonly toolCallId: string;
|
|
4693
4699
|
constructor({ approvalId, toolCallId, reason, }: {
|
|
@@ -4698,9 +4704,9 @@ declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
4698
4704
|
static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
|
|
4699
4705
|
}
|
|
4700
4706
|
|
|
4701
|
-
declare const symbol$
|
|
4707
|
+
declare const symbol$f: unique symbol;
|
|
4702
4708
|
declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
4703
|
-
private readonly [symbol$
|
|
4709
|
+
private readonly [symbol$f];
|
|
4704
4710
|
readonly toolCallId: string;
|
|
4705
4711
|
readonly approvalId: string;
|
|
4706
4712
|
constructor({ toolCallId, approvalId, }: {
|
|
@@ -4710,9 +4716,9 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
4710
4716
|
static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
|
|
4711
4717
|
}
|
|
4712
4718
|
|
|
4713
|
-
declare const symbol$
|
|
4719
|
+
declare const symbol$e: unique symbol;
|
|
4714
4720
|
declare class MissingToolResultsError extends AISDKError {
|
|
4715
|
-
private readonly [symbol$
|
|
4721
|
+
private readonly [symbol$e];
|
|
4716
4722
|
readonly toolCallIds: string[];
|
|
4717
4723
|
constructor({ toolCallIds }: {
|
|
4718
4724
|
toolCallIds: string[];
|
|
@@ -4720,7 +4726,7 @@ declare class MissingToolResultsError extends AISDKError {
|
|
|
4720
4726
|
static isInstance(error: unknown): error is MissingToolResultsError;
|
|
4721
4727
|
}
|
|
4722
4728
|
|
|
4723
|
-
declare const symbol$
|
|
4729
|
+
declare const symbol$d: unique symbol;
|
|
4724
4730
|
/**
|
|
4725
4731
|
* Thrown when no image could be generated. This can have multiple causes:
|
|
4726
4732
|
*
|
|
@@ -4728,7 +4734,7 @@ declare const symbol$c: unique symbol;
|
|
|
4728
4734
|
* - The model generated a response that could not be parsed.
|
|
4729
4735
|
*/
|
|
4730
4736
|
declare class NoImageGeneratedError extends AISDKError {
|
|
4731
|
-
private readonly [symbol$
|
|
4737
|
+
private readonly [symbol$d];
|
|
4732
4738
|
/**
|
|
4733
4739
|
* The response metadata for each call.
|
|
4734
4740
|
*/
|
|
@@ -4741,7 +4747,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
4741
4747
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
4742
4748
|
}
|
|
4743
4749
|
|
|
4744
|
-
declare const symbol$
|
|
4750
|
+
declare const symbol$c: unique symbol;
|
|
4745
4751
|
/**
|
|
4746
4752
|
* Thrown when no object could be generated. This can have several causes:
|
|
4747
4753
|
*
|
|
@@ -4754,7 +4760,7 @@ declare const symbol$b: unique symbol;
|
|
|
4754
4760
|
* - `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
4761
|
*/
|
|
4756
4762
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
4757
|
-
private readonly [symbol$
|
|
4763
|
+
private readonly [symbol$c];
|
|
4758
4764
|
/**
|
|
4759
4765
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4760
4766
|
*/
|
|
@@ -4782,12 +4788,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
4782
4788
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
4783
4789
|
}
|
|
4784
4790
|
|
|
4785
|
-
declare const symbol$
|
|
4791
|
+
declare const symbol$b: unique symbol;
|
|
4786
4792
|
/**
|
|
4787
4793
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
4788
4794
|
*/
|
|
4789
4795
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
4790
|
-
private readonly [symbol$
|
|
4796
|
+
private readonly [symbol$b];
|
|
4791
4797
|
constructor({ message, cause, }?: {
|
|
4792
4798
|
message?: string;
|
|
4793
4799
|
cause?: Error;
|
|
@@ -4795,12 +4801,12 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
4795
4801
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
4796
4802
|
}
|
|
4797
4803
|
|
|
4798
|
-
declare const symbol$
|
|
4804
|
+
declare const symbol$a: unique symbol;
|
|
4799
4805
|
/**
|
|
4800
4806
|
* Error that is thrown when no speech audio was generated.
|
|
4801
4807
|
*/
|
|
4802
4808
|
declare class NoSpeechGeneratedError extends AISDKError {
|
|
4803
|
-
private readonly [symbol$
|
|
4809
|
+
private readonly [symbol$a];
|
|
4804
4810
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
4805
4811
|
constructor(options: {
|
|
4806
4812
|
responses: Array<SpeechModelResponseMetadata>;
|
|
@@ -4808,12 +4814,12 @@ declare class NoSpeechGeneratedError extends AISDKError {
|
|
|
4808
4814
|
static isInstance(error: unknown): error is NoSpeechGeneratedError;
|
|
4809
4815
|
}
|
|
4810
4816
|
|
|
4811
|
-
declare const symbol$
|
|
4817
|
+
declare const symbol$9: unique symbol;
|
|
4812
4818
|
/**
|
|
4813
4819
|
* Error that is thrown when no transcript was generated.
|
|
4814
4820
|
*/
|
|
4815
4821
|
declare class NoTranscriptGeneratedError extends AISDKError {
|
|
4816
|
-
private readonly [symbol$
|
|
4822
|
+
private readonly [symbol$9];
|
|
4817
4823
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
4818
4824
|
constructor(options: {
|
|
4819
4825
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
@@ -4845,9 +4851,9 @@ type VideoModelResponseMetadata = {
|
|
|
4845
4851
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
4846
4852
|
};
|
|
4847
4853
|
|
|
4848
|
-
declare const symbol$
|
|
4854
|
+
declare const symbol$8: unique symbol;
|
|
4849
4855
|
declare class NoVideoGeneratedError extends AISDKError {
|
|
4850
|
-
private readonly [symbol$
|
|
4856
|
+
private readonly [symbol$8];
|
|
4851
4857
|
readonly responses: Array<VideoModelResponseMetadata>;
|
|
4852
4858
|
constructor({ message, cause, responses, }: {
|
|
4853
4859
|
message?: string;
|
|
@@ -4871,6 +4877,51 @@ declare class NoVideoGeneratedError extends AISDKError {
|
|
|
4871
4877
|
};
|
|
4872
4878
|
}
|
|
4873
4879
|
|
|
4880
|
+
declare const symbol$7: unique symbol;
|
|
4881
|
+
type EnforcedToolChoice = Extract<LanguageModelV3ToolChoice, {
|
|
4882
|
+
type: 'required';
|
|
4883
|
+
} | {
|
|
4884
|
+
type: 'tool';
|
|
4885
|
+
}>;
|
|
4886
|
+
/**
|
|
4887
|
+
* Thrown when a model response does not satisfy an enforced tool choice.
|
|
4888
|
+
*/
|
|
4889
|
+
declare class ToolChoiceViolationError extends AISDKError {
|
|
4890
|
+
private readonly [symbol$7];
|
|
4891
|
+
/**
|
|
4892
|
+
* The tool choice that the model response did not satisfy.
|
|
4893
|
+
*/
|
|
4894
|
+
readonly toolChoice: EnforcedToolChoice;
|
|
4895
|
+
/**
|
|
4896
|
+
* Reason why the model finished generating the response.
|
|
4897
|
+
*/
|
|
4898
|
+
readonly finishReason: FinishReason;
|
|
4899
|
+
/**
|
|
4900
|
+
* The provider that returned the response.
|
|
4901
|
+
*/
|
|
4902
|
+
readonly provider: string;
|
|
4903
|
+
/**
|
|
4904
|
+
* The model that returned the response.
|
|
4905
|
+
*/
|
|
4906
|
+
readonly modelId: string;
|
|
4907
|
+
/**
|
|
4908
|
+
* The normalized content returned by the model.
|
|
4909
|
+
*
|
|
4910
|
+
* This can be inspected to recover a tool call that the provider returned as
|
|
4911
|
+
* text or reasoning instead of a structured tool call.
|
|
4912
|
+
*/
|
|
4913
|
+
readonly content: Array<LanguageModelV3Content>;
|
|
4914
|
+
constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
|
|
4915
|
+
toolChoice: EnforcedToolChoice;
|
|
4916
|
+
finishReason: FinishReason;
|
|
4917
|
+
provider: string;
|
|
4918
|
+
modelId: string;
|
|
4919
|
+
content: Array<LanguageModelV3Content>;
|
|
4920
|
+
message?: string;
|
|
4921
|
+
});
|
|
4922
|
+
static isInstance(error: unknown): error is ToolChoiceViolationError;
|
|
4923
|
+
}
|
|
4924
|
+
|
|
4874
4925
|
declare const symbol$6: unique symbol;
|
|
4875
4926
|
declare class ToolCallRepairError extends AISDKError {
|
|
4876
4927
|
private readonly [symbol$6];
|
|
@@ -6457,4 +6508,4 @@ declare function bindTelemetryIntegration(integration: TelemetryIntegration): Te
|
|
|
6457
6508
|
*/
|
|
6458
6509
|
declare function registerTelemetryIntegration(integration: TelemetryIntegration): void;
|
|
6459
6510
|
|
|
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 };
|
|
6511
|
+
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, 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 };
|
package/dist/index.d.ts
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';
|
|
@@ -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, }: {
|
|
@@ -3346,6 +3346,12 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3346
3346
|
* Callback that is called when all steps are finished and the response is complete.
|
|
3347
3347
|
*/
|
|
3348
3348
|
onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
|
|
3349
|
+
/**
|
|
3350
|
+
* Secret for HMAC-signing tool approval requests. When set, the server
|
|
3351
|
+
* signs each approval request at issuance and verifies the signature when
|
|
3352
|
+
* the approval is replayed, preventing client-forged approvals.
|
|
3353
|
+
*/
|
|
3354
|
+
experimental_toolApprovalSecret?: string | Uint8Array;
|
|
3349
3355
|
/**
|
|
3350
3356
|
* Additional provider-specific options. They are passed through
|
|
3351
3357
|
* to the provider from the AI SDK and enable provider-specific
|
|
@@ -3385,7 +3391,7 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3385
3391
|
* }),
|
|
3386
3392
|
* ```
|
|
3387
3393
|
*/
|
|
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'>>;
|
|
3394
|
+
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
3395
|
};
|
|
3390
3396
|
|
|
3391
3397
|
/**
|
|
@@ -4575,9 +4581,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
4575
4581
|
maxParallelCalls?: number;
|
|
4576
4582
|
}): Promise<EmbedManyResult>;
|
|
4577
4583
|
|
|
4578
|
-
declare const symbol$
|
|
4584
|
+
declare const symbol$j: unique symbol;
|
|
4579
4585
|
declare class InvalidArgumentError extends AISDKError {
|
|
4580
|
-
private readonly [symbol$
|
|
4586
|
+
private readonly [symbol$j];
|
|
4581
4587
|
readonly parameter: string;
|
|
4582
4588
|
readonly value: unknown;
|
|
4583
4589
|
constructor({ parameter, value, message, }: {
|
|
@@ -4664,9 +4670,9 @@ type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
|
|
|
4664
4670
|
rawValue: unknown;
|
|
4665
4671
|
};
|
|
4666
4672
|
|
|
4667
|
-
declare const symbol$
|
|
4673
|
+
declare const symbol$i: unique symbol;
|
|
4668
4674
|
declare class InvalidStreamPartError extends AISDKError {
|
|
4669
|
-
private readonly [symbol$
|
|
4675
|
+
private readonly [symbol$i];
|
|
4670
4676
|
readonly chunk: SingleRequestTextStreamPart<any>;
|
|
4671
4677
|
constructor({ chunk, message, }: {
|
|
4672
4678
|
chunk: SingleRequestTextStreamPart<any>;
|
|
@@ -4675,9 +4681,9 @@ declare class InvalidStreamPartError extends AISDKError {
|
|
|
4675
4681
|
static isInstance(error: unknown): error is InvalidStreamPartError;
|
|
4676
4682
|
}
|
|
4677
4683
|
|
|
4678
|
-
declare const symbol$
|
|
4684
|
+
declare const symbol$h: unique symbol;
|
|
4679
4685
|
declare class InvalidToolApprovalError extends AISDKError {
|
|
4680
|
-
private readonly [symbol$
|
|
4686
|
+
private readonly [symbol$h];
|
|
4681
4687
|
readonly approvalId: string;
|
|
4682
4688
|
constructor({ approvalId }: {
|
|
4683
4689
|
approvalId: string;
|
|
@@ -4685,9 +4691,9 @@ declare class InvalidToolApprovalError extends AISDKError {
|
|
|
4685
4691
|
static isInstance(error: unknown): error is InvalidToolApprovalError;
|
|
4686
4692
|
}
|
|
4687
4693
|
|
|
4688
|
-
declare const symbol$
|
|
4694
|
+
declare const symbol$g: unique symbol;
|
|
4689
4695
|
declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
4690
|
-
private readonly [symbol$
|
|
4696
|
+
private readonly [symbol$g];
|
|
4691
4697
|
readonly approvalId: string;
|
|
4692
4698
|
readonly toolCallId: string;
|
|
4693
4699
|
constructor({ approvalId, toolCallId, reason, }: {
|
|
@@ -4698,9 +4704,9 @@ declare class InvalidToolApprovalSignatureError extends AISDKError {
|
|
|
4698
4704
|
static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
|
|
4699
4705
|
}
|
|
4700
4706
|
|
|
4701
|
-
declare const symbol$
|
|
4707
|
+
declare const symbol$f: unique symbol;
|
|
4702
4708
|
declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
4703
|
-
private readonly [symbol$
|
|
4709
|
+
private readonly [symbol$f];
|
|
4704
4710
|
readonly toolCallId: string;
|
|
4705
4711
|
readonly approvalId: string;
|
|
4706
4712
|
constructor({ toolCallId, approvalId, }: {
|
|
@@ -4710,9 +4716,9 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
|
|
|
4710
4716
|
static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
|
|
4711
4717
|
}
|
|
4712
4718
|
|
|
4713
|
-
declare const symbol$
|
|
4719
|
+
declare const symbol$e: unique symbol;
|
|
4714
4720
|
declare class MissingToolResultsError extends AISDKError {
|
|
4715
|
-
private readonly [symbol$
|
|
4721
|
+
private readonly [symbol$e];
|
|
4716
4722
|
readonly toolCallIds: string[];
|
|
4717
4723
|
constructor({ toolCallIds }: {
|
|
4718
4724
|
toolCallIds: string[];
|
|
@@ -4720,7 +4726,7 @@ declare class MissingToolResultsError extends AISDKError {
|
|
|
4720
4726
|
static isInstance(error: unknown): error is MissingToolResultsError;
|
|
4721
4727
|
}
|
|
4722
4728
|
|
|
4723
|
-
declare const symbol$
|
|
4729
|
+
declare const symbol$d: unique symbol;
|
|
4724
4730
|
/**
|
|
4725
4731
|
* Thrown when no image could be generated. This can have multiple causes:
|
|
4726
4732
|
*
|
|
@@ -4728,7 +4734,7 @@ declare const symbol$c: unique symbol;
|
|
|
4728
4734
|
* - The model generated a response that could not be parsed.
|
|
4729
4735
|
*/
|
|
4730
4736
|
declare class NoImageGeneratedError extends AISDKError {
|
|
4731
|
-
private readonly [symbol$
|
|
4737
|
+
private readonly [symbol$d];
|
|
4732
4738
|
/**
|
|
4733
4739
|
* The response metadata for each call.
|
|
4734
4740
|
*/
|
|
@@ -4741,7 +4747,7 @@ declare class NoImageGeneratedError extends AISDKError {
|
|
|
4741
4747
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
4742
4748
|
}
|
|
4743
4749
|
|
|
4744
|
-
declare const symbol$
|
|
4750
|
+
declare const symbol$c: unique symbol;
|
|
4745
4751
|
/**
|
|
4746
4752
|
* Thrown when no object could be generated. This can have several causes:
|
|
4747
4753
|
*
|
|
@@ -4754,7 +4760,7 @@ declare const symbol$b: unique symbol;
|
|
|
4754
4760
|
* - `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
4761
|
*/
|
|
4756
4762
|
declare class NoObjectGeneratedError extends AISDKError {
|
|
4757
|
-
private readonly [symbol$
|
|
4763
|
+
private readonly [symbol$c];
|
|
4758
4764
|
/**
|
|
4759
4765
|
* The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
|
|
4760
4766
|
*/
|
|
@@ -4782,12 +4788,12 @@ declare class NoObjectGeneratedError extends AISDKError {
|
|
|
4782
4788
|
static isInstance(error: unknown): error is NoObjectGeneratedError;
|
|
4783
4789
|
}
|
|
4784
4790
|
|
|
4785
|
-
declare const symbol$
|
|
4791
|
+
declare const symbol$b: unique symbol;
|
|
4786
4792
|
/**
|
|
4787
4793
|
* Thrown when no LLM output was generated, e.g. because of errors.
|
|
4788
4794
|
*/
|
|
4789
4795
|
declare class NoOutputGeneratedError extends AISDKError {
|
|
4790
|
-
private readonly [symbol$
|
|
4796
|
+
private readonly [symbol$b];
|
|
4791
4797
|
constructor({ message, cause, }?: {
|
|
4792
4798
|
message?: string;
|
|
4793
4799
|
cause?: Error;
|
|
@@ -4795,12 +4801,12 @@ declare class NoOutputGeneratedError extends AISDKError {
|
|
|
4795
4801
|
static isInstance(error: unknown): error is NoOutputGeneratedError;
|
|
4796
4802
|
}
|
|
4797
4803
|
|
|
4798
|
-
declare const symbol$
|
|
4804
|
+
declare const symbol$a: unique symbol;
|
|
4799
4805
|
/**
|
|
4800
4806
|
* Error that is thrown when no speech audio was generated.
|
|
4801
4807
|
*/
|
|
4802
4808
|
declare class NoSpeechGeneratedError extends AISDKError {
|
|
4803
|
-
private readonly [symbol$
|
|
4809
|
+
private readonly [symbol$a];
|
|
4804
4810
|
readonly responses: Array<SpeechModelResponseMetadata>;
|
|
4805
4811
|
constructor(options: {
|
|
4806
4812
|
responses: Array<SpeechModelResponseMetadata>;
|
|
@@ -4808,12 +4814,12 @@ declare class NoSpeechGeneratedError extends AISDKError {
|
|
|
4808
4814
|
static isInstance(error: unknown): error is NoSpeechGeneratedError;
|
|
4809
4815
|
}
|
|
4810
4816
|
|
|
4811
|
-
declare const symbol$
|
|
4817
|
+
declare const symbol$9: unique symbol;
|
|
4812
4818
|
/**
|
|
4813
4819
|
* Error that is thrown when no transcript was generated.
|
|
4814
4820
|
*/
|
|
4815
4821
|
declare class NoTranscriptGeneratedError extends AISDKError {
|
|
4816
|
-
private readonly [symbol$
|
|
4822
|
+
private readonly [symbol$9];
|
|
4817
4823
|
readonly responses: Array<TranscriptionModelResponseMetadata>;
|
|
4818
4824
|
constructor(options: {
|
|
4819
4825
|
responses: Array<TranscriptionModelResponseMetadata>;
|
|
@@ -4845,9 +4851,9 @@ type VideoModelResponseMetadata = {
|
|
|
4845
4851
|
providerMetadata?: SharedV3ProviderMetadata;
|
|
4846
4852
|
};
|
|
4847
4853
|
|
|
4848
|
-
declare const symbol$
|
|
4854
|
+
declare const symbol$8: unique symbol;
|
|
4849
4855
|
declare class NoVideoGeneratedError extends AISDKError {
|
|
4850
|
-
private readonly [symbol$
|
|
4856
|
+
private readonly [symbol$8];
|
|
4851
4857
|
readonly responses: Array<VideoModelResponseMetadata>;
|
|
4852
4858
|
constructor({ message, cause, responses, }: {
|
|
4853
4859
|
message?: string;
|
|
@@ -4871,6 +4877,51 @@ declare class NoVideoGeneratedError extends AISDKError {
|
|
|
4871
4877
|
};
|
|
4872
4878
|
}
|
|
4873
4879
|
|
|
4880
|
+
declare const symbol$7: unique symbol;
|
|
4881
|
+
type EnforcedToolChoice = Extract<LanguageModelV3ToolChoice, {
|
|
4882
|
+
type: 'required';
|
|
4883
|
+
} | {
|
|
4884
|
+
type: 'tool';
|
|
4885
|
+
}>;
|
|
4886
|
+
/**
|
|
4887
|
+
* Thrown when a model response does not satisfy an enforced tool choice.
|
|
4888
|
+
*/
|
|
4889
|
+
declare class ToolChoiceViolationError extends AISDKError {
|
|
4890
|
+
private readonly [symbol$7];
|
|
4891
|
+
/**
|
|
4892
|
+
* The tool choice that the model response did not satisfy.
|
|
4893
|
+
*/
|
|
4894
|
+
readonly toolChoice: EnforcedToolChoice;
|
|
4895
|
+
/**
|
|
4896
|
+
* Reason why the model finished generating the response.
|
|
4897
|
+
*/
|
|
4898
|
+
readonly finishReason: FinishReason;
|
|
4899
|
+
/**
|
|
4900
|
+
* The provider that returned the response.
|
|
4901
|
+
*/
|
|
4902
|
+
readonly provider: string;
|
|
4903
|
+
/**
|
|
4904
|
+
* The model that returned the response.
|
|
4905
|
+
*/
|
|
4906
|
+
readonly modelId: string;
|
|
4907
|
+
/**
|
|
4908
|
+
* The normalized content returned by the model.
|
|
4909
|
+
*
|
|
4910
|
+
* This can be inspected to recover a tool call that the provider returned as
|
|
4911
|
+
* text or reasoning instead of a structured tool call.
|
|
4912
|
+
*/
|
|
4913
|
+
readonly content: Array<LanguageModelV3Content>;
|
|
4914
|
+
constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
|
|
4915
|
+
toolChoice: EnforcedToolChoice;
|
|
4916
|
+
finishReason: FinishReason;
|
|
4917
|
+
provider: string;
|
|
4918
|
+
modelId: string;
|
|
4919
|
+
content: Array<LanguageModelV3Content>;
|
|
4920
|
+
message?: string;
|
|
4921
|
+
});
|
|
4922
|
+
static isInstance(error: unknown): error is ToolChoiceViolationError;
|
|
4923
|
+
}
|
|
4924
|
+
|
|
4874
4925
|
declare const symbol$6: unique symbol;
|
|
4875
4926
|
declare class ToolCallRepairError extends AISDKError {
|
|
4876
4927
|
private readonly [symbol$6];
|
|
@@ -6457,4 +6508,4 @@ declare function bindTelemetryIntegration(integration: TelemetryIntegration): Te
|
|
|
6457
6508
|
*/
|
|
6458
6509
|
declare function registerTelemetryIntegration(integration: TelemetryIntegration): void;
|
|
6459
6510
|
|
|
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 };
|
|
6511
|
+
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, 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 };
|