@ai-sdk/google-vertex 5.0.49 → 5.0.51
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 +19 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/edge/index.d.ts +1 -1
- package/dist/edge/index.js +216 -80
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +216 -80
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/package.json +5 -5
- package/src/google-vertex-cloud-tts-speech-model.ts +188 -0
- package/src/google-vertex-provider-base.ts +19 -2
- package/src/google-vertex-speech-model-options.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 5.0.51
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [7fbfc6d]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.27
|
|
9
|
+
- @ai-sdk/anthropic@4.0.38
|
|
10
|
+
- @ai-sdk/google@4.0.42
|
|
11
|
+
- @ai-sdk/openai-compatible@3.0.30
|
|
12
|
+
|
|
13
|
+
## 5.0.50
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 6d9951b: feat(provider/google-vertex): add Chirp 3 HD voices (Cloud Text-to-Speech) speech model
|
|
18
|
+
- Updated dependencies [da78d58]
|
|
19
|
+
- Updated dependencies [8a2482d]
|
|
20
|
+
- @ai-sdk/google@4.0.41
|
|
21
|
+
|
|
3
22
|
## 5.0.49
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ type GoogleVertexTranscriptionModelId = 'chirp_2' | 'chirp_3' | 'telephony' | (s
|
|
|
74
74
|
|
|
75
75
|
type GoogleVertexVideoModelId = 'veo-2.0-generate-preview' | 'veo-2.0-generate-exp' | 'veo-2.0-generate-001' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-3.0-generate-preview' | 'veo-3.0-fast-generate-preview' | 'veo-3.1-generate-001' | 'veo-3.1-fast-generate-001' | 'veo-3.1-generate-preview' | 'veo-3.1-fast-generate-preview' | (string & {});
|
|
76
76
|
|
|
77
|
-
type GoogleVertexSpeechModelId = 'gemini-2.5-flash-tts' | 'gemini-2.5-pro-tts' | 'gemini-2.5-flash-lite-preview-tts' | 'gemini-3.1-flash-tts-preview' | (string & {});
|
|
77
|
+
type GoogleVertexSpeechModelId = 'gemini-2.5-flash-tts' | 'gemini-2.5-pro-tts' | 'gemini-2.5-flash-lite-preview-tts' | 'gemini-3.1-flash-tts-preview' | 'chirp-3-hd' | (string & {});
|
|
78
78
|
|
|
79
79
|
interface GoogleVertexProvider extends ProviderV4 {
|
|
80
80
|
/**
|
package/dist/edge/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/edge/google-vertex-provider-edge.ts
|
|
2
|
-
import { loadOptionalSetting as loadOptionalSetting3, resolve as
|
|
2
|
+
import { loadOptionalSetting as loadOptionalSetting3, resolve as resolve7 } from "@ai-sdk/provider-utils";
|
|
3
3
|
|
|
4
4
|
// src/google-vertex-provider-base.ts
|
|
5
5
|
import {
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
loadOptionalSetting,
|
|
13
13
|
loadSetting,
|
|
14
14
|
normalizeHeaders,
|
|
15
|
-
resolve as
|
|
15
|
+
resolve as resolve6,
|
|
16
16
|
withoutTrailingSlash,
|
|
17
17
|
withUserAgentSuffix
|
|
18
18
|
} from "@ai-sdk/provider-utils";
|
|
19
19
|
|
|
20
20
|
// src/version.ts
|
|
21
|
-
var VERSION = true ? "5.0.
|
|
21
|
+
var VERSION = true ? "5.0.51" : "0.0.0-test";
|
|
22
22
|
|
|
23
23
|
// src/google-vertex-embedding-model.ts
|
|
24
24
|
import {
|
|
@@ -629,6 +629,127 @@ function getBase64Data(file) {
|
|
|
629
629
|
return convertUint8ArrayToBase64(file.data);
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
+
// src/google-vertex-cloud-tts-speech-model.ts
|
|
633
|
+
import {
|
|
634
|
+
combineHeaders as combineHeaders3,
|
|
635
|
+
convertBase64ToUint8Array,
|
|
636
|
+
createJsonResponseHandler as createJsonResponseHandler3,
|
|
637
|
+
postJsonToApi as postJsonToApi3,
|
|
638
|
+
resolve as resolve3,
|
|
639
|
+
serializeModelOptions as serializeModelOptions3,
|
|
640
|
+
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3,
|
|
641
|
+
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3
|
|
642
|
+
} from "@ai-sdk/provider-utils";
|
|
643
|
+
import { z as z6 } from "zod/v4";
|
|
644
|
+
var DEFAULT_VOICE = "Kore";
|
|
645
|
+
var DEFAULT_LANGUAGE = "en-US";
|
|
646
|
+
var CHIRP3_HD_VOICE_INFIX = "Chirp3-HD";
|
|
647
|
+
var CLOUD_TTS_SYNTHESIZE_URL = "https://texttospeech.googleapis.com/v1/text:synthesize";
|
|
648
|
+
var GoogleVertexCloudTTSSpeechModel = class _GoogleVertexCloudTTSSpeechModel {
|
|
649
|
+
constructor(modelId, config) {
|
|
650
|
+
this.modelId = modelId;
|
|
651
|
+
this.config = config;
|
|
652
|
+
this.specificationVersion = "v4";
|
|
653
|
+
}
|
|
654
|
+
static [WORKFLOW_SERIALIZE3](model) {
|
|
655
|
+
return serializeModelOptions3({
|
|
656
|
+
modelId: model.modelId,
|
|
657
|
+
config: model.config
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
static [WORKFLOW_DESERIALIZE3](options) {
|
|
661
|
+
return new _GoogleVertexCloudTTSSpeechModel(options.modelId, options.config);
|
|
662
|
+
}
|
|
663
|
+
get provider() {
|
|
664
|
+
return this.config.provider;
|
|
665
|
+
}
|
|
666
|
+
async doGenerate(options) {
|
|
667
|
+
var _a, _b, _c;
|
|
668
|
+
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
669
|
+
const warnings = [];
|
|
670
|
+
const {
|
|
671
|
+
text,
|
|
672
|
+
voice = DEFAULT_VOICE,
|
|
673
|
+
outputFormat,
|
|
674
|
+
instructions,
|
|
675
|
+
speed,
|
|
676
|
+
language
|
|
677
|
+
} = options;
|
|
678
|
+
let voiceName;
|
|
679
|
+
let languageCode;
|
|
680
|
+
if (voice.includes(CHIRP3_HD_VOICE_INFIX)) {
|
|
681
|
+
voiceName = voice;
|
|
682
|
+
const localePrefix = voice.split(CHIRP3_HD_VOICE_INFIX)[0].replace(/-$/, "");
|
|
683
|
+
languageCode = language != null ? language : localePrefix || DEFAULT_LANGUAGE;
|
|
684
|
+
} else {
|
|
685
|
+
languageCode = language != null ? language : DEFAULT_LANGUAGE;
|
|
686
|
+
voiceName = `${languageCode}-${CHIRP3_HD_VOICE_INFIX}-${voice}`;
|
|
687
|
+
}
|
|
688
|
+
if (instructions != null) {
|
|
689
|
+
warnings.push({
|
|
690
|
+
type: "unsupported",
|
|
691
|
+
feature: "instructions",
|
|
692
|
+
details: "Google Cloud Text-to-Speech Chirp 3: HD voices do not support the `instructions` option. It was ignored."
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
if (outputFormat != null && outputFormat !== "wav") {
|
|
696
|
+
warnings.push({
|
|
697
|
+
type: "unsupported",
|
|
698
|
+
feature: "outputFormat",
|
|
699
|
+
details: `Unsupported output format: ${outputFormat}. Using wav instead.`
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
const requestBody = {
|
|
703
|
+
input: { text },
|
|
704
|
+
voice: { languageCode, name: voiceName },
|
|
705
|
+
audioConfig: {
|
|
706
|
+
audioEncoding: "LINEAR16",
|
|
707
|
+
...speed != null ? { speakingRate: speed } : {}
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
const {
|
|
711
|
+
value: response,
|
|
712
|
+
responseHeaders,
|
|
713
|
+
rawValue: rawResponse
|
|
714
|
+
} = await postJsonToApi3({
|
|
715
|
+
url: CLOUD_TTS_SYNTHESIZE_URL,
|
|
716
|
+
headers: combineHeaders3(
|
|
717
|
+
this.config.headers ? await resolve3(this.config.headers) : void 0,
|
|
718
|
+
options.headers
|
|
719
|
+
),
|
|
720
|
+
body: requestBody,
|
|
721
|
+
failedResponseHandler: googleVertexFailedResponseHandler,
|
|
722
|
+
successfulResponseHandler: createJsonResponseHandler3(
|
|
723
|
+
googleVertexCloudTTSResponseSchema
|
|
724
|
+
),
|
|
725
|
+
abortSignal: options.abortSignal,
|
|
726
|
+
fetch: this.config.fetch
|
|
727
|
+
});
|
|
728
|
+
const audio = response.audioContent != null ? convertBase64ToUint8Array(response.audioContent) : new Uint8Array(0);
|
|
729
|
+
return {
|
|
730
|
+
audio,
|
|
731
|
+
warnings,
|
|
732
|
+
request: {
|
|
733
|
+
body: JSON.stringify(requestBody)
|
|
734
|
+
},
|
|
735
|
+
response: {
|
|
736
|
+
timestamp: currentDate,
|
|
737
|
+
modelId: this.modelId,
|
|
738
|
+
headers: responseHeaders,
|
|
739
|
+
body: rawResponse
|
|
740
|
+
},
|
|
741
|
+
providerMetadata: {
|
|
742
|
+
google: {
|
|
743
|
+
mimeType: "audio/wav"
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
var googleVertexCloudTTSResponseSchema = z6.object({
|
|
750
|
+
audioContent: z6.string().nullish()
|
|
751
|
+
});
|
|
752
|
+
|
|
632
753
|
// src/google-vertex-tools.ts
|
|
633
754
|
import { googleTools } from "@ai-sdk/google/internal";
|
|
634
755
|
var googleVertexTools = {
|
|
@@ -643,31 +764,31 @@ var googleVertexTools = {
|
|
|
643
764
|
|
|
644
765
|
// src/google-vertex-transcription-model.ts
|
|
645
766
|
import {
|
|
646
|
-
combineHeaders as
|
|
767
|
+
combineHeaders as combineHeaders4,
|
|
647
768
|
convertUint8ArrayToBase64 as convertUint8ArrayToBase642,
|
|
648
|
-
createJsonResponseHandler as
|
|
769
|
+
createJsonResponseHandler as createJsonResponseHandler4,
|
|
649
770
|
parseProviderOptions as parseProviderOptions3,
|
|
650
|
-
postJsonToApi as
|
|
651
|
-
resolve as
|
|
652
|
-
serializeModelOptions as
|
|
653
|
-
WORKFLOW_DESERIALIZE as
|
|
654
|
-
WORKFLOW_SERIALIZE as
|
|
771
|
+
postJsonToApi as postJsonToApi4,
|
|
772
|
+
resolve as resolve4,
|
|
773
|
+
serializeModelOptions as serializeModelOptions4,
|
|
774
|
+
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE4,
|
|
775
|
+
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE4
|
|
655
776
|
} from "@ai-sdk/provider-utils";
|
|
656
|
-
import { z as
|
|
777
|
+
import { z as z8 } from "zod/v4";
|
|
657
778
|
|
|
658
779
|
// src/google-vertex-transcription-model-options.ts
|
|
659
|
-
import { z as
|
|
660
|
-
var googleVertexTranscriptionProviderOptionsSchema =
|
|
780
|
+
import { z as z7 } from "zod/v4";
|
|
781
|
+
var googleVertexTranscriptionProviderOptionsSchema = z7.object({
|
|
661
782
|
/**
|
|
662
783
|
* BCP-47 language codes to recognize (e.g. `['en-US']`), or `['auto']` to let
|
|
663
784
|
* Chirp auto-detect the spoken language. Defaults to `['auto']`. For
|
|
664
785
|
* `telephony`, pass a supported explicit language code.
|
|
665
786
|
*/
|
|
666
|
-
languageCodes:
|
|
787
|
+
languageCodes: z7.array(z7.string()).optional(),
|
|
667
788
|
/**
|
|
668
789
|
* Whether to add punctuation to the transcript. Defaults to `true`.
|
|
669
790
|
*/
|
|
670
|
-
enableAutomaticPunctuation:
|
|
791
|
+
enableAutomaticPunctuation: z7.boolean().optional(),
|
|
671
792
|
/**
|
|
672
793
|
* Whether to include word-level timestamps. Defaults to `true` so the
|
|
673
794
|
* transcription result can include segments.
|
|
@@ -675,7 +796,7 @@ var googleVertexTranscriptionProviderOptionsSchema = z6.object({
|
|
|
675
796
|
* Enabling word-level timestamps can reduce transcription quality and speed
|
|
676
797
|
* for Chirp models.
|
|
677
798
|
*/
|
|
678
|
-
enableWordTimeOffsets:
|
|
799
|
+
enableWordTimeOffsets: z7.boolean().optional(),
|
|
679
800
|
/**
|
|
680
801
|
* The Cloud Speech-to-Text region for the request (e.g. `'us'`, `'eu'`,
|
|
681
802
|
* `'us-central1'`). Defaults to the provider `location`.
|
|
@@ -684,7 +805,7 @@ var googleVertexTranscriptionProviderOptionsSchema = z6.object({
|
|
|
684
805
|
* available in specific Speech-to-Text regions and is not available in the
|
|
685
806
|
* `global` location.
|
|
686
807
|
*/
|
|
687
|
-
region:
|
|
808
|
+
region: z7.string().optional()
|
|
688
809
|
});
|
|
689
810
|
|
|
690
811
|
// src/google-vertex-transcription-model.ts
|
|
@@ -712,13 +833,13 @@ var GoogleVertexTranscriptionModel = class _GoogleVertexTranscriptionModel {
|
|
|
712
833
|
this.config = config;
|
|
713
834
|
this.specificationVersion = "v4";
|
|
714
835
|
}
|
|
715
|
-
static [
|
|
716
|
-
return
|
|
836
|
+
static [WORKFLOW_SERIALIZE4](model) {
|
|
837
|
+
return serializeModelOptions4({
|
|
717
838
|
modelId: model.modelId,
|
|
718
839
|
config: model.config
|
|
719
840
|
});
|
|
720
841
|
}
|
|
721
|
-
static [
|
|
842
|
+
static [WORKFLOW_DESERIALIZE4](options) {
|
|
722
843
|
return new _GoogleVertexTranscriptionModel(options.modelId, options.config);
|
|
723
844
|
}
|
|
724
845
|
get provider() {
|
|
@@ -762,15 +883,15 @@ var GoogleVertexTranscriptionModel = class _GoogleVertexTranscriptionModel {
|
|
|
762
883
|
value: response,
|
|
763
884
|
responseHeaders,
|
|
764
885
|
rawValue: rawResponse
|
|
765
|
-
} = await
|
|
886
|
+
} = await postJsonToApi4({
|
|
766
887
|
url,
|
|
767
|
-
headers:
|
|
768
|
-
this.config.headers ? await
|
|
888
|
+
headers: combineHeaders4(
|
|
889
|
+
this.config.headers ? await resolve4(this.config.headers) : void 0,
|
|
769
890
|
options.headers
|
|
770
891
|
),
|
|
771
892
|
body: requestBody,
|
|
772
893
|
failedResponseHandler: googleVertexFailedResponseHandler,
|
|
773
|
-
successfulResponseHandler:
|
|
894
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
774
895
|
googleVertexTranscriptionResponseSchema
|
|
775
896
|
),
|
|
776
897
|
abortSignal: options.abortSignal,
|
|
@@ -809,26 +930,26 @@ var GoogleVertexTranscriptionModel = class _GoogleVertexTranscriptionModel {
|
|
|
809
930
|
};
|
|
810
931
|
}
|
|
811
932
|
};
|
|
812
|
-
var googleVertexTranscriptionResponseSchema =
|
|
813
|
-
results:
|
|
814
|
-
|
|
815
|
-
alternatives:
|
|
816
|
-
|
|
817
|
-
transcript:
|
|
818
|
-
words:
|
|
819
|
-
|
|
820
|
-
word:
|
|
821
|
-
startOffset:
|
|
822
|
-
endOffset:
|
|
933
|
+
var googleVertexTranscriptionResponseSchema = z8.object({
|
|
934
|
+
results: z8.array(
|
|
935
|
+
z8.object({
|
|
936
|
+
alternatives: z8.array(
|
|
937
|
+
z8.object({
|
|
938
|
+
transcript: z8.string().nullish(),
|
|
939
|
+
words: z8.array(
|
|
940
|
+
z8.object({
|
|
941
|
+
word: z8.string().nullish(),
|
|
942
|
+
startOffset: z8.string().nullish(),
|
|
943
|
+
endOffset: z8.string().nullish()
|
|
823
944
|
})
|
|
824
945
|
).nullish()
|
|
825
946
|
})
|
|
826
947
|
).nullish(),
|
|
827
|
-
languageCode:
|
|
948
|
+
languageCode: z8.string().nullish()
|
|
828
949
|
})
|
|
829
950
|
).nullish(),
|
|
830
|
-
metadata:
|
|
831
|
-
totalBilledDuration:
|
|
951
|
+
metadata: z8.object({
|
|
952
|
+
totalBilledDuration: z8.string().nullish()
|
|
832
953
|
}).nullish()
|
|
833
954
|
});
|
|
834
955
|
|
|
@@ -837,31 +958,31 @@ import {
|
|
|
837
958
|
AISDKError
|
|
838
959
|
} from "@ai-sdk/provider";
|
|
839
960
|
import {
|
|
840
|
-
combineHeaders as
|
|
961
|
+
combineHeaders as combineHeaders5,
|
|
841
962
|
convertUint8ArrayToBase64 as convertUint8ArrayToBase643,
|
|
842
|
-
createJsonResponseHandler as
|
|
963
|
+
createJsonResponseHandler as createJsonResponseHandler5,
|
|
843
964
|
parseProviderOptions as parseProviderOptions4,
|
|
844
|
-
postJsonToApi as
|
|
845
|
-
resolve as
|
|
965
|
+
postJsonToApi as postJsonToApi5,
|
|
966
|
+
resolve as resolve5
|
|
846
967
|
} from "@ai-sdk/provider-utils";
|
|
847
|
-
import { z as
|
|
968
|
+
import { z as z10 } from "zod/v4";
|
|
848
969
|
|
|
849
970
|
// src/google-vertex-video-model-options.ts
|
|
850
971
|
import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
|
|
851
|
-
import { z as
|
|
972
|
+
import { z as z9 } from "zod/v4";
|
|
852
973
|
var googleVertexVideoModelOptionsSchema = lazySchema(
|
|
853
974
|
() => zodSchema(
|
|
854
|
-
|
|
855
|
-
pollIntervalMs:
|
|
856
|
-
pollTimeoutMs:
|
|
857
|
-
personGeneration:
|
|
858
|
-
negativePrompt:
|
|
859
|
-
generateAudio:
|
|
860
|
-
gcsOutputDirectory:
|
|
861
|
-
referenceImages:
|
|
862
|
-
|
|
863
|
-
bytesBase64Encoded:
|
|
864
|
-
gcsUri:
|
|
975
|
+
z9.looseObject({
|
|
976
|
+
pollIntervalMs: z9.number().positive().nullish(),
|
|
977
|
+
pollTimeoutMs: z9.number().positive().nullish(),
|
|
978
|
+
personGeneration: z9.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
979
|
+
negativePrompt: z9.string().nullish(),
|
|
980
|
+
generateAudio: z9.boolean().nullish(),
|
|
981
|
+
gcsOutputDirectory: z9.string().nullish(),
|
|
982
|
+
referenceImages: z9.array(
|
|
983
|
+
z9.object({
|
|
984
|
+
bytesBase64Encoded: z9.string().nullish(),
|
|
985
|
+
gcsUri: z9.string().nullish()
|
|
865
986
|
})
|
|
866
987
|
).nullish()
|
|
867
988
|
})
|
|
@@ -1082,17 +1203,17 @@ var GoogleVertexVideoModel = class {
|
|
|
1082
1203
|
var _a, _b, _c;
|
|
1083
1204
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1084
1205
|
const { instances, parameters, warnings } = await this.buildRequest(options);
|
|
1085
|
-
const { value: operation, responseHeaders } = await
|
|
1206
|
+
const { value: operation, responseHeaders } = await postJsonToApi5({
|
|
1086
1207
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
1087
|
-
headers:
|
|
1088
|
-
await
|
|
1208
|
+
headers: combineHeaders5(
|
|
1209
|
+
await resolve5(this.config.headers),
|
|
1089
1210
|
options.headers
|
|
1090
1211
|
),
|
|
1091
1212
|
body: {
|
|
1092
1213
|
instances,
|
|
1093
1214
|
parameters
|
|
1094
1215
|
},
|
|
1095
|
-
successfulResponseHandler:
|
|
1216
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
1096
1217
|
googleVertexOperationSchema
|
|
1097
1218
|
),
|
|
1098
1219
|
failedResponseHandler: googleVertexFailedResponseHandler,
|
|
@@ -1120,16 +1241,16 @@ var GoogleVertexVideoModel = class {
|
|
|
1120
1241
|
var _a, _b, _c;
|
|
1121
1242
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1122
1243
|
const { operationName } = options.operation;
|
|
1123
|
-
const { value: statusOperation, responseHeaders } = await
|
|
1244
|
+
const { value: statusOperation, responseHeaders } = await postJsonToApi5({
|
|
1124
1245
|
url: `${this.config.baseURL}/models/${this.modelId}:fetchPredictOperation`,
|
|
1125
|
-
headers:
|
|
1126
|
-
await
|
|
1246
|
+
headers: combineHeaders5(
|
|
1247
|
+
await resolve5(this.config.headers),
|
|
1127
1248
|
options.headers
|
|
1128
1249
|
),
|
|
1129
1250
|
body: {
|
|
1130
1251
|
operationName
|
|
1131
1252
|
},
|
|
1132
|
-
successfulResponseHandler:
|
|
1253
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
1133
1254
|
googleVertexOperationSchema
|
|
1134
1255
|
),
|
|
1135
1256
|
failedResponseHandler: googleVertexFailedResponseHandler,
|
|
@@ -1165,23 +1286,23 @@ var GoogleVertexVideoModel = class {
|
|
|
1165
1286
|
});
|
|
1166
1287
|
}
|
|
1167
1288
|
};
|
|
1168
|
-
var googleVertexOperationSchema =
|
|
1169
|
-
name:
|
|
1170
|
-
done:
|
|
1171
|
-
error:
|
|
1172
|
-
code:
|
|
1173
|
-
message:
|
|
1174
|
-
status:
|
|
1289
|
+
var googleVertexOperationSchema = z10.object({
|
|
1290
|
+
name: z10.string().nullish(),
|
|
1291
|
+
done: z10.boolean().nullish(),
|
|
1292
|
+
error: z10.object({
|
|
1293
|
+
code: z10.number().nullish(),
|
|
1294
|
+
message: z10.string(),
|
|
1295
|
+
status: z10.string().nullish()
|
|
1175
1296
|
}).nullish(),
|
|
1176
|
-
response:
|
|
1177
|
-
videos:
|
|
1178
|
-
|
|
1179
|
-
bytesBase64Encoded:
|
|
1180
|
-
gcsUri:
|
|
1181
|
-
mimeType:
|
|
1297
|
+
response: z10.object({
|
|
1298
|
+
videos: z10.array(
|
|
1299
|
+
z10.object({
|
|
1300
|
+
bytesBase64Encoded: z10.string().nullish(),
|
|
1301
|
+
gcsUri: z10.string().nullish(),
|
|
1302
|
+
mimeType: z10.string().nullish()
|
|
1182
1303
|
})
|
|
1183
1304
|
).nullish(),
|
|
1184
|
-
raiMediaFilteredCount:
|
|
1305
|
+
raiMediaFilteredCount: z10.number().nullish()
|
|
1185
1306
|
}).nullish()
|
|
1186
1307
|
});
|
|
1187
1308
|
|
|
@@ -1241,7 +1362,7 @@ function createGoogleVertex(options = {}) {
|
|
|
1241
1362
|
const createConfig = (name, { endpoint = false } = {}) => {
|
|
1242
1363
|
const getHeaders = async () => {
|
|
1243
1364
|
var _a;
|
|
1244
|
-
const originalHeaders = await
|
|
1365
|
+
const originalHeaders = await resolve6((_a = options.headers) != null ? _a : {});
|
|
1245
1366
|
return withUserAgentSuffix(
|
|
1246
1367
|
originalHeaders,
|
|
1247
1368
|
`ai-sdk/google-vertex/${VERSION}`
|
|
@@ -1309,7 +1430,22 @@ function createGoogleVertex(options = {}) {
|
|
|
1309
1430
|
generateId: (_a = options.generateId) != null ? _a : generateId
|
|
1310
1431
|
});
|
|
1311
1432
|
};
|
|
1312
|
-
const createSpeechModel = (modelId) =>
|
|
1433
|
+
const createSpeechModel = (modelId) => {
|
|
1434
|
+
if (modelId.startsWith("chirp")) {
|
|
1435
|
+
if (apiKey) {
|
|
1436
|
+
throw new Error(
|
|
1437
|
+
"Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead."
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
const config = createConfig("speech");
|
|
1441
|
+
return new GoogleVertexCloudTTSSpeechModel(modelId, {
|
|
1442
|
+
provider: config.provider,
|
|
1443
|
+
headers: config.headers,
|
|
1444
|
+
fetch: config.fetch
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
return new GoogleSpeechModel(modelId, createConfig("speech"));
|
|
1448
|
+
};
|
|
1313
1449
|
const createTranscriptionModel = (modelId) => {
|
|
1314
1450
|
if (apiKey) {
|
|
1315
1451
|
throw new Error(
|
|
@@ -1476,7 +1612,7 @@ function createGoogleVertex2(options = {}) {
|
|
|
1476
1612
|
Authorization: `Bearer ${await generateAuthToken(
|
|
1477
1613
|
options.googleCredentials
|
|
1478
1614
|
)}`,
|
|
1479
|
-
...await
|
|
1615
|
+
...await resolve7(options.headers)
|
|
1480
1616
|
})
|
|
1481
1617
|
});
|
|
1482
1618
|
}
|