@ai-sdk/provider 2.1.0-beta.0 → 2.1.0-beta.2

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,18 @@
1
1
  # @ai-sdk/provider
2
2
 
3
+ ## 2.1.0-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - ed329cb: feat: `Provider-V3`
8
+ - 522f6b8: feat: `ImageModelV3`
9
+
10
+ ## 2.1.0-beta.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 0c4822d: feat: `EmbeddingModelV3`
15
+
3
16
  ## 2.1.0-beta.0
4
17
 
5
18
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -59,6 +59,106 @@ type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue>>;
59
59
  */
60
60
  type SharedV2ProviderOptions = Record<string, Record<string, JSONValue>>;
61
61
 
62
+ /**
63
+ An embedding is a vector, i.e. an array of numbers.
64
+ It is e.g. used to represent a text as a vector of word embeddings.
65
+ */
66
+ type EmbeddingModelV3Embedding = Array<number>;
67
+
68
+ /**
69
+ Specification for an embedding model that implements the embedding model
70
+ interface version 1.
71
+
72
+ VALUE is the type of the values that the model can embed.
73
+ This will allow us to go beyond text embeddings in the future,
74
+ e.g. to support image embeddings
75
+ */
76
+ type EmbeddingModelV3<VALUE> = {
77
+ /**
78
+ The embedding model must specify which embedding model interface
79
+ version it implements. This will allow us to evolve the embedding
80
+ model interface and retain backwards compatibility. The different
81
+ implementation versions can be handled as a discriminated union
82
+ on our side.
83
+ */
84
+ readonly specificationVersion: 'v3';
85
+ /**
86
+ Name of the provider for logging purposes.
87
+ */
88
+ readonly provider: string;
89
+ /**
90
+ Provider-specific model ID for logging purposes.
91
+ */
92
+ readonly modelId: string;
93
+ /**
94
+ Limit of how many embeddings can be generated in a single API call.
95
+
96
+ Use Infinity for models that do not have a limit.
97
+ */
98
+ readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
99
+ /**
100
+ True if the model can handle multiple embedding calls in parallel.
101
+ */
102
+ readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
103
+ /**
104
+ Generates a list of embeddings for the given input text.
105
+
106
+ Naming: "do" prefix to prevent accidental direct usage of the method
107
+ by the user.
108
+ */
109
+ doEmbed(options: {
110
+ /**
111
+ List of values to embed.
112
+ */
113
+ values: Array<VALUE>;
114
+ /**
115
+ Abort signal for cancelling the operation.
116
+ */
117
+ abortSignal?: AbortSignal;
118
+ /**
119
+ Additional provider-specific options. They are passed through
120
+ to the provider from the AI SDK and enable provider-specific
121
+ functionality that can be fully encapsulated in the provider.
122
+ */
123
+ providerOptions?: SharedV2ProviderOptions;
124
+ /**
125
+ Additional HTTP headers to be sent with the request.
126
+ Only applicable for HTTP-based providers.
127
+ */
128
+ headers?: Record<string, string | undefined>;
129
+ }): PromiseLike<{
130
+ /**
131
+ Generated embeddings. They are in the same order as the input values.
132
+ */
133
+ embeddings: Array<EmbeddingModelV3Embedding>;
134
+ /**
135
+ Token usage. We only have input tokens for embeddings.
136
+ */
137
+ usage?: {
138
+ tokens: number;
139
+ };
140
+ /**
141
+ Additional provider-specific metadata. They are passed through
142
+ from the provider to the AI SDK and enable provider-specific
143
+ results that can be fully encapsulated in the provider.
144
+ */
145
+ providerMetadata?: SharedV2ProviderMetadata;
146
+ /**
147
+ Optional response information for debugging purposes.
148
+ */
149
+ response?: {
150
+ /**
151
+ Response headers.
152
+ */
153
+ headers?: SharedV2Headers;
154
+ /**
155
+ The response body.
156
+ */
157
+ body?: unknown;
158
+ };
159
+ }>;
160
+ };
161
+
62
162
  /**
63
163
  An embedding is a vector, i.e. an array of numbers.
64
164
  It is e.g. used to represent a text as a vector of word embeddings.
@@ -385,6 +485,158 @@ declare function isJSONValue(value: unknown): value is JSONValue;
385
485
  declare function isJSONArray(value: unknown): value is JSONArray;
386
486
  declare function isJSONObject(value: unknown): value is JSONObject;
387
487
 
488
+ type ImageModelV3CallOptions = {
489
+ /**
490
+ Prompt for the image generation.
491
+ */
492
+ prompt: string;
493
+ /**
494
+ Number of images to generate.
495
+ */
496
+ n: number;
497
+ /**
498
+ Size of the images to generate.
499
+ Must have the format `{width}x{height}`.
500
+ `undefined` will use the provider's default size.
501
+ */
502
+ size: `${number}x${number}` | undefined;
503
+ /**
504
+ Aspect ratio of the images to generate.
505
+ Must have the format `{width}:{height}`.
506
+ `undefined` will use the provider's default aspect ratio.
507
+ */
508
+ aspectRatio: `${number}:${number}` | undefined;
509
+ /**
510
+ Seed for the image generation.
511
+ `undefined` will use the provider's default seed.
512
+ */
513
+ seed: number | undefined;
514
+ /**
515
+ Additional provider-specific options that are passed through to the provider
516
+ as body parameters.
517
+
518
+ The outer record is keyed by the provider name, and the inner
519
+ record is keyed by the provider-specific metadata key.
520
+ ```ts
521
+ {
522
+ "openai": {
523
+ "style": "vivid"
524
+ }
525
+ }
526
+ ```
527
+ */
528
+ providerOptions: SharedV2ProviderOptions;
529
+ /**
530
+ Abort signal for cancelling the operation.
531
+ */
532
+ abortSignal?: AbortSignal;
533
+ /**
534
+ Additional HTTP headers to be sent with the request.
535
+ Only applicable for HTTP-based providers.
536
+ */
537
+ headers?: Record<string, string | undefined>;
538
+ };
539
+
540
+ /**
541
+ Warning from the model provider for this call. The call will proceed, but e.g.
542
+ some settings might not be supported, which can lead to suboptimal results.
543
+ */
544
+ type ImageModelV3CallWarning = {
545
+ type: 'unsupported-setting';
546
+ setting: keyof ImageModelV3CallOptions;
547
+ details?: string;
548
+ } | {
549
+ type: 'other';
550
+ message: string;
551
+ };
552
+
553
+ type ImageModelV3ProviderMetadata = Record<string, {
554
+ images: JSONArray;
555
+ } & JSONValue>;
556
+ type GetMaxImagesPerCallFunction$1 = (options: {
557
+ modelId: string;
558
+ }) => PromiseLike<number | undefined> | number | undefined;
559
+ /**
560
+ Image generation model specification version 3.
561
+ */
562
+ type ImageModelV3 = {
563
+ /**
564
+ The image model must specify which image model interface
565
+ version it implements. This will allow us to evolve the image
566
+ model interface and retain backwards compatibility. The different
567
+ implementation versions can be handled as a discriminated union
568
+ on our side.
569
+ */
570
+ readonly specificationVersion: 'v3';
571
+ /**
572
+ Name of the provider for logging purposes.
573
+ */
574
+ readonly provider: string;
575
+ /**
576
+ Provider-specific model ID for logging purposes.
577
+ */
578
+ readonly modelId: string;
579
+ /**
580
+ Limit of how many images can be generated in a single API call.
581
+ Can be set to a number for a fixed limit, to undefined to use
582
+ the global limit, or a function that returns a number or undefined,
583
+ optionally as a promise.
584
+ */
585
+ readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction$1;
586
+ /**
587
+ Generates an array of images.
588
+ */
589
+ doGenerate(options: ImageModelV3CallOptions): PromiseLike<{
590
+ /**
591
+ Generated images as base64 encoded strings or binary data.
592
+ The images should be returned without any unnecessary conversion.
593
+ If the API returns base64 encoded strings, the images should be returned
594
+ as base64 encoded strings. If the API returns binary data, the images should
595
+ be returned as binary data.
596
+ */
597
+ images: Array<string> | Array<Uint8Array>;
598
+ /**
599
+ Warnings for the call, e.g. unsupported settings.
600
+ */
601
+ warnings: Array<ImageModelV3CallWarning>;
602
+ /**
603
+ Additional provider-specific metadata. They are passed through
604
+ from the provider to the AI SDK and enable provider-specific
605
+ results that can be fully encapsulated in the provider.
606
+
607
+ The outer record is keyed by the provider name, and the inner
608
+ record is provider-specific metadata. It always includes an
609
+ `images` key with image-specific metadata
610
+
611
+ ```ts
612
+ {
613
+ "openai": {
614
+ "images": ["revisedPrompt": "Revised prompt here."]
615
+ }
616
+ }
617
+ ```
618
+ */
619
+ providerMetadata?: ImageModelV3ProviderMetadata;
620
+ /**
621
+ Response information for telemetry and debugging purposes.
622
+ */
623
+ response: {
624
+ /**
625
+ Timestamp for the start of the generated response.
626
+ */
627
+ timestamp: Date;
628
+ /**
629
+ The ID of the response model that was used to generate the response.
630
+ */
631
+ modelId: string;
632
+ /**
633
+ Response headers.
634
+ */
635
+ headers: Record<string, string> | undefined;
636
+ };
637
+ }>;
638
+ };
639
+
388
640
  type ImageModelV2CallOptions = {
389
641
  /**
390
642
  Prompt for the image generation.
@@ -1667,6 +1919,61 @@ type TranscriptionModelV2 = {
1667
1919
  }>;
1668
1920
  };
1669
1921
 
1922
+ /**
1923
+ * Provider for language, text embedding, and image generation models.
1924
+ */
1925
+ interface ProviderV3 {
1926
+ /**
1927
+ Returns the language model with the given id.
1928
+ The model id is then passed to the provider function to get the model.
1929
+
1930
+ @param {string} modelId - The id of the model to return.
1931
+
1932
+ @returns {LanguageModel} The language model associated with the id
1933
+
1934
+ @throws {NoSuchModelError} If no such model exists.
1935
+ */
1936
+ languageModel(modelId: string): LanguageModelV2;
1937
+ /**
1938
+ Returns the text embedding model with the given id.
1939
+ The model id is then passed to the provider function to get the model.
1940
+
1941
+ @param {string} modelId - The id of the model to return.
1942
+
1943
+ @returns {LanguageModel} The language model associated with the id
1944
+
1945
+ @throws {NoSuchModelError} If no such model exists.
1946
+ */
1947
+ textEmbeddingModel(modelId: string): EmbeddingModelV3<string>;
1948
+ /**
1949
+ Returns the image model with the given id.
1950
+ The model id is then passed to the provider function to get the model.
1951
+
1952
+ @param {string} modelId - The id of the model to return.
1953
+
1954
+ @returns {ImageModel} The image model associated with the id
1955
+ */
1956
+ imageModel(modelId: string): ImageModelV3;
1957
+ /**
1958
+ Returns the transcription model with the given id.
1959
+ The model id is then passed to the provider function to get the model.
1960
+
1961
+ @param {string} modelId - The id of the model to return.
1962
+
1963
+ @returns {TranscriptionModel} The transcription model associated with the id
1964
+ */
1965
+ transcriptionModel?(modelId: string): TranscriptionModelV2;
1966
+ /**
1967
+ Returns the speech model with the given id.
1968
+ The model id is then passed to the provider function to get the model.
1969
+
1970
+ @param {string} modelId - The id of the model to return.
1971
+
1972
+ @returns {SpeechModel} The speech model associated with the id
1973
+ */
1974
+ speechModel?(modelId: string): SpeechModelV2;
1975
+ }
1976
+
1670
1977
  /**
1671
1978
  * Provider for language, text embedding, and image generation models.
1672
1979
  */
@@ -1722,4 +2029,4 @@ interface ProviderV2 {
1722
2029
  speechModel?(modelId: string): SpeechModelV2;
1723
2030
  }
1724
2031
 
1725
- export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
2032
+ export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3Embedding, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3CallWarning, type ImageModelV3ProviderMetadata, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type ProviderV3, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
package/dist/index.d.ts CHANGED
@@ -59,6 +59,106 @@ type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue>>;
59
59
  */
60
60
  type SharedV2ProviderOptions = Record<string, Record<string, JSONValue>>;
61
61
 
62
+ /**
63
+ An embedding is a vector, i.e. an array of numbers.
64
+ It is e.g. used to represent a text as a vector of word embeddings.
65
+ */
66
+ type EmbeddingModelV3Embedding = Array<number>;
67
+
68
+ /**
69
+ Specification for an embedding model that implements the embedding model
70
+ interface version 1.
71
+
72
+ VALUE is the type of the values that the model can embed.
73
+ This will allow us to go beyond text embeddings in the future,
74
+ e.g. to support image embeddings
75
+ */
76
+ type EmbeddingModelV3<VALUE> = {
77
+ /**
78
+ The embedding model must specify which embedding model interface
79
+ version it implements. This will allow us to evolve the embedding
80
+ model interface and retain backwards compatibility. The different
81
+ implementation versions can be handled as a discriminated union
82
+ on our side.
83
+ */
84
+ readonly specificationVersion: 'v3';
85
+ /**
86
+ Name of the provider for logging purposes.
87
+ */
88
+ readonly provider: string;
89
+ /**
90
+ Provider-specific model ID for logging purposes.
91
+ */
92
+ readonly modelId: string;
93
+ /**
94
+ Limit of how many embeddings can be generated in a single API call.
95
+
96
+ Use Infinity for models that do not have a limit.
97
+ */
98
+ readonly maxEmbeddingsPerCall: PromiseLike<number | undefined> | number | undefined;
99
+ /**
100
+ True if the model can handle multiple embedding calls in parallel.
101
+ */
102
+ readonly supportsParallelCalls: PromiseLike<boolean> | boolean;
103
+ /**
104
+ Generates a list of embeddings for the given input text.
105
+
106
+ Naming: "do" prefix to prevent accidental direct usage of the method
107
+ by the user.
108
+ */
109
+ doEmbed(options: {
110
+ /**
111
+ List of values to embed.
112
+ */
113
+ values: Array<VALUE>;
114
+ /**
115
+ Abort signal for cancelling the operation.
116
+ */
117
+ abortSignal?: AbortSignal;
118
+ /**
119
+ Additional provider-specific options. They are passed through
120
+ to the provider from the AI SDK and enable provider-specific
121
+ functionality that can be fully encapsulated in the provider.
122
+ */
123
+ providerOptions?: SharedV2ProviderOptions;
124
+ /**
125
+ Additional HTTP headers to be sent with the request.
126
+ Only applicable for HTTP-based providers.
127
+ */
128
+ headers?: Record<string, string | undefined>;
129
+ }): PromiseLike<{
130
+ /**
131
+ Generated embeddings. They are in the same order as the input values.
132
+ */
133
+ embeddings: Array<EmbeddingModelV3Embedding>;
134
+ /**
135
+ Token usage. We only have input tokens for embeddings.
136
+ */
137
+ usage?: {
138
+ tokens: number;
139
+ };
140
+ /**
141
+ Additional provider-specific metadata. They are passed through
142
+ from the provider to the AI SDK and enable provider-specific
143
+ results that can be fully encapsulated in the provider.
144
+ */
145
+ providerMetadata?: SharedV2ProviderMetadata;
146
+ /**
147
+ Optional response information for debugging purposes.
148
+ */
149
+ response?: {
150
+ /**
151
+ Response headers.
152
+ */
153
+ headers?: SharedV2Headers;
154
+ /**
155
+ The response body.
156
+ */
157
+ body?: unknown;
158
+ };
159
+ }>;
160
+ };
161
+
62
162
  /**
63
163
  An embedding is a vector, i.e. an array of numbers.
64
164
  It is e.g. used to represent a text as a vector of word embeddings.
@@ -385,6 +485,158 @@ declare function isJSONValue(value: unknown): value is JSONValue;
385
485
  declare function isJSONArray(value: unknown): value is JSONArray;
386
486
  declare function isJSONObject(value: unknown): value is JSONObject;
387
487
 
488
+ type ImageModelV3CallOptions = {
489
+ /**
490
+ Prompt for the image generation.
491
+ */
492
+ prompt: string;
493
+ /**
494
+ Number of images to generate.
495
+ */
496
+ n: number;
497
+ /**
498
+ Size of the images to generate.
499
+ Must have the format `{width}x{height}`.
500
+ `undefined` will use the provider's default size.
501
+ */
502
+ size: `${number}x${number}` | undefined;
503
+ /**
504
+ Aspect ratio of the images to generate.
505
+ Must have the format `{width}:{height}`.
506
+ `undefined` will use the provider's default aspect ratio.
507
+ */
508
+ aspectRatio: `${number}:${number}` | undefined;
509
+ /**
510
+ Seed for the image generation.
511
+ `undefined` will use the provider's default seed.
512
+ */
513
+ seed: number | undefined;
514
+ /**
515
+ Additional provider-specific options that are passed through to the provider
516
+ as body parameters.
517
+
518
+ The outer record is keyed by the provider name, and the inner
519
+ record is keyed by the provider-specific metadata key.
520
+ ```ts
521
+ {
522
+ "openai": {
523
+ "style": "vivid"
524
+ }
525
+ }
526
+ ```
527
+ */
528
+ providerOptions: SharedV2ProviderOptions;
529
+ /**
530
+ Abort signal for cancelling the operation.
531
+ */
532
+ abortSignal?: AbortSignal;
533
+ /**
534
+ Additional HTTP headers to be sent with the request.
535
+ Only applicable for HTTP-based providers.
536
+ */
537
+ headers?: Record<string, string | undefined>;
538
+ };
539
+
540
+ /**
541
+ Warning from the model provider for this call. The call will proceed, but e.g.
542
+ some settings might not be supported, which can lead to suboptimal results.
543
+ */
544
+ type ImageModelV3CallWarning = {
545
+ type: 'unsupported-setting';
546
+ setting: keyof ImageModelV3CallOptions;
547
+ details?: string;
548
+ } | {
549
+ type: 'other';
550
+ message: string;
551
+ };
552
+
553
+ type ImageModelV3ProviderMetadata = Record<string, {
554
+ images: JSONArray;
555
+ } & JSONValue>;
556
+ type GetMaxImagesPerCallFunction$1 = (options: {
557
+ modelId: string;
558
+ }) => PromiseLike<number | undefined> | number | undefined;
559
+ /**
560
+ Image generation model specification version 3.
561
+ */
562
+ type ImageModelV3 = {
563
+ /**
564
+ The image model must specify which image model interface
565
+ version it implements. This will allow us to evolve the image
566
+ model interface and retain backwards compatibility. The different
567
+ implementation versions can be handled as a discriminated union
568
+ on our side.
569
+ */
570
+ readonly specificationVersion: 'v3';
571
+ /**
572
+ Name of the provider for logging purposes.
573
+ */
574
+ readonly provider: string;
575
+ /**
576
+ Provider-specific model ID for logging purposes.
577
+ */
578
+ readonly modelId: string;
579
+ /**
580
+ Limit of how many images can be generated in a single API call.
581
+ Can be set to a number for a fixed limit, to undefined to use
582
+ the global limit, or a function that returns a number or undefined,
583
+ optionally as a promise.
584
+ */
585
+ readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction$1;
586
+ /**
587
+ Generates an array of images.
588
+ */
589
+ doGenerate(options: ImageModelV3CallOptions): PromiseLike<{
590
+ /**
591
+ Generated images as base64 encoded strings or binary data.
592
+ The images should be returned without any unnecessary conversion.
593
+ If the API returns base64 encoded strings, the images should be returned
594
+ as base64 encoded strings. If the API returns binary data, the images should
595
+ be returned as binary data.
596
+ */
597
+ images: Array<string> | Array<Uint8Array>;
598
+ /**
599
+ Warnings for the call, e.g. unsupported settings.
600
+ */
601
+ warnings: Array<ImageModelV3CallWarning>;
602
+ /**
603
+ Additional provider-specific metadata. They are passed through
604
+ from the provider to the AI SDK and enable provider-specific
605
+ results that can be fully encapsulated in the provider.
606
+
607
+ The outer record is keyed by the provider name, and the inner
608
+ record is provider-specific metadata. It always includes an
609
+ `images` key with image-specific metadata
610
+
611
+ ```ts
612
+ {
613
+ "openai": {
614
+ "images": ["revisedPrompt": "Revised prompt here."]
615
+ }
616
+ }
617
+ ```
618
+ */
619
+ providerMetadata?: ImageModelV3ProviderMetadata;
620
+ /**
621
+ Response information for telemetry and debugging purposes.
622
+ */
623
+ response: {
624
+ /**
625
+ Timestamp for the start of the generated response.
626
+ */
627
+ timestamp: Date;
628
+ /**
629
+ The ID of the response model that was used to generate the response.
630
+ */
631
+ modelId: string;
632
+ /**
633
+ Response headers.
634
+ */
635
+ headers: Record<string, string> | undefined;
636
+ };
637
+ }>;
638
+ };
639
+
388
640
  type ImageModelV2CallOptions = {
389
641
  /**
390
642
  Prompt for the image generation.
@@ -1667,6 +1919,61 @@ type TranscriptionModelV2 = {
1667
1919
  }>;
1668
1920
  };
1669
1921
 
1922
+ /**
1923
+ * Provider for language, text embedding, and image generation models.
1924
+ */
1925
+ interface ProviderV3 {
1926
+ /**
1927
+ Returns the language model with the given id.
1928
+ The model id is then passed to the provider function to get the model.
1929
+
1930
+ @param {string} modelId - The id of the model to return.
1931
+
1932
+ @returns {LanguageModel} The language model associated with the id
1933
+
1934
+ @throws {NoSuchModelError} If no such model exists.
1935
+ */
1936
+ languageModel(modelId: string): LanguageModelV2;
1937
+ /**
1938
+ Returns the text embedding model with the given id.
1939
+ The model id is then passed to the provider function to get the model.
1940
+
1941
+ @param {string} modelId - The id of the model to return.
1942
+
1943
+ @returns {LanguageModel} The language model associated with the id
1944
+
1945
+ @throws {NoSuchModelError} If no such model exists.
1946
+ */
1947
+ textEmbeddingModel(modelId: string): EmbeddingModelV3<string>;
1948
+ /**
1949
+ Returns the image model with the given id.
1950
+ The model id is then passed to the provider function to get the model.
1951
+
1952
+ @param {string} modelId - The id of the model to return.
1953
+
1954
+ @returns {ImageModel} The image model associated with the id
1955
+ */
1956
+ imageModel(modelId: string): ImageModelV3;
1957
+ /**
1958
+ Returns the transcription model with the given id.
1959
+ The model id is then passed to the provider function to get the model.
1960
+
1961
+ @param {string} modelId - The id of the model to return.
1962
+
1963
+ @returns {TranscriptionModel} The transcription model associated with the id
1964
+ */
1965
+ transcriptionModel?(modelId: string): TranscriptionModelV2;
1966
+ /**
1967
+ Returns the speech model with the given id.
1968
+ The model id is then passed to the provider function to get the model.
1969
+
1970
+ @param {string} modelId - The id of the model to return.
1971
+
1972
+ @returns {SpeechModel} The speech model associated with the id
1973
+ */
1974
+ speechModel?(modelId: string): SpeechModelV2;
1975
+ }
1976
+
1670
1977
  /**
1671
1978
  * Provider for language, text embedding, and image generation models.
1672
1979
  */
@@ -1722,4 +2029,4 @@ interface ProviderV2 {
1722
2029
  speechModel?(modelId: string): SpeechModelV2;
1723
2030
  }
1724
2031
 
1725
- export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
2032
+ export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3Embedding, EmptyResponseBodyError, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3CallWarning, type ImageModelV3ProviderMetadata, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, type ProviderV2, type ProviderV3, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };