@@ -1265,28 +1265,22 @@ export class GeminiProvider extends BaseModelProvider {
12651265
12661266 // If using Gemini image models that expose image parts via generateContentStream
12671267 if ( model . includes ( 'gemini-2.5-flash-image-preview' ) || model . includes ( 'gemini-3-pro-image-preview' ) ) {
1268- // Build a constraints hint to emulate feature parity (aspect ratio, size, style, background)
1269- const constraints : string [ ] = [ ] ;
1270- // Map size to human-friendly instructions
1271- const sizeMap : Record < string , { ar ?: string ; px ?: string } > = {
1272- square : { ar : '1:1' , px : '1024x1024' } ,
1268+ // Use imageConfig for aspect ratio / size; do not inject size/aspect instructions into the prompt.
1269+ const sizeMap : Record < string , { ar ?: string } > = {
1270+ square : { ar : '1:1' } ,
12731271 landscape : { ar : '16:9' } ,
12741272 portrait : { ar : '9:16' } ,
1275- '256x256' : { ar : '1:1' , px : '256x256' } ,
1276- '512x512' : { ar : '1:1' , px : '512x512' } ,
1277- '1024x1024' : { ar : '1:1' , px : '1024x1024' } ,
1278- '1536x1024' : { ar : '3:2' , px : '1536x1024' } ,
1279- '1024x1536' : { ar : '2:3' , px : '1024x1536' } ,
1280- '1696x2528' : { ar : '2:3' , px : '1696x2528' } ,
1281- '2048x2048' : { ar : '1:1' , px : '2048x2048' } ,
1282- '1792x1024' : { ar : '16:9' , px : '1792x1024' } ,
1283- '1024x1792' : { ar : '9:16' , px : '1024x1792' } ,
1273+ '256x256' : { ar : '1:1' } ,
1274+ '512x512' : { ar : '1:1' } ,
1275+ '1024x1024' : { ar : '1:1' } ,
1276+ '1536x1024' : { ar : '3:2' } ,
1277+ '1024x1536' : { ar : '2:3' } ,
1278+ '1696x2528' : { ar : '2:3' } ,
1279+ '2048x2048' : { ar : '1:1' } ,
1280+ '1792x1024' : { ar : '16:9' } ,
1281+ '1024x1792' : { ar : '9:16' } ,
12841282 } ;
12851283 const sm = opts ?. size ? sizeMap [ String ( opts . size ) ] : undefined ;
1286- if ( sm ?. ar ) constraints . push ( `Aspect ratio: ${ sm . ar } .` ) ;
1287- if ( sm ?. px ) constraints . push ( `Target size: ${ sm . px } pixels (approximate).` ) ;
1288- if ( opts ?. style ) constraints . push ( `Style: ${ opts . style } .` ) ;
1289- if ( opts ?. background ) constraints . push ( `Background: ${ opts . background } (use transparency if supported).` ) ;
12901284
12911285 // Preserve user-facing size/quality controls for streaming image models.
12921286 // The Gemini SDK supports `imageConfig` on GenerateContentConfig.
@@ -1305,10 +1299,6 @@ export class GeminiProvider extends BaseModelProvider {
13051299 if ( imageSize ) imageConfig . imageSize = imageSize ;
13061300 const perImageCost = this . getImageCost ( model , imageSize ) ;
13071301
1308- const constraintText = constraints . length
1309- ? `\n\nImage constraints (please prioritize):\n- ${ constraints . join ( '\n- ' ) } `
1310- : '' ;
1311-
13121302 const makeOne = async ( ) : Promise < string [ ] > => {
13131303 const requestParams : GenerateContentParameters = {
13141304 model,
@@ -1362,7 +1352,7 @@ export class GeminiProvider extends BaseModelProvider {
13621352 } ) ( ) ,
13631353 ] . filter ( Boolean )
13641354 : [ ] ) ,
1365- { text : ` ${ prompt } ${ constraintText } ` } ,
1355+ { text : prompt } ,
13661356 ] ,
13671357 } ,
13681358 ] ,
0 commit comments