@ai-sdk/provider-utils 4.0.0-beta.18 → 4.0.0-beta.20

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,19 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.0-beta.20
4
+
5
+ ### Patch Changes
6
+
7
+ - fca786b: feat(provider-utils): add MaybePromiseLike type
8
+
9
+ ## 4.0.0-beta.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 3794514: feat: flexible tool output content support
14
+ - Updated dependencies [3794514]
15
+ - @ai-sdk/provider@3.0.0-beta.8
16
+
3
17
  ## 4.0.0-beta.18
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, LanguageModelV3ToolResultOutput, LanguageModelV3ToolResultPart } from '@ai-sdk/provider';
1
+ import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
2
2
  import * as z4 from 'zod/v4';
3
3
  import { ZodType } from 'zod/v4';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -232,6 +232,15 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
232
232
 
233
233
  declare function isAbortError(error: unknown): error is Error;
234
234
 
235
+ /**
236
+ * Type guard that checks whether a value is not `null` or `undefined`.
237
+ *
238
+ * @template T - The type of the value to check.
239
+ * @param value - The value to check.
240
+ * @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
241
+ */
242
+ declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
243
+
235
244
  /**
236
245
  * Checks if the given URL is supported natively by the model.
237
246
  *
@@ -284,6 +293,8 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
284
293
  description: string;
285
294
  }): string;
286
295
 
296
+ type MaybePromiseLike<T> = T | PromiseLike<T>;
297
+
287
298
  /**
288
299
  * Maps a media type to its corresponding file extension.
289
300
  * It was originally introduced to set a filename for audio file uploads
@@ -352,6 +363,11 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
352
363
  responseHeaders?: Record<string, string>;
353
364
  }>;
354
365
 
366
+ /**
367
+ Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
368
+ */
369
+ type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
370
+
355
371
  /**
356
372
  Additional provider-specific options.
357
373
 
@@ -360,11 +376,6 @@ provider-specific functionality that can be fully encapsulated in the provider.
360
376
  */
361
377
  type ProviderOptions = SharedV3ProviderOptions;
362
378
 
363
- /**
364
- Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
365
- */
366
- type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
367
-
368
379
  /**
369
380
  Text content part of a prompt. It contains a string of text.
370
381
  */
@@ -495,7 +506,7 @@ interface ToolResultPart {
495
506
  /**
496
507
  Result of the tool call. This is a JSON-serializable object.
497
508
  */
498
- output: LanguageModelV3ToolResultOutput;
509
+ output: ToolResultOutput;
499
510
  /**
500
511
  Additional provider-specific metadata. They are passed through
501
512
  to the provider from the AI SDK and enable provider-specific
@@ -503,6 +514,177 @@ interface ToolResultPart {
503
514
  */
504
515
  providerOptions?: ProviderOptions;
505
516
  }
517
+ /**
518
+ * Output of a tool result.
519
+ */
520
+ type ToolResultOutput = {
521
+ /**
522
+ * Text tool output that should be directly sent to the API.
523
+ */
524
+ type: 'text';
525
+ value: string;
526
+ /**
527
+ * Provider-specific options.
528
+ */
529
+ providerOptions?: ProviderOptions;
530
+ } | {
531
+ type: 'json';
532
+ value: JSONValue;
533
+ /**
534
+ * Provider-specific options.
535
+ */
536
+ providerOptions?: ProviderOptions;
537
+ } | {
538
+ /**
539
+ * Type when the user has denied the execution of the tool call.
540
+ */
541
+ type: 'execution-denied';
542
+ /**
543
+ * Optional reason for the execution denial.
544
+ */
545
+ reason?: string;
546
+ /**
547
+ * Provider-specific options.
548
+ */
549
+ providerOptions?: ProviderOptions;
550
+ } | {
551
+ type: 'error-text';
552
+ value: string;
553
+ /**
554
+ * Provider-specific options.
555
+ */
556
+ providerOptions?: ProviderOptions;
557
+ } | {
558
+ type: 'error-json';
559
+ value: JSONValue;
560
+ /**
561
+ * Provider-specific options.
562
+ */
563
+ providerOptions?: ProviderOptions;
564
+ } | {
565
+ type: 'content';
566
+ value: Array<{
567
+ type: 'text';
568
+ /**
569
+ Text content.
570
+ */
571
+ text: string;
572
+ /**
573
+ * Provider-specific options.
574
+ */
575
+ providerOptions?: ProviderOptions;
576
+ } | {
577
+ /**
578
+ * @deprecated Use image-data or file-data instead.
579
+ */
580
+ type: 'media';
581
+ data: string;
582
+ mediaType: string;
583
+ } | {
584
+ type: 'file-data';
585
+ /**
586
+ Base-64 encoded media data.
587
+ */
588
+ data: string;
589
+ /**
590
+ IANA media type.
591
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
592
+ */
593
+ mediaType: string;
594
+ /**
595
+ * Optional filename of the file.
596
+ */
597
+ filename?: string;
598
+ /**
599
+ * Provider-specific options.
600
+ */
601
+ providerOptions?: ProviderOptions;
602
+ } | {
603
+ type: 'file-url';
604
+ /**
605
+ * URL of the file.
606
+ */
607
+ url: string;
608
+ /**
609
+ * Provider-specific options.
610
+ */
611
+ providerOptions?: ProviderOptions;
612
+ } | {
613
+ type: 'file-id';
614
+ /**
615
+ * ID of the file.
616
+ *
617
+ * If you use multiple providers, you need to
618
+ * specify the provider specific ids using
619
+ * the Record option. The key is the provider
620
+ * name, e.g. 'openai' or 'anthropic'.
621
+ */
622
+ fileId: string | Record<string, string>;
623
+ /**
624
+ * Provider-specific options.
625
+ */
626
+ providerOptions?: ProviderOptions;
627
+ } | {
628
+ /**
629
+ * Images that are referenced using base64 encoded data.
630
+ */
631
+ type: 'image-data';
632
+ /**
633
+ Base-64 encoded image data.
634
+ */
635
+ data: string;
636
+ /**
637
+ IANA media type.
638
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
639
+ */
640
+ mediaType: string;
641
+ /**
642
+ * Provider-specific options.
643
+ */
644
+ providerOptions?: ProviderOptions;
645
+ } | {
646
+ /**
647
+ * Images that are referenced using a URL.
648
+ */
649
+ type: 'image-url';
650
+ /**
651
+ * URL of the image.
652
+ */
653
+ url: string;
654
+ /**
655
+ * Provider-specific options.
656
+ */
657
+ providerOptions?: ProviderOptions;
658
+ } | {
659
+ /**
660
+ * Images that are referenced using a provider file id.
661
+ */
662
+ type: 'image-file-id';
663
+ /**
664
+ * Image that is referenced using a provider file id.
665
+ *
666
+ * If you use multiple providers, you need to
667
+ * specify the provider specific ids using
668
+ * the Record option. The key is the provider
669
+ * name, e.g. 'openai' or 'anthropic'.
670
+ */
671
+ fileId: string | Record<string, string>;
672
+ /**
673
+ * Provider-specific options.
674
+ */
675
+ providerOptions?: ProviderOptions;
676
+ } | {
677
+ /**
678
+ * Custom content part. This can be used to implement
679
+ * provider-specific content parts.
680
+ */
681
+ type: 'custom';
682
+ /**
683
+ * Provider-specific options.
684
+ */
685
+ providerOptions?: ProviderOptions;
686
+ }>;
687
+ };
506
688
 
507
689
  /**
508
690
  * Tool approval request prompt part.
@@ -731,7 +913,7 @@ Optional conversion function that maps the tool result to an output that can be
731
913
 
732
914
  If not provided, the tool result will be sent as a JSON object.
733
915
  */
734
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV3ToolResultPart['output'];
916
+ toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => ToolResultOutput;
735
917
  } & ({
736
918
  /**
737
919
  Tool with user-defined input and output schemas.
@@ -784,7 +966,7 @@ declare function dynamicTool(tool: {
784
966
  providerOptions?: ProviderOptions;
785
967
  inputSchema: FlexibleSchema<unknown>;
786
968
  execute: ToolExecuteFunction<unknown, unknown>;
787
- toModelOutput?: (output: unknown) => LanguageModelV3ToolResultPart['output'];
969
+ toModelOutput?: (output: unknown) => ToolResultOutput;
788
970
  /**
789
971
  * Whether the tool needs approval before it can be executed.
790
972
  */
@@ -828,7 +1010,7 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
828
1010
  */
829
1011
  declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
830
1012
 
831
- type Resolvable<T> = T | PromiseLike<T> | (() => T) | (() => PromiseLike<T>);
1013
+ type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
832
1014
  /**
833
1015
  * Resolves a value that could be a raw value, a Promise, a function returning a value,
834
1016
  * or a function returning a Promise.
@@ -961,4 +1143,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
961
1143
  dynamic?: boolean;
962
1144
  }
963
1145
 
964
- export { type AssistantContent, type AssistantModelMessage, type DataContent, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, 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 ToolModelMessage, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1146
+ export { type AssistantContent, type AssistantModelMessage, type DataContent, 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 ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, 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 ToolModelMessage, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, LanguageModelV3ToolResultOutput, LanguageModelV3ToolResultPart } from '@ai-sdk/provider';
1
+ import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
2
2
  import * as z4 from 'zod/v4';
3
3
  import { ZodType } from 'zod/v4';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -232,6 +232,15 @@ declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPre
232
232
 
233
233
  declare function isAbortError(error: unknown): error is Error;
234
234
 
235
+ /**
236
+ * Type guard that checks whether a value is not `null` or `undefined`.
237
+ *
238
+ * @template T - The type of the value to check.
239
+ * @param value - The value to check.
240
+ * @returns `true` if the value is neither `null` nor `undefined`, otherwise `false`.
241
+ */
242
+ declare function isNonNullable<T>(value: T | undefined | null): value is NonNullable<T>;
243
+
235
244
  /**
236
245
  * Checks if the given URL is supported natively by the model.
237
246
  *
@@ -284,6 +293,8 @@ declare function loadSetting({ settingValue, environmentVariableName, settingNam
284
293
  description: string;
285
294
  }): string;
286
295
 
296
+ type MaybePromiseLike<T> = T | PromiseLike<T>;
297
+
287
298
  /**
288
299
  * Maps a media type to its corresponding file extension.
289
300
  * It was originally introduced to set a filename for audio file uploads
@@ -352,6 +363,11 @@ declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, fa
352
363
  responseHeaders?: Record<string, string>;
353
364
  }>;
354
365
 
366
+ /**
367
+ Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
368
+ */
369
+ type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
370
+
355
371
  /**
356
372
  Additional provider-specific options.
357
373
 
@@ -360,11 +376,6 @@ provider-specific functionality that can be fully encapsulated in the provider.
360
376
  */
361
377
  type ProviderOptions = SharedV3ProviderOptions;
362
378
 
363
- /**
364
- Data content. Can either be a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer.
365
- */
366
- type DataContent = string | Uint8Array | ArrayBuffer | Buffer;
367
-
368
379
  /**
369
380
  Text content part of a prompt. It contains a string of text.
370
381
  */
@@ -495,7 +506,7 @@ interface ToolResultPart {
495
506
  /**
496
507
  Result of the tool call. This is a JSON-serializable object.
497
508
  */
498
- output: LanguageModelV3ToolResultOutput;
509
+ output: ToolResultOutput;
499
510
  /**
500
511
  Additional provider-specific metadata. They are passed through
501
512
  to the provider from the AI SDK and enable provider-specific
@@ -503,6 +514,177 @@ interface ToolResultPart {
503
514
  */
504
515
  providerOptions?: ProviderOptions;
505
516
  }
517
+ /**
518
+ * Output of a tool result.
519
+ */
520
+ type ToolResultOutput = {
521
+ /**
522
+ * Text tool output that should be directly sent to the API.
523
+ */
524
+ type: 'text';
525
+ value: string;
526
+ /**
527
+ * Provider-specific options.
528
+ */
529
+ providerOptions?: ProviderOptions;
530
+ } | {
531
+ type: 'json';
532
+ value: JSONValue;
533
+ /**
534
+ * Provider-specific options.
535
+ */
536
+ providerOptions?: ProviderOptions;
537
+ } | {
538
+ /**
539
+ * Type when the user has denied the execution of the tool call.
540
+ */
541
+ type: 'execution-denied';
542
+ /**
543
+ * Optional reason for the execution denial.
544
+ */
545
+ reason?: string;
546
+ /**
547
+ * Provider-specific options.
548
+ */
549
+ providerOptions?: ProviderOptions;
550
+ } | {
551
+ type: 'error-text';
552
+ value: string;
553
+ /**
554
+ * Provider-specific options.
555
+ */
556
+ providerOptions?: ProviderOptions;
557
+ } | {
558
+ type: 'error-json';
559
+ value: JSONValue;
560
+ /**
561
+ * Provider-specific options.
562
+ */
563
+ providerOptions?: ProviderOptions;
564
+ } | {
565
+ type: 'content';
566
+ value: Array<{
567
+ type: 'text';
568
+ /**
569
+ Text content.
570
+ */
571
+ text: string;
572
+ /**
573
+ * Provider-specific options.
574
+ */
575
+ providerOptions?: ProviderOptions;
576
+ } | {
577
+ /**
578
+ * @deprecated Use image-data or file-data instead.
579
+ */
580
+ type: 'media';
581
+ data: string;
582
+ mediaType: string;
583
+ } | {
584
+ type: 'file-data';
585
+ /**
586
+ Base-64 encoded media data.
587
+ */
588
+ data: string;
589
+ /**
590
+ IANA media type.
591
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
592
+ */
593
+ mediaType: string;
594
+ /**
595
+ * Optional filename of the file.
596
+ */
597
+ filename?: string;
598
+ /**
599
+ * Provider-specific options.
600
+ */
601
+ providerOptions?: ProviderOptions;
602
+ } | {
603
+ type: 'file-url';
604
+ /**
605
+ * URL of the file.
606
+ */
607
+ url: string;
608
+ /**
609
+ * Provider-specific options.
610
+ */
611
+ providerOptions?: ProviderOptions;
612
+ } | {
613
+ type: 'file-id';
614
+ /**
615
+ * ID of the file.
616
+ *
617
+ * If you use multiple providers, you need to
618
+ * specify the provider specific ids using
619
+ * the Record option. The key is the provider
620
+ * name, e.g. 'openai' or 'anthropic'.
621
+ */
622
+ fileId: string | Record<string, string>;
623
+ /**
624
+ * Provider-specific options.
625
+ */
626
+ providerOptions?: ProviderOptions;
627
+ } | {
628
+ /**
629
+ * Images that are referenced using base64 encoded data.
630
+ */
631
+ type: 'image-data';
632
+ /**
633
+ Base-64 encoded image data.
634
+ */
635
+ data: string;
636
+ /**
637
+ IANA media type.
638
+ @see https://www.iana.org/assignments/media-types/media-types.xhtml
639
+ */
640
+ mediaType: string;
641
+ /**
642
+ * Provider-specific options.
643
+ */
644
+ providerOptions?: ProviderOptions;
645
+ } | {
646
+ /**
647
+ * Images that are referenced using a URL.
648
+ */
649
+ type: 'image-url';
650
+ /**
651
+ * URL of the image.
652
+ */
653
+ url: string;
654
+ /**
655
+ * Provider-specific options.
656
+ */
657
+ providerOptions?: ProviderOptions;
658
+ } | {
659
+ /**
660
+ * Images that are referenced using a provider file id.
661
+ */
662
+ type: 'image-file-id';
663
+ /**
664
+ * Image that is referenced using a provider file id.
665
+ *
666
+ * If you use multiple providers, you need to
667
+ * specify the provider specific ids using
668
+ * the Record option. The key is the provider
669
+ * name, e.g. 'openai' or 'anthropic'.
670
+ */
671
+ fileId: string | Record<string, string>;
672
+ /**
673
+ * Provider-specific options.
674
+ */
675
+ providerOptions?: ProviderOptions;
676
+ } | {
677
+ /**
678
+ * Custom content part. This can be used to implement
679
+ * provider-specific content parts.
680
+ */
681
+ type: 'custom';
682
+ /**
683
+ * Provider-specific options.
684
+ */
685
+ providerOptions?: ProviderOptions;
686
+ }>;
687
+ };
506
688
 
507
689
  /**
508
690
  * Tool approval request prompt part.
@@ -731,7 +913,7 @@ Optional conversion function that maps the tool result to an output that can be
731
913
 
732
914
  If not provided, the tool result will be sent as a JSON object.
733
915
  */
734
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV3ToolResultPart['output'];
916
+ toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => ToolResultOutput;
735
917
  } & ({
736
918
  /**
737
919
  Tool with user-defined input and output schemas.
@@ -784,7 +966,7 @@ declare function dynamicTool(tool: {
784
966
  providerOptions?: ProviderOptions;
785
967
  inputSchema: FlexibleSchema<unknown>;
786
968
  execute: ToolExecuteFunction<unknown, unknown>;
787
- toModelOutput?: (output: unknown) => LanguageModelV3ToolResultPart['output'];
969
+ toModelOutput?: (output: unknown) => ToolResultOutput;
788
970
  /**
789
971
  * Whether the tool needs approval before it can be executed.
790
972
  */
@@ -828,7 +1010,7 @@ declare function createProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT,
828
1010
  */
829
1011
  declare function removeUndefinedEntries<T>(record: Record<string, T | undefined>): Record<string, T>;
830
1012
 
831
- type Resolvable<T> = T | PromiseLike<T> | (() => T) | (() => PromiseLike<T>);
1013
+ type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
832
1014
  /**
833
1015
  * Resolves a value that could be a raw value, a Promise, a function returning a value,
834
1016
  * or a function returning a Promise.
@@ -961,4 +1143,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
961
1143
  dynamic?: boolean;
962
1144
  }
963
1145
 
964
- export { type AssistantContent, type AssistantModelMessage, type DataContent, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type ModelMessage, type ParseResult, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, 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 ToolModelMessage, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1146
+ export { type AssistantContent, type AssistantModelMessage, type DataContent, 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 ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderOptions, 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 ToolModelMessage, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ __export(src_exports, {
58
58
  getRuntimeEnvironmentUserAgent: () => getRuntimeEnvironmentUserAgent,
59
59
  injectJsonInstructionIntoMessages: () => injectJsonInstructionIntoMessages,
60
60
  isAbortError: () => isAbortError,
61
+ isNonNullable: () => isNonNullable,
61
62
  isParsableJson: () => isParsableJson,
62
63
  isUrlSupported: () => isUrlSupported,
63
64
  jsonSchema: () => jsonSchema,
@@ -280,7 +281,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
280
281
  }
281
282
 
282
283
  // src/version.ts
283
- var VERSION = true ? "4.0.0-beta.18" : "0.0.0-test";
284
+ var VERSION = true ? "4.0.0-beta.20" : "0.0.0-test";
284
285
 
285
286
  // src/get-from-api.ts
286
287
  var getOriginalFetch = () => globalThis.fetch;
@@ -391,6 +392,11 @@ function injectJsonInstructionIntoMessages({
391
392
  ];
392
393
  }
393
394
 
395
+ // src/is-non-nullable.ts
396
+ function isNonNullable(value) {
397
+ return value != null;
398
+ }
399
+
394
400
  // src/is-url-supported.ts
395
401
  function isUrlSupported({
396
402
  mediaType,
@@ -2456,6 +2462,7 @@ var import_stream2 = require("eventsource-parser/stream");
2456
2462
  getRuntimeEnvironmentUserAgent,
2457
2463
  injectJsonInstructionIntoMessages,
2458
2464
  isAbortError,
2465
+ isNonNullable,
2459
2466
  isParsableJson,
2460
2467
  isUrlSupported,
2461
2468
  jsonSchema,