Google Imagen: Add personGeneration setting to config.yaml
| @@ -287,6 +287,10 @@ claude: | ||
| 287 | 287 | gemini: |
| 288 | 288 | # API endpoint version ("v1beta" or "v1alpha") |
| 289 | 289 | apiVersion: 'v1beta' |
| 290 | + # https://ai.google.dev/gemini-api/docs/imagen#imagen-configuration | |
| 291 | + image: | |
| 292 | + # Leave empty to use the API-default value. | |
| 293 | + personGeneration: 'allow_adult' | |
| 290 | 294 | # -- SERVER PLUGIN CONFIGURATION -- |
| 291 | 295 | enableServerPlugins: false |
| 292 | 296 | # Attempt to automatically update server plugins on startup |
| @@ -438,6 +438,8 @@ router.post('/generate-image', async (request, response) => { | ||
| 438 | 438 | const isVertex = request.body.api === 'vertexai'; |
| 439 | 439 | // Is it even worth it? |
| 440 | 440 | const isDeprecated = model.startsWith('imagegeneration'); |
| 441 | + // Get person generation setting from config | |
| 442 | + const personGeneration = getConfigValue('gemini.image.personGeneration', 'allow_adult'); | |
| 441 | 443 | |
| 442 | 444 | const requestBody = { |
| 443 | 445 | instances: [{ |
| @@ -449,7 +451,7 @@ router.post('/generate-image', async (request, response) => { | ||
| 449 | 451 | enhancePrompt: isVertex ? Boolean(request.body.enhance ?? false) : undefined, |
| 450 | 452 | negativePrompt: isVertex ? (request.body.negative_prompt || undefined) : undefined, |
| 451 | 453 | aspectRatio: String(request.body.aspect_ratio || '1:1'), |
| 452 | 454 | personGeneration: !isDeprecated && personGeneration ? 'allow_adult'personGeneration : undefined, |
| 453 | 455 | language: isVertex ? 'auto' : undefined, |
| 454 | 456 | safetySetting: !isDeprecated ? (isVertex ? 'block_only_high' : 'block_low_and_above') : undefined, |
| 455 | 457 | addWatermark: isVertex ? false : undefined, |