@ai-sdk/provider 4.0.12 → 4.0.14
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 +13 -0
- package/dist/index.d.ts +252 -237
- package/package.json +1 -1
- package/src/batch/v4/batch-v4.ts +14 -3
- package/src/batch/v4/image-batch-v4-request.ts +21 -0
- package/src/batch/v4/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/provider
|
|
2
2
|
|
|
3
|
+
## 4.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5ec21a6: fix: reject unsupported batch request types
|
|
8
|
+
- 7469a3b: feat: support image generation requests in batches
|
|
9
|
+
|
|
10
|
+
## 4.0.13
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 9942196: feat: add batch cancel and list APIs
|
|
15
|
+
|
|
3
16
|
## 4.0.12
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -736,6 +736,247 @@ type LanguageModelV4GenerateResult = {
|
|
|
736
736
|
warnings: Array<SharedV4Warning>;
|
|
737
737
|
};
|
|
738
738
|
|
|
739
|
+
/**
|
|
740
|
+
* An image file that can be used for image editing or variation generation.
|
|
741
|
+
*/
|
|
742
|
+
type ImageModelV4File = {
|
|
743
|
+
type: 'file';
|
|
744
|
+
/**
|
|
745
|
+
* The IANA media type of the file, e.g. `image/png`. Any string is supported.
|
|
746
|
+
*
|
|
747
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
748
|
+
*/
|
|
749
|
+
mediaType: string;
|
|
750
|
+
/**
|
|
751
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
752
|
+
*
|
|
753
|
+
* The file data should be returned without any unnecessary conversion.
|
|
754
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
755
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
756
|
+
* be returned as binary data.
|
|
757
|
+
*/
|
|
758
|
+
data: string | Uint8Array;
|
|
759
|
+
/**
|
|
760
|
+
* Optional provider-specific metadata for the file part.
|
|
761
|
+
*/
|
|
762
|
+
providerOptions?: SharedV4ProviderMetadata;
|
|
763
|
+
} | {
|
|
764
|
+
type: 'url';
|
|
765
|
+
/**
|
|
766
|
+
* The URL of the image file.
|
|
767
|
+
*/
|
|
768
|
+
url: string;
|
|
769
|
+
/**
|
|
770
|
+
* Optional provider-specific metadata for the file part.
|
|
771
|
+
*/
|
|
772
|
+
providerOptions?: SharedV4ProviderMetadata;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
type ImageModelV4CallOptions = {
|
|
776
|
+
/**
|
|
777
|
+
* Prompt for the image generation. Some operations, like upscaling, may not require a prompt.
|
|
778
|
+
*/
|
|
779
|
+
prompt: string | undefined;
|
|
780
|
+
/**
|
|
781
|
+
* Number of images to generate.
|
|
782
|
+
*/
|
|
783
|
+
n: number;
|
|
784
|
+
/**
|
|
785
|
+
* Size of the images to generate.
|
|
786
|
+
* Must have the format `{width}x{height}`.
|
|
787
|
+
* `undefined` will use the provider's default size.
|
|
788
|
+
*/
|
|
789
|
+
size: `${number}x${number}` | undefined;
|
|
790
|
+
/**
|
|
791
|
+
* Aspect ratio of the images to generate.
|
|
792
|
+
* Must have the format `{width}:{height}`.
|
|
793
|
+
* `undefined` will use the provider's default aspect ratio.
|
|
794
|
+
*/
|
|
795
|
+
aspectRatio: `${number}:${number}` | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* Seed for the image generation.
|
|
798
|
+
* `undefined` will use the provider's default seed.
|
|
799
|
+
*/
|
|
800
|
+
seed: number | undefined;
|
|
801
|
+
/**
|
|
802
|
+
* Array of images for image editing or variation generation.
|
|
803
|
+
* The images should be provided as base64 encoded strings or binary data.
|
|
804
|
+
*/
|
|
805
|
+
files: ImageModelV4File[] | undefined;
|
|
806
|
+
/**
|
|
807
|
+
* Mask image for inpainting operations.
|
|
808
|
+
* The mask should be provided as base64 encoded strings or binary data.
|
|
809
|
+
*/
|
|
810
|
+
mask: ImageModelV4File | undefined;
|
|
811
|
+
/**
|
|
812
|
+
* Additional provider-specific options that are passed through to the provider
|
|
813
|
+
* as body parameters.
|
|
814
|
+
*
|
|
815
|
+
* The outer record is keyed by the provider name, and the inner
|
|
816
|
+
* record is keyed by the provider-specific metadata key.
|
|
817
|
+
*
|
|
818
|
+
* ```ts
|
|
819
|
+
* {
|
|
820
|
+
* "openai": {
|
|
821
|
+
* "style": "vivid"
|
|
822
|
+
* }
|
|
823
|
+
* }
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
providerOptions: SharedV4ProviderOptions;
|
|
827
|
+
/**
|
|
828
|
+
* Abort signal for cancelling the operation.
|
|
829
|
+
*/
|
|
830
|
+
abortSignal?: AbortSignal;
|
|
831
|
+
/**
|
|
832
|
+
* Additional HTTP headers to be sent with the request.
|
|
833
|
+
* Only applicable for HTTP-based providers.
|
|
834
|
+
*/
|
|
835
|
+
headers?: Record<string, string | undefined>;
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Usage information for an image model call.
|
|
840
|
+
*/
|
|
841
|
+
type ImageModelV4Usage = {
|
|
842
|
+
/**
|
|
843
|
+
* The number of input (prompt) tokens used.
|
|
844
|
+
*/
|
|
845
|
+
inputTokens: number | undefined;
|
|
846
|
+
/**
|
|
847
|
+
* The number of output tokens used, if reported by the provider.
|
|
848
|
+
*/
|
|
849
|
+
outputTokens: number | undefined;
|
|
850
|
+
/**
|
|
851
|
+
* The total number of tokens as reported by the provider.
|
|
852
|
+
*/
|
|
853
|
+
totalTokens: number | undefined;
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
type ImageModelV4ProviderMetadata = Record<string, {
|
|
857
|
+
images: JSONArray;
|
|
858
|
+
} & JSONValue>;
|
|
859
|
+
/**
|
|
860
|
+
* The result of an image model doGenerate call.
|
|
861
|
+
*/
|
|
862
|
+
type ImageModelV4Result = {
|
|
863
|
+
/**
|
|
864
|
+
* Generated images as base64 encoded strings or binary data.
|
|
865
|
+
* The images should be returned without any unnecessary conversion.
|
|
866
|
+
* If the API returns base64 encoded strings, the images should be returned
|
|
867
|
+
* as base64 encoded strings. If the API returns binary data, the images should
|
|
868
|
+
* be returned as binary data.
|
|
869
|
+
*/
|
|
870
|
+
images: Array<string> | Array<Uint8Array>;
|
|
871
|
+
/**
|
|
872
|
+
* Whether an unsuccessful result, such as an empty image result, can be
|
|
873
|
+
* retried. When omitted, the result is unclassified.
|
|
874
|
+
*/
|
|
875
|
+
isRetryable?: boolean;
|
|
876
|
+
/**
|
|
877
|
+
* Warnings for the call, e.g. unsupported features.
|
|
878
|
+
*/
|
|
879
|
+
warnings: Array<SharedV4Warning>;
|
|
880
|
+
/**
|
|
881
|
+
* Additional provider-specific metadata. They are passed through
|
|
882
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
883
|
+
* results that can be fully encapsulated in the provider.
|
|
884
|
+
*
|
|
885
|
+
* The outer record is keyed by the provider name, and the inner
|
|
886
|
+
* record is provider-specific metadata. It always includes an
|
|
887
|
+
* `images` key with image-specific metadata
|
|
888
|
+
*
|
|
889
|
+
* ```ts
|
|
890
|
+
* {
|
|
891
|
+
* "openai": {
|
|
892
|
+
* "images": ["revisedPrompt": "Revised prompt here."]
|
|
893
|
+
* }
|
|
894
|
+
* }
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
providerMetadata?: ImageModelV4ProviderMetadata;
|
|
898
|
+
/**
|
|
899
|
+
* Response information for telemetry and debugging purposes.
|
|
900
|
+
*/
|
|
901
|
+
response: {
|
|
902
|
+
/**
|
|
903
|
+
* Timestamp for the start of the generated response.
|
|
904
|
+
*/
|
|
905
|
+
timestamp: Date;
|
|
906
|
+
/**
|
|
907
|
+
* The ID of the response model that was used to generate the response.
|
|
908
|
+
*/
|
|
909
|
+
modelId: string;
|
|
910
|
+
/**
|
|
911
|
+
* Response headers.
|
|
912
|
+
*/
|
|
913
|
+
headers: Record<string, string> | undefined;
|
|
914
|
+
};
|
|
915
|
+
/**
|
|
916
|
+
* Optional token usage for the image generation call (if the provider reports it).
|
|
917
|
+
*/
|
|
918
|
+
usage?: ImageModelV4Usage;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
type GetMaxImagesPerCallFunction$2 = (options: {
|
|
922
|
+
modelId: string;
|
|
923
|
+
}) => PromiseLike<number | undefined> | number | undefined;
|
|
924
|
+
/**
|
|
925
|
+
* Image generation model specification version 4.
|
|
926
|
+
*/
|
|
927
|
+
type ImageModelV4 = {
|
|
928
|
+
/**
|
|
929
|
+
* The image model must specify which image model interface
|
|
930
|
+
* version it implements. This will allow us to evolve the image
|
|
931
|
+
* model interface and retain backwards compatibility. The different
|
|
932
|
+
* implementation versions can be handled as a discriminated union
|
|
933
|
+
* on our side.
|
|
934
|
+
*/
|
|
935
|
+
readonly specificationVersion: 'v4';
|
|
936
|
+
/**
|
|
937
|
+
* Name of the provider for logging purposes.
|
|
938
|
+
*/
|
|
939
|
+
readonly provider: string;
|
|
940
|
+
/**
|
|
941
|
+
* Provider-specific model ID for logging purposes.
|
|
942
|
+
*/
|
|
943
|
+
readonly modelId: string;
|
|
944
|
+
/**
|
|
945
|
+
* Limit of how many images can be generated in a single API call.
|
|
946
|
+
* Can be set to a number for a fixed limit, to undefined to use
|
|
947
|
+
* the global limit, or a function that returns a number or undefined,
|
|
948
|
+
* optionally as a promise.
|
|
949
|
+
*/
|
|
950
|
+
readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction$2;
|
|
951
|
+
/**
|
|
952
|
+
* Generates an array of images.
|
|
953
|
+
*/
|
|
954
|
+
doGenerate(options: ImageModelV4CallOptions): PromiseLike<ImageModelV4Result>;
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Fields shared by every request in a batch.
|
|
959
|
+
*/
|
|
960
|
+
type BatchV4RequestBase<ModelId extends string = string> = {
|
|
961
|
+
/**
|
|
962
|
+
* Application-provided identifier used to correlate the request with its
|
|
963
|
+
* result.
|
|
964
|
+
*/
|
|
965
|
+
readonly id: string;
|
|
966
|
+
/**
|
|
967
|
+
* Provider-specific model ID for this request.
|
|
968
|
+
*/
|
|
969
|
+
readonly modelId: ModelId;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* One image generation request in a batch.
|
|
974
|
+
*/
|
|
975
|
+
type ImageBatchV4Request<ModelId extends string = string> = BatchV4RequestBase<ModelId> & {
|
|
976
|
+
readonly type: 'image';
|
|
977
|
+
readonly options: Pick<ImageModelV4CallOptions, 'prompt' | 'n' | 'size' | 'aspectRatio' | 'seed' | 'files' | 'mask' | 'providerOptions'>;
|
|
978
|
+
};
|
|
979
|
+
|
|
739
980
|
/**
|
|
740
981
|
* A tool has a name, a description, and a set of parameters.
|
|
741
982
|
*
|
|
@@ -1249,21 +1490,6 @@ type LanguageModelV4CallOptions = {
|
|
|
1249
1490
|
providerOptions?: SharedV4ProviderOptions;
|
|
1250
1491
|
};
|
|
1251
1492
|
|
|
1252
|
-
/**
|
|
1253
|
-
* Fields shared by every request in a batch.
|
|
1254
|
-
*/
|
|
1255
|
-
type BatchV4RequestBase<ModelId extends string = string> = {
|
|
1256
|
-
/**
|
|
1257
|
-
* Application-provided identifier used to correlate the request with its
|
|
1258
|
-
* result.
|
|
1259
|
-
*/
|
|
1260
|
-
readonly id: string;
|
|
1261
|
-
/**
|
|
1262
|
-
* Provider-specific model ID for this request.
|
|
1263
|
-
*/
|
|
1264
|
-
readonly modelId: ModelId;
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
1493
|
/**
|
|
1268
1494
|
* A normalized text generation request within a batch.
|
|
1269
1495
|
*/
|
|
@@ -1278,7 +1504,8 @@ type TextBatchV4Request<ModelId extends string = string> = BatchV4RequestBase<Mo
|
|
|
1278
1504
|
* Additional modality-specific model ID types can be added to this mapping.
|
|
1279
1505
|
*/
|
|
1280
1506
|
type BatchV4ModelIds = {
|
|
1281
|
-
readonly text
|
|
1507
|
+
readonly text?: string;
|
|
1508
|
+
readonly image?: string;
|
|
1282
1509
|
};
|
|
1283
1510
|
type BatchV4CallOptions = {
|
|
1284
1511
|
readonly providerOptions?: SharedV4ProviderOptions;
|
|
@@ -1319,7 +1546,7 @@ type BatchV4Status = {
|
|
|
1319
1546
|
readonly expiresAt?: string;
|
|
1320
1547
|
readonly providerMetadata?: SharedV4ProviderMetadata;
|
|
1321
1548
|
};
|
|
1322
|
-
type BatchV4Request<ModelIds extends BatchV4ModelIds = BatchV4ModelIds> = TextBatchV4Request<ModelIds['text']>;
|
|
1549
|
+
type BatchV4Request<ModelIds extends BatchV4ModelIds = BatchV4ModelIds> = TextBatchV4Request<ModelIds['text'] & string> | ImageBatchV4Request<ModelIds['image'] & string>;
|
|
1323
1550
|
/**
|
|
1324
1551
|
* Options for starting a batch of requests discriminated by modality.
|
|
1325
1552
|
*
|
|
@@ -1393,13 +1620,19 @@ type BatchV4ItemResultBase<RESULT> = {
|
|
|
1393
1620
|
type TextBatchV4ItemResult = {
|
|
1394
1621
|
readonly type: 'text';
|
|
1395
1622
|
} & BatchV4ItemResultBase<LanguageModelV4GenerateResult>;
|
|
1623
|
+
/**
|
|
1624
|
+
* A complete terminal result for one request in an image batch.
|
|
1625
|
+
*/
|
|
1626
|
+
type ImageBatchV4ItemResult = {
|
|
1627
|
+
readonly type: 'image';
|
|
1628
|
+
} & BatchV4ItemResultBase<ImageModelV4Result>;
|
|
1396
1629
|
/**
|
|
1397
1630
|
* A complete terminal result for one request in a batch, discriminated by
|
|
1398
1631
|
* modality.
|
|
1399
1632
|
*
|
|
1400
1633
|
* Additional modality-specific item results can be added to this union.
|
|
1401
1634
|
*/
|
|
1402
|
-
type BatchV4ItemResult = TextBatchV4ItemResult;
|
|
1635
|
+
type BatchV4ItemResult = TextBatchV4ItemResult | ImageBatchV4ItemResult;
|
|
1403
1636
|
/**
|
|
1404
1637
|
* Specification for a batch interface that implements batch interface version 4.
|
|
1405
1638
|
*/
|
|
@@ -2294,224 +2527,6 @@ type FilesV4 = {
|
|
|
2294
2527
|
deleteFile?(options: FilesV4DeleteFileCallOptions): PromiseLike<FilesV4DeleteFileResult>;
|
|
2295
2528
|
};
|
|
2296
2529
|
|
|
2297
|
-
/**
|
|
2298
|
-
* An image file that can be used for image editing or variation generation.
|
|
2299
|
-
*/
|
|
2300
|
-
type ImageModelV4File = {
|
|
2301
|
-
type: 'file';
|
|
2302
|
-
/**
|
|
2303
|
-
* The IANA media type of the file, e.g. `image/png`. Any string is supported.
|
|
2304
|
-
*
|
|
2305
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
2306
|
-
*/
|
|
2307
|
-
mediaType: string;
|
|
2308
|
-
/**
|
|
2309
|
-
* Generated file data as base64 encoded strings or binary data.
|
|
2310
|
-
*
|
|
2311
|
-
* The file data should be returned without any unnecessary conversion.
|
|
2312
|
-
* If the API returns base64 encoded strings, the file data should be returned
|
|
2313
|
-
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
2314
|
-
* be returned as binary data.
|
|
2315
|
-
*/
|
|
2316
|
-
data: string | Uint8Array;
|
|
2317
|
-
/**
|
|
2318
|
-
* Optional provider-specific metadata for the file part.
|
|
2319
|
-
*/
|
|
2320
|
-
providerOptions?: SharedV4ProviderMetadata;
|
|
2321
|
-
} | {
|
|
2322
|
-
type: 'url';
|
|
2323
|
-
/**
|
|
2324
|
-
* The URL of the image file.
|
|
2325
|
-
*/
|
|
2326
|
-
url: string;
|
|
2327
|
-
/**
|
|
2328
|
-
* Optional provider-specific metadata for the file part.
|
|
2329
|
-
*/
|
|
2330
|
-
providerOptions?: SharedV4ProviderMetadata;
|
|
2331
|
-
};
|
|
2332
|
-
|
|
2333
|
-
type ImageModelV4CallOptions = {
|
|
2334
|
-
/**
|
|
2335
|
-
* Prompt for the image generation. Some operations, like upscaling, may not require a prompt.
|
|
2336
|
-
*/
|
|
2337
|
-
prompt: string | undefined;
|
|
2338
|
-
/**
|
|
2339
|
-
* Number of images to generate.
|
|
2340
|
-
*/
|
|
2341
|
-
n: number;
|
|
2342
|
-
/**
|
|
2343
|
-
* Size of the images to generate.
|
|
2344
|
-
* Must have the format `{width}x{height}`.
|
|
2345
|
-
* `undefined` will use the provider's default size.
|
|
2346
|
-
*/
|
|
2347
|
-
size: `${number}x${number}` | undefined;
|
|
2348
|
-
/**
|
|
2349
|
-
* Aspect ratio of the images to generate.
|
|
2350
|
-
* Must have the format `{width}:{height}`.
|
|
2351
|
-
* `undefined` will use the provider's default aspect ratio.
|
|
2352
|
-
*/
|
|
2353
|
-
aspectRatio: `${number}:${number}` | undefined;
|
|
2354
|
-
/**
|
|
2355
|
-
* Seed for the image generation.
|
|
2356
|
-
* `undefined` will use the provider's default seed.
|
|
2357
|
-
*/
|
|
2358
|
-
seed: number | undefined;
|
|
2359
|
-
/**
|
|
2360
|
-
* Array of images for image editing or variation generation.
|
|
2361
|
-
* The images should be provided as base64 encoded strings or binary data.
|
|
2362
|
-
*/
|
|
2363
|
-
files: ImageModelV4File[] | undefined;
|
|
2364
|
-
/**
|
|
2365
|
-
* Mask image for inpainting operations.
|
|
2366
|
-
* The mask should be provided as base64 encoded strings or binary data.
|
|
2367
|
-
*/
|
|
2368
|
-
mask: ImageModelV4File | undefined;
|
|
2369
|
-
/**
|
|
2370
|
-
* Additional provider-specific options that are passed through to the provider
|
|
2371
|
-
* as body parameters.
|
|
2372
|
-
*
|
|
2373
|
-
* The outer record is keyed by the provider name, and the inner
|
|
2374
|
-
* record is keyed by the provider-specific metadata key.
|
|
2375
|
-
*
|
|
2376
|
-
* ```ts
|
|
2377
|
-
* {
|
|
2378
|
-
* "openai": {
|
|
2379
|
-
* "style": "vivid"
|
|
2380
|
-
* }
|
|
2381
|
-
* }
|
|
2382
|
-
* ```
|
|
2383
|
-
*/
|
|
2384
|
-
providerOptions: SharedV4ProviderOptions;
|
|
2385
|
-
/**
|
|
2386
|
-
* Abort signal for cancelling the operation.
|
|
2387
|
-
*/
|
|
2388
|
-
abortSignal?: AbortSignal;
|
|
2389
|
-
/**
|
|
2390
|
-
* Additional HTTP headers to be sent with the request.
|
|
2391
|
-
* Only applicable for HTTP-based providers.
|
|
2392
|
-
*/
|
|
2393
|
-
headers?: Record<string, string | undefined>;
|
|
2394
|
-
};
|
|
2395
|
-
|
|
2396
|
-
/**
|
|
2397
|
-
* Usage information for an image model call.
|
|
2398
|
-
*/
|
|
2399
|
-
type ImageModelV4Usage = {
|
|
2400
|
-
/**
|
|
2401
|
-
* The number of input (prompt) tokens used.
|
|
2402
|
-
*/
|
|
2403
|
-
inputTokens: number | undefined;
|
|
2404
|
-
/**
|
|
2405
|
-
* The number of output tokens used, if reported by the provider.
|
|
2406
|
-
*/
|
|
2407
|
-
outputTokens: number | undefined;
|
|
2408
|
-
/**
|
|
2409
|
-
* The total number of tokens as reported by the provider.
|
|
2410
|
-
*/
|
|
2411
|
-
totalTokens: number | undefined;
|
|
2412
|
-
};
|
|
2413
|
-
|
|
2414
|
-
type ImageModelV4ProviderMetadata = Record<string, {
|
|
2415
|
-
images: JSONArray;
|
|
2416
|
-
} & JSONValue>;
|
|
2417
|
-
/**
|
|
2418
|
-
* The result of an image model doGenerate call.
|
|
2419
|
-
*/
|
|
2420
|
-
type ImageModelV4Result = {
|
|
2421
|
-
/**
|
|
2422
|
-
* Generated images as base64 encoded strings or binary data.
|
|
2423
|
-
* The images should be returned without any unnecessary conversion.
|
|
2424
|
-
* If the API returns base64 encoded strings, the images should be returned
|
|
2425
|
-
* as base64 encoded strings. If the API returns binary data, the images should
|
|
2426
|
-
* be returned as binary data.
|
|
2427
|
-
*/
|
|
2428
|
-
images: Array<string> | Array<Uint8Array>;
|
|
2429
|
-
/**
|
|
2430
|
-
* Whether an unsuccessful result, such as an empty image result, can be
|
|
2431
|
-
* retried. When omitted, the result is unclassified.
|
|
2432
|
-
*/
|
|
2433
|
-
isRetryable?: boolean;
|
|
2434
|
-
/**
|
|
2435
|
-
* Warnings for the call, e.g. unsupported features.
|
|
2436
|
-
*/
|
|
2437
|
-
warnings: Array<SharedV4Warning>;
|
|
2438
|
-
/**
|
|
2439
|
-
* Additional provider-specific metadata. They are passed through
|
|
2440
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
2441
|
-
* results that can be fully encapsulated in the provider.
|
|
2442
|
-
*
|
|
2443
|
-
* The outer record is keyed by the provider name, and the inner
|
|
2444
|
-
* record is provider-specific metadata. It always includes an
|
|
2445
|
-
* `images` key with image-specific metadata
|
|
2446
|
-
*
|
|
2447
|
-
* ```ts
|
|
2448
|
-
* {
|
|
2449
|
-
* "openai": {
|
|
2450
|
-
* "images": ["revisedPrompt": "Revised prompt here."]
|
|
2451
|
-
* }
|
|
2452
|
-
* }
|
|
2453
|
-
* ```
|
|
2454
|
-
*/
|
|
2455
|
-
providerMetadata?: ImageModelV4ProviderMetadata;
|
|
2456
|
-
/**
|
|
2457
|
-
* Response information for telemetry and debugging purposes.
|
|
2458
|
-
*/
|
|
2459
|
-
response: {
|
|
2460
|
-
/**
|
|
2461
|
-
* Timestamp for the start of the generated response.
|
|
2462
|
-
*/
|
|
2463
|
-
timestamp: Date;
|
|
2464
|
-
/**
|
|
2465
|
-
* The ID of the response model that was used to generate the response.
|
|
2466
|
-
*/
|
|
2467
|
-
modelId: string;
|
|
2468
|
-
/**
|
|
2469
|
-
* Response headers.
|
|
2470
|
-
*/
|
|
2471
|
-
headers: Record<string, string> | undefined;
|
|
2472
|
-
};
|
|
2473
|
-
/**
|
|
2474
|
-
* Optional token usage for the image generation call (if the provider reports it).
|
|
2475
|
-
*/
|
|
2476
|
-
usage?: ImageModelV4Usage;
|
|
2477
|
-
};
|
|
2478
|
-
|
|
2479
|
-
type GetMaxImagesPerCallFunction$2 = (options: {
|
|
2480
|
-
modelId: string;
|
|
2481
|
-
}) => PromiseLike<number | undefined> | number | undefined;
|
|
2482
|
-
/**
|
|
2483
|
-
* Image generation model specification version 4.
|
|
2484
|
-
*/
|
|
2485
|
-
type ImageModelV4 = {
|
|
2486
|
-
/**
|
|
2487
|
-
* The image model must specify which image model interface
|
|
2488
|
-
* version it implements. This will allow us to evolve the image
|
|
2489
|
-
* model interface and retain backwards compatibility. The different
|
|
2490
|
-
* implementation versions can be handled as a discriminated union
|
|
2491
|
-
* on our side.
|
|
2492
|
-
*/
|
|
2493
|
-
readonly specificationVersion: 'v4';
|
|
2494
|
-
/**
|
|
2495
|
-
* Name of the provider for logging purposes.
|
|
2496
|
-
*/
|
|
2497
|
-
readonly provider: string;
|
|
2498
|
-
/**
|
|
2499
|
-
* Provider-specific model ID for logging purposes.
|
|
2500
|
-
*/
|
|
2501
|
-
readonly modelId: string;
|
|
2502
|
-
/**
|
|
2503
|
-
* Limit of how many images can be generated in a single API call.
|
|
2504
|
-
* Can be set to a number for a fixed limit, to undefined to use
|
|
2505
|
-
* the global limit, or a function that returns a number or undefined,
|
|
2506
|
-
* optionally as a promise.
|
|
2507
|
-
*/
|
|
2508
|
-
readonly maxImagesPerCall: number | undefined | GetMaxImagesPerCallFunction$2;
|
|
2509
|
-
/**
|
|
2510
|
-
* Generates an array of images.
|
|
2511
|
-
*/
|
|
2512
|
-
doGenerate(options: ImageModelV4CallOptions): PromiseLike<ImageModelV4Result>;
|
|
2513
|
-
};
|
|
2514
|
-
|
|
2515
2530
|
/**
|
|
2516
2531
|
* Usage information for an image model call.
|
|
2517
2532
|
*/
|
|
@@ -8242,4 +8257,4 @@ type VideoModelV3 = {
|
|
|
8242
8257
|
}>;
|
|
8243
8258
|
};
|
|
8244
8259
|
|
|
8245
|
-
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type BatchV4 as Experimental_BatchV4, type BatchV4CancelResult as Experimental_BatchV4CancelResult, type BatchV4Error as Experimental_BatchV4Error, type BatchV4ItemResult as Experimental_BatchV4ItemResult, type BatchV4ListItem as Experimental_BatchV4ListItem, type BatchV4ListOptions as Experimental_BatchV4ListOptions, type BatchV4ListResult as Experimental_BatchV4ListResult, type BatchV4ModelIds as Experimental_BatchV4ModelIds, type BatchV4OperationOptions as Experimental_BatchV4OperationOptions, type BatchV4Request as Experimental_BatchV4Request, type BatchV4RequestBase as Experimental_BatchV4RequestBase, type BatchV4StartOptions as Experimental_BatchV4StartOptions, type BatchV4StartResult as Experimental_BatchV4StartResult, type BatchV4Status as Experimental_BatchV4Status, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type SpeechTranslationModelV4 as Experimental_SpeechTranslationModelV4, type SpeechTranslationModelV4StreamOptions as Experimental_SpeechTranslationModelV4StreamOptions, type SpeechTranslationModelV4StreamPart as Experimental_SpeechTranslationModelV4StreamPart, type SpeechTranslationModelV4StreamResult as Experimental_SpeechTranslationModelV4StreamResult, type SpeechTranslationModelV4Usage as Experimental_SpeechTranslationModelV4Usage, type TextBatchV4ItemResult as Experimental_TextBatchV4ItemResult, type TextBatchV4Request as Experimental_TextBatchV4Request, type TranscriptionModelV4StreamOptions as Experimental_TranscriptionModelV4StreamOptions, type TranscriptionModelV4StreamPart as Experimental_TranscriptionModelV4StreamPart, type TranscriptionModelV4StreamResult as Experimental_TranscriptionModelV4StreamResult, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3FrameImage as Experimental_VideoModelV3FrameImage, type VideoModelV3FrameType as Experimental_VideoModelV3FrameType, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4FrameImage as Experimental_VideoModelV4FrameImage, type VideoModelV4FrameType as Experimental_VideoModelV4FrameType, type VideoModelV4OperationStartResult as Experimental_VideoModelV4OperationStartResult, type VideoModelV4OperationStatusResult as Experimental_VideoModelV4OperationStatusResult, type VideoModelV4OperationWebhook as Experimental_VideoModelV4OperationWebhook, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4DeleteFileCallOptions, type FilesV4DeleteFileResult, type FilesV4DownloadFileCallOptions, type FilesV4DownloadFileResult, type FilesV4GetFileMetadataCallOptions, type FilesV4GetFileMetadataResult, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type FilesV4UploadFileStreamData, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, 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, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4AudioFormat, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
|
8260
|
+
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type BatchV4 as Experimental_BatchV4, type BatchV4CancelResult as Experimental_BatchV4CancelResult, type BatchV4Error as Experimental_BatchV4Error, type BatchV4ItemResult as Experimental_BatchV4ItemResult, type BatchV4ListItem as Experimental_BatchV4ListItem, type BatchV4ListOptions as Experimental_BatchV4ListOptions, type BatchV4ListResult as Experimental_BatchV4ListResult, type BatchV4ModelIds as Experimental_BatchV4ModelIds, type BatchV4OperationOptions as Experimental_BatchV4OperationOptions, type BatchV4Request as Experimental_BatchV4Request, type BatchV4RequestBase as Experimental_BatchV4RequestBase, type BatchV4StartOptions as Experimental_BatchV4StartOptions, type BatchV4StartResult as Experimental_BatchV4StartResult, type BatchV4Status as Experimental_BatchV4Status, type ImageBatchV4ItemResult as Experimental_ImageBatchV4ItemResult, type ImageBatchV4Request as Experimental_ImageBatchV4Request, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type SpeechTranslationModelV4 as Experimental_SpeechTranslationModelV4, type SpeechTranslationModelV4StreamOptions as Experimental_SpeechTranslationModelV4StreamOptions, type SpeechTranslationModelV4StreamPart as Experimental_SpeechTranslationModelV4StreamPart, type SpeechTranslationModelV4StreamResult as Experimental_SpeechTranslationModelV4StreamResult, type SpeechTranslationModelV4Usage as Experimental_SpeechTranslationModelV4Usage, type TextBatchV4ItemResult as Experimental_TextBatchV4ItemResult, type TextBatchV4Request as Experimental_TextBatchV4Request, type TranscriptionModelV4StreamOptions as Experimental_TranscriptionModelV4StreamOptions, type TranscriptionModelV4StreamPart as Experimental_TranscriptionModelV4StreamPart, type TranscriptionModelV4StreamResult as Experimental_TranscriptionModelV4StreamResult, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3FrameImage as Experimental_VideoModelV3FrameImage, type VideoModelV3FrameType as Experimental_VideoModelV3FrameType, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4FrameImage as Experimental_VideoModelV4FrameImage, type VideoModelV4FrameType as Experimental_VideoModelV4FrameType, type VideoModelV4OperationStartResult as Experimental_VideoModelV4OperationStartResult, type VideoModelV4OperationStatusResult as Experimental_VideoModelV4OperationStatusResult, type VideoModelV4OperationWebhook as Experimental_VideoModelV4OperationWebhook, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4DeleteFileCallOptions, type FilesV4DeleteFileResult, type FilesV4DownloadFileCallOptions, type FilesV4DownloadFileResult, type FilesV4GetFileMetadataCallOptions, type FilesV4GetFileMetadataResult, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type FilesV4UploadFileStreamData, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, 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, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4AudioFormat, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|
package/package.json
CHANGED
package/src/batch/v4/batch-v4.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type {
|
|
|
4
4
|
SharedV4Warning,
|
|
5
5
|
} from '../../shared';
|
|
6
6
|
import type { LanguageModelV4GenerateResult } from '../../language-model/v4/language-model-v4-generate-result';
|
|
7
|
+
import type { ImageModelV4Result } from '../../image-model/v4';
|
|
8
|
+
import type { ImageBatchV4Request } from './image-batch-v4-request';
|
|
7
9
|
import type { TextBatchV4Request } from './text-batch-v4-request';
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -12,7 +14,8 @@ import type { TextBatchV4Request } from './text-batch-v4-request';
|
|
|
12
14
|
* Additional modality-specific model ID types can be added to this mapping.
|
|
13
15
|
*/
|
|
14
16
|
export type BatchV4ModelIds = {
|
|
15
|
-
readonly text
|
|
17
|
+
readonly text?: string;
|
|
18
|
+
readonly image?: string;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
type BatchV4CallOptions = {
|
|
@@ -59,7 +62,8 @@ export type BatchV4Status = {
|
|
|
59
62
|
};
|
|
60
63
|
|
|
61
64
|
export type BatchV4Request<ModelIds extends BatchV4ModelIds = BatchV4ModelIds> =
|
|
62
|
-
TextBatchV4Request<ModelIds['text']
|
|
65
|
+
| TextBatchV4Request<ModelIds['text'] & string>
|
|
66
|
+
| ImageBatchV4Request<ModelIds['image'] & string>;
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
69
|
* Options for starting a batch of requests discriminated by modality.
|
|
@@ -148,13 +152,20 @@ export type TextBatchV4ItemResult = {
|
|
|
148
152
|
readonly type: 'text';
|
|
149
153
|
} & BatchV4ItemResultBase<LanguageModelV4GenerateResult>;
|
|
150
154
|
|
|
155
|
+
/**
|
|
156
|
+
* A complete terminal result for one request in an image batch.
|
|
157
|
+
*/
|
|
158
|
+
export type ImageBatchV4ItemResult = {
|
|
159
|
+
readonly type: 'image';
|
|
160
|
+
} & BatchV4ItemResultBase<ImageModelV4Result>;
|
|
161
|
+
|
|
151
162
|
/**
|
|
152
163
|
* A complete terminal result for one request in a batch, discriminated by
|
|
153
164
|
* modality.
|
|
154
165
|
*
|
|
155
166
|
* Additional modality-specific item results can be added to this union.
|
|
156
167
|
*/
|
|
157
|
-
export type BatchV4ItemResult = TextBatchV4ItemResult;
|
|
168
|
+
export type BatchV4ItemResult = TextBatchV4ItemResult | ImageBatchV4ItemResult;
|
|
158
169
|
|
|
159
170
|
/**
|
|
160
171
|
* Specification for a batch interface that implements batch interface version 4.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ImageModelV4CallOptions } from '../../image-model/v4';
|
|
2
|
+
import type { BatchV4RequestBase } from './batch-v4-request';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One image generation request in a batch.
|
|
6
|
+
*/
|
|
7
|
+
export type ImageBatchV4Request<ModelId extends string = string> =
|
|
8
|
+
BatchV4RequestBase<ModelId> & {
|
|
9
|
+
readonly type: 'image';
|
|
10
|
+
readonly options: Pick<
|
|
11
|
+
ImageModelV4CallOptions,
|
|
12
|
+
| 'prompt'
|
|
13
|
+
| 'n'
|
|
14
|
+
| 'size'
|
|
15
|
+
| 'aspectRatio'
|
|
16
|
+
| 'seed'
|
|
17
|
+
| 'files'
|
|
18
|
+
| 'mask'
|
|
19
|
+
| 'providerOptions'
|
|
20
|
+
>;
|
|
21
|
+
};
|
package/src/batch/v4/index.ts
CHANGED
|
@@ -12,7 +12,9 @@ export type {
|
|
|
12
12
|
BatchV4StartOptions as Experimental_BatchV4StartOptions,
|
|
13
13
|
BatchV4StartResult as Experimental_BatchV4StartResult,
|
|
14
14
|
BatchV4Status as Experimental_BatchV4Status,
|
|
15
|
+
ImageBatchV4ItemResult as Experimental_ImageBatchV4ItemResult,
|
|
15
16
|
TextBatchV4ItemResult as Experimental_TextBatchV4ItemResult,
|
|
16
17
|
} from './batch-v4';
|
|
17
18
|
export type { BatchV4RequestBase as Experimental_BatchV4RequestBase } from './batch-v4-request';
|
|
18
19
|
export type { TextBatchV4Request as Experimental_TextBatchV4Request } from './text-batch-v4-request';
|
|
20
|
+
export type { ImageBatchV4Request as Experimental_ImageBatchV4Request } from './image-batch-v4-request';
|