File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
src/providers/google-vertex-ai Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,10 @@ export const VertexGoogleChatCompleteConfig: ProviderConfig = {
354354 param : 'generationConfig' ,
355355 transform : ( params : Params ) => transformGenerationConfig ( params ) ,
356356 } ,
357+ modalities : {
358+ param : 'generationConfig' ,
359+ transform : ( params : Params ) => transformGenerationConfig ( params ) ,
360+ } ,
357361} ;
358362
359363interface AnthorpicTextContentItem {
@@ -479,6 +483,13 @@ export const GoogleChatCompleteResponseTransform: (
479483 content = part . text ;
480484 contentBlocks . push ( { type : 'text' , text : part . text } ) ;
481485 }
486+ } else if ( part . inlineData ) {
487+ contentBlocks . push ( {
488+ type : 'image_url' ,
489+ image_url : {
490+ url : `data:${ part . inlineData . mimeType } ;base64,${ part . inlineData . data } ` ,
491+ } ,
492+ } ) ;
482493 }
483494 }
484495
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ export function transformGenerationConfig(params: Params) {
5757 thinkingConfig [ 'thinking_budget' ] = budget_tokens ;
5858 generationConfig [ 'thinking_config' ] = thinkingConfig ;
5959 }
60+ if ( params . modalities ) {
61+ generationConfig [ 'responseModalities' ] = params . modalities . map ( ( modality ) =>
62+ modality . toUpperCase ( )
63+ ) ;
64+ }
6065
6166 return generationConfig ;
6267}
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ export interface GoogleResponseCandidate {
2020 text ?: string ;
2121 thought ?: string ; // for models like gemini-2.0-flash-thinking-exp refer: https://ai.google.dev/gemini-api/docs/thinking-mode#streaming_model_thinking
2222 functionCall ?: GoogleGenerateFunctionCall ;
23+ inlineData ?: {
24+ mimeType : string ;
25+ data : string ;
26+ } ;
2327 } [ ] ;
2428 } ;
2529 logprobsResult ?: {
You can’t perform that action at this time.
0 commit comments