@ai-sdk/provider-utils 5.0.0-beta.2 → 5.0.0-beta.3

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 5.0.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
8
+ - Updated dependencies [f7d4f01]
9
+ - @ai-sdk/provider@4.0.0-beta.2
10
+
3
11
  ## 5.0.0-beta.2
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -637,6 +637,31 @@ interface ReasoningPart {
637
637
  */
638
638
  providerOptions?: ProviderOptions;
639
639
  }
640
+ /**
641
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
642
+ */
643
+ interface ReasoningFilePart {
644
+ type: 'reasoning-file';
645
+ /**
646
+ * File data. Can either be:
647
+ *
648
+ * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
649
+ * - URL: a URL that points to the file
650
+ */
651
+ data: DataContent | URL;
652
+ /**
653
+ * IANA media type of the file.
654
+ *
655
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
656
+ */
657
+ mediaType: string;
658
+ /**
659
+ * Additional provider-specific metadata. They are passed through
660
+ * to the provider from the AI SDK and enable provider-specific
661
+ * functionality that can be fully encapsulated in the provider.
662
+ */
663
+ providerOptions?: ProviderOptions;
664
+ }
640
665
  /**
641
666
  * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
642
667
  */
@@ -893,7 +918,7 @@ type AssistantModelMessage = {
893
918
  * Content of an assistant message.
894
919
  * It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
895
920
  */
896
- type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
921
+ type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ReasoningFilePart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
897
922
 
898
923
  /**
899
924
  * A system message. It can contain system information.
@@ -1430,4 +1455,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1430
1455
  */
1431
1456
  type ToolCallOptions = ToolExecutionOptions;
1432
1457
 
1433
- export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1458
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.d.ts CHANGED
@@ -637,6 +637,31 @@ interface ReasoningPart {
637
637
  */
638
638
  providerOptions?: ProviderOptions;
639
639
  }
640
+ /**
641
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
642
+ */
643
+ interface ReasoningFilePart {
644
+ type: 'reasoning-file';
645
+ /**
646
+ * File data. Can either be:
647
+ *
648
+ * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
649
+ * - URL: a URL that points to the file
650
+ */
651
+ data: DataContent | URL;
652
+ /**
653
+ * IANA media type of the file.
654
+ *
655
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
656
+ */
657
+ mediaType: string;
658
+ /**
659
+ * Additional provider-specific metadata. They are passed through
660
+ * to the provider from the AI SDK and enable provider-specific
661
+ * functionality that can be fully encapsulated in the provider.
662
+ */
663
+ providerOptions?: ProviderOptions;
664
+ }
640
665
  /**
641
666
  * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
642
667
  */
@@ -893,7 +918,7 @@ type AssistantModelMessage = {
893
918
  * Content of an assistant message.
894
919
  * It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
895
920
  */
896
- type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
921
+ type AssistantContent = string | Array<TextPart | FilePart | ReasoningPart | ReasoningFilePart | ToolCallPart | ToolResultPart | ToolApprovalRequest>;
897
922
 
898
923
  /**
899
924
  * A system message. It can contain system information.
@@ -1430,4 +1455,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1430
1455
  */
1431
1456
  type ToolCallOptions = ToolExecutionOptions;
1432
1457
 
1433
- export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1458
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.js CHANGED
@@ -675,7 +675,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
675
675
  }
676
676
 
677
677
  // src/version.ts
678
- var VERSION = true ? "5.0.0-beta.2" : "0.0.0-test";
678
+ var VERSION = true ? "5.0.0-beta.3" : "0.0.0-test";
679
679
 
680
680
  // src/get-from-api.ts
681
681
  var getOriginalFetch = () => globalThis.fetch;
package/dist/index.mjs CHANGED
@@ -579,7 +579,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
579
579
  }
580
580
 
581
581
  // src/version.ts
582
- var VERSION = true ? "5.0.0-beta.2" : "0.0.0-test";
582
+ var VERSION = true ? "5.0.0-beta.3" : "0.0.0-test";
583
583
 
584
584
  // src/get-from-api.ts
585
585
  var getOriginalFetch = () => globalThis.fetch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@standard-schema/spec": "^1.1.0",
37
37
  "eventsource-parser": "^3.0.6",
38
- "@ai-sdk/provider": "4.0.0-beta.1"
38
+ "@ai-sdk/provider": "4.0.0-beta.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "20.17.24",
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  FilePart,
3
+ ReasoningFilePart,
3
4
  ReasoningPart,
4
5
  TextPart,
5
6
  ToolCallPart,
@@ -33,6 +34,7 @@ export type AssistantContent =
33
34
  | TextPart
34
35
  | FilePart
35
36
  | ReasoningPart
37
+ | ReasoningFilePart
36
38
  | ToolCallPart
37
39
  | ToolResultPart
38
40
  | ToolApprovalRequest
@@ -103,6 +103,35 @@ export interface ReasoningPart {
103
103
  providerOptions?: ProviderOptions;
104
104
  }
105
105
 
106
+ /**
107
+ * Reasoning file content part of a prompt. It contains a file generated as part of reasoning.
108
+ */
109
+ export interface ReasoningFilePart {
110
+ type: 'reasoning-file';
111
+
112
+ /**
113
+ * File data. Can either be:
114
+ *
115
+ * - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
116
+ * - URL: a URL that points to the file
117
+ */
118
+ data: DataContent | URL;
119
+
120
+ /**
121
+ * IANA media type of the file.
122
+ *
123
+ * @see https://www.iana.org/assignments/media-types/media-types.xhtml
124
+ */
125
+ mediaType: string;
126
+
127
+ /**
128
+ * Additional provider-specific metadata. They are passed through
129
+ * to the provider from the AI SDK and enable provider-specific
130
+ * functionality that can be fully encapsulated in the provider.
131
+ */
132
+ providerOptions?: ProviderOptions;
133
+ }
134
+
106
135
  /**
107
136
  * Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
108
137
  */
@@ -5,6 +5,7 @@ export type {
5
5
  export type {
6
6
  FilePart,
7
7
  ImagePart,
8
+ ReasoningFilePart,
8
9
  ReasoningPart,
9
10
  TextPart,
10
11
  ToolCallPart,