ai 7.0.79 → 7.0.82

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/index.d.ts +95 -35
  3. package/dist/index.js +601 -418
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.d.ts +9 -1
  6. package/dist/internal/index.js +4 -2
  7. package/dist/internal/index.js.map +1 -1
  8. package/dist/test/index.d.ts +4 -1
  9. package/dist/test/index.js +4 -0
  10. package/dist/test/index.js.map +1 -1
  11. package/docs/03-agents/06-policy-tool-approvals.mdx +1 -1
  12. package/docs/03-agents/06-tool-approvals.mdx +6 -0
  13. package/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +6 -4
  14. package/docs/03-ai-sdk-core/50-error-handling.mdx +17 -2
  15. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +6 -0
  16. package/docs/04-ai-sdk-ui/50-stream-protocol.mdx +2 -2
  17. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +1 -1
  18. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +5 -4
  19. package/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +6 -2
  20. package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +1 -1
  21. package/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +2 -2
  22. package/docs/07-reference/04-ai-sdk-workflow/03-generate-video.mdx +157 -0
  23. package/docs/07-reference/04-ai-sdk-workflow/index.mdx +6 -0
  24. package/docs/07-reference/05-ai-sdk-errors/ai-stream-provider-error.mdx +52 -0
  25. package/docs/07-reference/05-ai-sdk-errors/index.mdx +1 -0
  26. package/package.json +14 -3
  27. package/src/embed/embed-many.ts +78 -8
  28. package/src/error/index.ts +1 -0
  29. package/src/error/stream-provider-error.ts +78 -0
  30. package/src/generate-text/execute-tools-from-stream.ts +3 -0
  31. package/src/generate-text/generate-text-result.ts +2 -1
  32. package/src/generate-text/generate-text.ts +6 -3
  33. package/src/generate-text/stream-language-model-call.ts +8 -0
  34. package/src/generate-text/to-response-messages.ts +1 -0
  35. package/src/generate-text/tool-approval-configuration.ts +5 -1
  36. package/src/generate-text/tool-approval-request-output.ts +5 -0
  37. package/src/middleware/wrap-embedding-model.ts +11 -2
  38. package/src/model/get-embedding-model-max-input-bytes-per-call.ts +15 -0
  39. package/src/prompt/content-part.ts +1 -0
  40. package/src/prompt/normalize-stream-provider-error.ts +131 -0
  41. package/src/test/mock-embedding-model-v4.ts +9 -0
  42. package/src/ui/convert-to-model-messages.ts +3 -0
  43. package/src/ui/process-ui-message-stream.ts +6 -0
  44. package/src/ui/ui-messages.ts +10 -0
  45. package/src/ui/validate-ui-messages.ts +10 -0
  46. package/src/ui-message-stream/to-ui-message-chunk.ts +1 -0
  47. package/src/ui-message-stream/ui-message-chunks.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.82
4
+
5
+ ### Patch Changes
6
+
7
+ - 3e125ba: Allow manual tool approval statuses to include a reason and preserve it across
8
+ core, model, and UI approval requests. OPA `requires-approval` decisions now
9
+ surface their reason to human approvers. UI request chunks serialize the
10
+ optional `reason`, while UI messages retain it as `approval.requestReason`
11
+ separately from an approver's response `reason`.
12
+ - Updated dependencies [0e7994c]
13
+ - Updated dependencies [3e125ba]
14
+ - @ai-sdk/gateway@4.0.67
15
+ - @ai-sdk/provider-utils@5.0.32
16
+
17
+ ## 7.0.81
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [81bebaf]
22
+ - @ai-sdk/gateway@4.0.66
23
+
24
+ ## 7.0.80
25
+
26
+ ### Patch Changes
27
+
28
+ - 35841f5: feat: normalize mid-stream provider error events across supported providers into public StreamProviderError instances and preserve provider-owned type, code, status, retry, and raw payload metadata
29
+ - d2f3353: Split OpenAI and Azure OpenAI embedding requests by a conservative UTF-8 byte budget derived from their aggregate token limit, in addition to input count limits.
30
+ - eed7950: Expose structured output parsing diagnostics from `generateText` when generation stops because of the output token limit.
31
+ - Updated dependencies [80227cf]
32
+ - Updated dependencies [a9782e1]
33
+ - Updated dependencies [5533946]
34
+ - Updated dependencies [35841f5]
35
+ - Updated dependencies [d2f3353]
36
+ - @ai-sdk/gateway@4.0.65
37
+ - @ai-sdk/provider-utils@5.0.31
38
+
3
39
  ## 7.0.79
4
40
 
5
41
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1179,6 +1179,10 @@ type ToolApprovalRequestOutput<TOOLS extends ToolSet> = {
1179
1179
  * Tool call that the approval request is for.
1180
1180
  */
1181
1181
  toolCall: TypedToolCall<TOOLS>;
1182
+ /**
1183
+ * Reason why the tool call requires approval.
1184
+ */
1185
+ reason?: string;
1182
1186
  /**
1183
1187
  * Flag indicating whether the tool was automatically approved or denied.
1184
1188
  *
@@ -2032,6 +2036,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
2032
2036
  approval: {
2033
2037
  id: string;
2034
2038
  approved?: never;
2039
+ requestReason?: string;
2035
2040
  reason?: never;
2036
2041
  isAutomatic?: boolean;
2037
2042
  signature?: string;
@@ -2045,6 +2050,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
2045
2050
  approval: {
2046
2051
  id: string;
2047
2052
  approved: boolean;
2053
+ requestReason?: string;
2048
2054
  reason?: string;
2049
2055
  isAutomatic?: boolean;
2050
2056
  signature?: string;
@@ -2060,6 +2066,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
2060
2066
  approval?: {
2061
2067
  id: string;
2062
2068
  approved: true;
2069
+ requestReason?: string;
2063
2070
  reason?: string;
2064
2071
  isAutomatic?: boolean;
2065
2072
  signature?: string;
@@ -2075,6 +2082,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
2075
2082
  approval?: {
2076
2083
  id: string;
2077
2084
  approved: true;
2085
+ requestReason?: string;
2078
2086
  reason?: string;
2079
2087
  isAutomatic?: boolean;
2080
2088
  signature?: string;
@@ -2088,6 +2096,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
2088
2096
  approval: {
2089
2097
  id: string;
2090
2098
  approved: false;
2099
+ requestReason?: string;
2091
2100
  reason?: string;
2092
2101
  isAutomatic?: boolean;
2093
2102
  signature?: string;
@@ -2137,6 +2146,7 @@ type DynamicToolUIPart = {
2137
2146
  approval: {
2138
2147
  id: string;
2139
2148
  approved?: never;
2149
+ requestReason?: string;
2140
2150
  reason?: never;
2141
2151
  isAutomatic?: boolean;
2142
2152
  signature?: string;
@@ -2150,6 +2160,7 @@ type DynamicToolUIPart = {
2150
2160
  approval: {
2151
2161
  id: string;
2152
2162
  approved: boolean;
2163
+ requestReason?: string;
2153
2164
  reason?: string;
2154
2165
  isAutomatic?: boolean;
2155
2166
  signature?: string;
@@ -2165,6 +2176,7 @@ type DynamicToolUIPart = {
2165
2176
  approval?: {
2166
2177
  id: string;
2167
2178
  approved: true;
2179
+ requestReason?: string;
2168
2180
  reason?: string;
2169
2181
  isAutomatic?: boolean;
2170
2182
  signature?: string;
@@ -2179,6 +2191,7 @@ type DynamicToolUIPart = {
2179
2191
  approval?: {
2180
2192
  id: string;
2181
2193
  approved: true;
2194
+ requestReason?: string;
2182
2195
  reason?: string;
2183
2196
  isAutomatic?: boolean;
2184
2197
  signature?: string;
@@ -2192,6 +2205,7 @@ type DynamicToolUIPart = {
2192
2205
  approval: {
2193
2206
  id: string;
2194
2207
  approved: false;
2208
+ requestReason?: string;
2195
2209
  reason?: string;
2196
2210
  isAutomatic?: boolean;
2197
2211
  signature?: string;
@@ -2334,6 +2348,7 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
2334
2348
  type: 'tool-approval-request';
2335
2349
  approvalId: string;
2336
2350
  toolCallId: string;
2351
+ reason?: string;
2337
2352
  isAutomatic?: boolean;
2338
2353
  signature?: string;
2339
2354
  } | {
@@ -2956,6 +2971,8 @@ type TextStreamPart<TOOLS extends ToolSet> = TextStreamTextStartPart | TextStrea
2956
2971
  * - 'user-approval': The tool requires user approval.
2957
2972
  *
2958
2973
  * In addition to the string statuses, you can also use object statuses with a reason property.
2974
+ * For approved and denied statuses, the reason is emitted on the approval response.
2975
+ * For user-approval statuses, the reason is emitted on the approval request so it can be shown to the approver.
2959
2976
  *
2960
2977
  * `undefined` is treated as the `not-applicable` status.
2961
2978
  */
@@ -2970,7 +2987,7 @@ type ToolApprovalStatus = undefined | 'not-applicable' | 'approved' | 'denied' |
2970
2987
  reason?: string;
2971
2988
  } | {
2972
2989
  type: 'user-approval';
2973
- reason?: never;
2990
+ reason?: string;
2974
2991
  };
2975
2992
  /**
2976
2993
  * Function that is called to determine if the tool needs approval before it can be executed.
@@ -3025,6 +3042,8 @@ type GenericToolApprovalFunction<TOOLS extends ToolSet, TOOLS_CONTEXT extends In
3025
3042
  * - 'user-approval': The tool requires user approval.
3026
3043
  *
3027
3044
  * In addition to the string statuses, you can also use object statuses with a reason property.
3045
+ * For approved and denied statuses, the reason is emitted on the approval response.
3046
+ * For user-approval statuses, the reason is emitted on the approval request so it can be shown to the approver.
3028
3047
  */
3029
3048
  type ToolApprovalConfiguration<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Context | unknown | never> = GenericToolApprovalFunction<TOOLS, InferToolSetContext<TOOLS>, RUNTIME_CONTEXT> | {
3030
3049
  [key in keyof TOOLS]?: ToolApprovalStatus | SingleToolApprovalFunction<InferToolInput<TOOLS[key]>, InferToolContext<TOOLS[key]>, RUNTIME_CONTEXT>;
@@ -3037,9 +3056,9 @@ type Experimental_ToolCallers<TOOLS extends ToolSet> = {
3037
3056
  [NAME in keyof TOOLS]?: ReadonlyArray<'AI_SDK_DIRECT_TOOL_CALL' | ToolCallerName<TOOLS>>;
3038
3057
  };
3039
3058
 
3040
- declare const symbol$l: unique symbol;
3059
+ declare const symbol$m: unique symbol;
3041
3060
  declare class InvalidToolInputError extends AISDKError {
3042
- private readonly [symbol$l];
3061
+ private readonly [symbol$m];
3043
3062
  readonly toolName: string;
3044
3063
  readonly toolInput: string;
3045
3064
  constructor({ toolInput, toolName, cause, message, }: {
@@ -3051,9 +3070,9 @@ declare class InvalidToolInputError extends AISDKError {
3051
3070
  static isInstance(error: unknown): error is InvalidToolInputError;
3052
3071
  }
3053
3072
 
3054
- declare const symbol$k: unique symbol;
3073
+ declare const symbol$l: unique symbol;
3055
3074
  declare class NoSuchToolError extends AISDKError {
3056
- private readonly [symbol$k];
3075
+ private readonly [symbol$l];
3057
3076
  readonly toolName: string;
3058
3077
  readonly availableTools: string[] | undefined;
3059
3078
  constructor({ toolName, availableTools, message, }: {
@@ -4477,7 +4496,8 @@ interface GenerateTextResult<TOOLS extends ToolSet, RUNTIME_CONTEXT extends Cont
4477
4496
  * The generated output according to the `output` specification.
4478
4497
  *
4479
4498
  * @throws {NoOutputGeneratedError} When no output is available, for example
4480
- * when the final step does not finish with a `stop` reason.
4499
+ * when the final step finishes with a `tool-calls` reason, or when it
4500
+ * contains no text and does not finish with a `stop` reason.
4481
4501
  */
4482
4502
  readonly output: InferCompleteOutput<OUTPUT>;
4483
4503
  }
@@ -6405,8 +6425,9 @@ interface EmbedManyResult {
6405
6425
  * Embed several values using an embedding model. The type of the value is defined
6406
6426
  * by the embedding model.
6407
6427
  *
6408
- * `embedMany` automatically splits large requests into smaller chunks if the model
6409
- * has a limit on how many embeddings can be generated in a single call.
6428
+ * `embedMany` automatically splits large requests into smaller chunks when the
6429
+ * model has a limit on either the number of embeddings or the UTF-8 input bytes
6430
+ * that can be processed in a single call.
6410
6431
  *
6411
6432
  * @param model - The embedding model to use.
6412
6433
  * @param values - The values that should be embedded.
@@ -6503,9 +6524,9 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
6503
6524
  };
6504
6525
  }): Promise<EmbedManyResult>;
6505
6526
 
6506
- declare const symbol$j: unique symbol;
6527
+ declare const symbol$k: unique symbol;
6507
6528
  declare class InvalidArgumentError extends AISDKError {
6508
- private readonly [symbol$j];
6529
+ private readonly [symbol$k];
6509
6530
  readonly parameter: string;
6510
6531
  readonly value: unknown;
6511
6532
  constructor({ parameter, value, message, }: {
@@ -6650,9 +6671,9 @@ declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends O
6650
6671
  };
6651
6672
  }>;
6652
6673
 
6653
- declare const symbol$i: unique symbol;
6674
+ declare const symbol$j: unique symbol;
6654
6675
  declare class InvalidStreamPartError extends AISDKError {
6655
- private readonly [symbol$i];
6676
+ private readonly [symbol$j];
6656
6677
  readonly chunk: LanguageModelStreamPart<any>;
6657
6678
  constructor({ chunk, message, }: {
6658
6679
  chunk: LanguageModelStreamPart<any>;
@@ -6661,9 +6682,9 @@ declare class InvalidStreamPartError extends AISDKError {
6661
6682
  static isInstance(error: unknown): error is InvalidStreamPartError;
6662
6683
  }
6663
6684
 
6664
- declare const symbol$h: unique symbol;
6685
+ declare const symbol$i: unique symbol;
6665
6686
  declare class InvalidToolApprovalError extends AISDKError {
6666
- private readonly [symbol$h];
6687
+ private readonly [symbol$i];
6667
6688
  readonly approvalId: string;
6668
6689
  constructor({ approvalId }: {
6669
6690
  approvalId: string;
@@ -6671,9 +6692,9 @@ declare class InvalidToolApprovalError extends AISDKError {
6671
6692
  static isInstance(error: unknown): error is InvalidToolApprovalError;
6672
6693
  }
6673
6694
 
6674
- declare const symbol$g: unique symbol;
6695
+ declare const symbol$h: unique symbol;
6675
6696
  declare class InvalidToolApprovalSignatureError extends AISDKError {
6676
- private readonly [symbol$g];
6697
+ private readonly [symbol$h];
6677
6698
  readonly approvalId: string;
6678
6699
  readonly toolCallId: string;
6679
6700
  constructor({ approvalId, toolCallId, reason, }: {
@@ -6684,9 +6705,9 @@ declare class InvalidToolApprovalSignatureError extends AISDKError {
6684
6705
  static isInstance(error: unknown): error is InvalidToolApprovalSignatureError;
6685
6706
  }
6686
6707
 
6687
- declare const symbol$f: unique symbol;
6708
+ declare const symbol$g: unique symbol;
6688
6709
  declare class ToolCallNotFoundForApprovalError extends AISDKError {
6689
- private readonly [symbol$f];
6710
+ private readonly [symbol$g];
6690
6711
  readonly toolCallId: string;
6691
6712
  readonly approvalId: string;
6692
6713
  constructor({ toolCallId, approvalId, }: {
@@ -6696,9 +6717,9 @@ declare class ToolCallNotFoundForApprovalError extends AISDKError {
6696
6717
  static isInstance(error: unknown): error is ToolCallNotFoundForApprovalError;
6697
6718
  }
6698
6719
 
6699
- declare const symbol$e: unique symbol;
6720
+ declare const symbol$f: unique symbol;
6700
6721
  declare class MissingToolResultsError extends AISDKError {
6701
- private readonly [symbol$e];
6722
+ private readonly [symbol$f];
6702
6723
  readonly toolCallIds: string[];
6703
6724
  constructor({ toolCallIds }: {
6704
6725
  toolCallIds: string[];
@@ -6706,7 +6727,7 @@ declare class MissingToolResultsError extends AISDKError {
6706
6727
  static isInstance(error: unknown): error is MissingToolResultsError;
6707
6728
  }
6708
6729
 
6709
- declare const symbol$d: unique symbol;
6730
+ declare const symbol$e: unique symbol;
6710
6731
  /**
6711
6732
  * Thrown when no image could be generated. This can have multiple causes:
6712
6733
  *
@@ -6714,7 +6735,7 @@ declare const symbol$d: unique symbol;
6714
6735
  * - The model generated a response that could not be parsed.
6715
6736
  */
6716
6737
  declare class NoImageGeneratedError extends AISDKError {
6717
- private readonly [symbol$d];
6738
+ private readonly [symbol$e];
6718
6739
  /**
6719
6740
  * The response metadata for each call.
6720
6741
  */
@@ -6727,7 +6748,7 @@ declare class NoImageGeneratedError extends AISDKError {
6727
6748
  static isInstance(error: unknown): error is NoImageGeneratedError;
6728
6749
  }
6729
6750
 
6730
- declare const symbol$c: unique symbol;
6751
+ declare const symbol$d: unique symbol;
6731
6752
  /**
6732
6753
  * Thrown when no object could be generated. This can have several causes:
6733
6754
  *
@@ -6740,7 +6761,7 @@ declare const symbol$c: unique symbol;
6740
6761
  * - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
6741
6762
  */
6742
6763
  declare class NoObjectGeneratedError extends AISDKError {
6743
- private readonly [symbol$c];
6764
+ private readonly [symbol$d];
6744
6765
  /**
6745
6766
  * The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
6746
6767
  */
@@ -6768,12 +6789,12 @@ declare class NoObjectGeneratedError extends AISDKError {
6768
6789
  static isInstance(error: unknown): error is NoObjectGeneratedError;
6769
6790
  }
6770
6791
 
6771
- declare const symbol$b: unique symbol;
6792
+ declare const symbol$c: unique symbol;
6772
6793
  /**
6773
6794
  * Thrown when no LLM output was generated, e.g. because of errors.
6774
6795
  */
6775
6796
  declare class NoOutputGeneratedError extends AISDKError {
6776
- private readonly [symbol$b];
6797
+ private readonly [symbol$c];
6777
6798
  constructor({ message, cause, }?: {
6778
6799
  message?: string;
6779
6800
  cause?: Error;
@@ -6781,12 +6802,12 @@ declare class NoOutputGeneratedError extends AISDKError {
6781
6802
  static isInstance(error: unknown): error is NoOutputGeneratedError;
6782
6803
  }
6783
6804
 
6784
- declare const symbol$a: unique symbol;
6805
+ declare const symbol$b: unique symbol;
6785
6806
  /**
6786
6807
  * Error that is thrown when no speech audio was generated.
6787
6808
  */
6788
6809
  declare class NoSpeechGeneratedError extends AISDKError {
6789
- private readonly [symbol$a];
6810
+ private readonly [symbol$b];
6790
6811
  readonly responses: Array<SpeechModelResponseMetadata>;
6791
6812
  constructor(options: {
6792
6813
  responses: Array<SpeechModelResponseMetadata>;
@@ -6794,12 +6815,12 @@ declare class NoSpeechGeneratedError extends AISDKError {
6794
6815
  static isInstance(error: unknown): error is NoSpeechGeneratedError;
6795
6816
  }
6796
6817
 
6797
- declare const symbol$9: unique symbol;
6818
+ declare const symbol$a: unique symbol;
6798
6819
  /**
6799
6820
  * Error that is thrown when no transcript was generated.
6800
6821
  */
6801
6822
  declare class NoTranscriptGeneratedError extends AISDKError {
6802
- private readonly [symbol$9];
6823
+ private readonly [symbol$a];
6803
6824
  readonly responses: Array<TranscriptionModelResponseMetadata>;
6804
6825
  constructor(options: {
6805
6826
  responses: Array<TranscriptionModelResponseMetadata>;
@@ -6828,12 +6849,12 @@ type SpeechTranslationModelResponseMetadata = {
6828
6849
  headers?: Record<string, string>;
6829
6850
  };
6830
6851
 
6831
- declare const symbol$8: unique symbol;
6852
+ declare const symbol$9: unique symbol;
6832
6853
  /**
6833
6854
  * Error that is thrown when no translation was generated.
6834
6855
  */
6835
6856
  declare class NoTranslationGeneratedError extends AISDKError {
6836
- private readonly [symbol$8];
6857
+ private readonly [symbol$9];
6837
6858
  readonly response: SpeechTranslationModelResponseMetadata;
6838
6859
  constructor(options: {
6839
6860
  response: SpeechTranslationModelResponseMetadata;
@@ -6865,9 +6886,9 @@ type VideoModelResponseMetadata = {
6865
6886
  providerMetadata?: SharedV4ProviderMetadata;
6866
6887
  };
6867
6888
 
6868
- declare const symbol$7: unique symbol;
6889
+ declare const symbol$8: unique symbol;
6869
6890
  declare class NoVideoGeneratedError extends AISDKError {
6870
- private readonly [symbol$7];
6891
+ private readonly [symbol$8];
6871
6892
  readonly responses: Array<VideoModelResponseMetadata>;
6872
6893
  constructor({ message, cause, responses, }: {
6873
6894
  message?: string;
@@ -6891,6 +6912,45 @@ declare class NoVideoGeneratedError extends AISDKError {
6891
6912
  };
6892
6913
  }
6893
6914
 
6915
+ declare const symbol$7: unique symbol;
6916
+ /**
6917
+ * Error reported by a provider after a model response stream has started.
6918
+ */
6919
+ declare class StreamProviderError extends AISDKError {
6920
+ private readonly [symbol$7];
6921
+ /**
6922
+ * Provider-defined error type, when supplied by the provider.
6923
+ */
6924
+ readonly type?: string;
6925
+ /**
6926
+ * Provider-defined error code, when supplied by the provider.
6927
+ */
6928
+ readonly code?: string | number;
6929
+ /**
6930
+ * HTTP-equivalent status code, when supplied by or inferable from the
6931
+ * provider error metadata.
6932
+ */
6933
+ readonly statusCode?: number;
6934
+ /**
6935
+ * Whether retrying the model call may succeed.
6936
+ */
6937
+ readonly isRetryable: boolean;
6938
+ /**
6939
+ * Original provider error payload.
6940
+ */
6941
+ readonly data?: unknown;
6942
+ constructor({ message, type, code, statusCode, isRetryable, data, cause, }: {
6943
+ message: string;
6944
+ type?: string;
6945
+ code?: string | number;
6946
+ statusCode?: number;
6947
+ isRetryable?: boolean;
6948
+ data?: unknown;
6949
+ cause?: unknown;
6950
+ });
6951
+ static isInstance(error: unknown): error is StreamProviderError;
6952
+ }
6953
+
6894
6954
  declare const symbol$6: unique symbol;
6895
6955
  declare class ToolCallRepairError extends AISDKError {
6896
6956
  private readonly [symbol$6];
@@ -9445,4 +9505,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
9445
9505
  files: UploadSkillFile[];
9446
9506
  }): Promise<UploadSkillResult>;
9447
9507
 
9448
- export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, BatchError as Experimental_BatchError, BatchLanguageModel as Experimental_BatchLanguageModel, BatchOperationOptions as Experimental_BatchOperationOptions, BatchReference as Experimental_BatchReference, BatchStatus as Experimental_BatchStatus, DownloadFunction as Experimental_DownloadFunction, Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, StartTextBatchOptions as Experimental_StartTextBatchOptions, StartTextBatchResult as Experimental_StartTextBatchResult, StreamTranslationResult as Experimental_StreamTranslationResult, TextBatch as Experimental_TextBatch, TextBatchGenerationResult as Experimental_TextBatchGenerationResult, TextBatchItemResult as Experimental_TextBatchItemResult, TextBatchReference as Experimental_TextBatchReference, TextBatchRequest as Experimental_TextBatchRequest, Experimental_ToolCallers, Experimental_TranscriptionResult, TranslationStreamPart as Experimental_TranslationStreamPart, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, GetVideoStatusResult, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StartVideoResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, resampleAudio as experimental_resampleAudio, startTextBatch as experimental_startTextBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
9508
+ export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, BatchError as Experimental_BatchError, BatchLanguageModel as Experimental_BatchLanguageModel, BatchOperationOptions as Experimental_BatchOperationOptions, BatchReference as Experimental_BatchReference, BatchStatus as Experimental_BatchStatus, DownloadFunction as Experimental_DownloadFunction, Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, StartTextBatchOptions as Experimental_StartTextBatchOptions, StartTextBatchResult as Experimental_StartTextBatchResult, StreamTranslationResult as Experimental_StreamTranslationResult, TextBatch as Experimental_TextBatch, TextBatchGenerationResult as Experimental_TextBatchGenerationResult, TextBatchItemResult as Experimental_TextBatchItemResult, TextBatchReference as Experimental_TextBatchReference, TextBatchRequest as Experimental_TextBatchRequest, Experimental_ToolCallers, Experimental_TranscriptionResult, TranslationStreamPart as Experimental_TranslationStreamPart, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, GetVideoStatusResult, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StartVideoResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamProviderError, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, StreamTranscriptionResult, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TranscriptionStreamPart, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, resampleAudio as experimental_resampleAudio, startTextBatch as experimental_startTextBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };