@ai-sdk/provider-utils 5.0.0-beta.1 → 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,20 @@
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
+
11
+ ## 5.0.0-beta.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [5c2a5a2]
16
+ - @ai-sdk/provider@4.0.0-beta.1
17
+
3
18
  ## 5.0.0-beta.1
4
19
 
5
20
  ### 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
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  DEFAULT_MAX_DOWNLOAD_SIZE: () => DEFAULT_MAX_DOWNLOAD_SIZE,
34
34
  DelayedPromise: () => DelayedPromise,
35
35
  DownloadError: () => DownloadError,
@@ -92,7 +92,7 @@ __export(src_exports, {
92
92
  withoutTrailingSlash: () => withoutTrailingSlash,
93
93
  zodSchema: () => zodSchema
94
94
  });
95
- module.exports = __toCommonJS(src_exports);
95
+ module.exports = __toCommonJS(index_exports);
96
96
 
97
97
  // src/combine-headers.ts
98
98
  function combineHeaders(...headers) {
@@ -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.1" : "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;
@@ -1002,7 +1002,7 @@ function visit(def) {
1002
1002
  }
1003
1003
 
1004
1004
  // src/to-json-schema/zod3-to-json-schema/options.ts
1005
- var ignoreOverride = Symbol(
1005
+ var ignoreOverride = /* @__PURE__ */ Symbol(
1006
1006
  "Let zodToJsonSchema decide on which parser to use"
1007
1007
  );
1008
1008
  var defaultOptions = {
@@ -2180,7 +2180,7 @@ var zod3ToJsonSchema = (schema, options) => {
2180
2180
  };
2181
2181
 
2182
2182
  // src/schema.ts
2183
- var schemaSymbol = Symbol.for("vercel.ai.schema");
2183
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
2184
2184
  function lazySchema(createSchema) {
2185
2185
  let schema;
2186
2186
  return () => {