Skip to content

Commit cd2d70c

Browse files
committed
feat: expand audio format support in OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING
1 parent da1a1d0 commit cd2d70c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/providers/google-vertex-ai/utils.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,23 @@ export const isEmbeddingModel = (modelName: string) => {
716716
export const OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING = {
717717
mp3: 'audio/mp3',
718718
wav: 'audio/wav',
719+
opus: 'audio/ogg',
720+
flac: 'audio/flac',
721+
pcm16: 'audio/pcm',
722+
'x-aac': 'audio/aac',
723+
'x-m4a': 'audio/m4a',
724+
mpeg: 'audio/mpeg',
725+
mpga: 'audio/mpga',
726+
mp4: 'audio/mp4',
727+
webm: 'audio/webm',
719728
};
720729

721730
export const transformInputAudioPart = (c: ContentType): GoogleMessagePart => {
722731
const data = c.input_audio?.data;
723732
const mimeType =
724733
OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING[
725-
c.input_audio?.format as 'mp3' | 'wav'
734+
c.input_audio
735+
?.format as keyof typeof OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING
726736
];
727737
return {
728738
inlineData: {

0 commit comments

Comments
 (0)