Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 75 additions & 1 deletion packages/ai/src/types/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,28 @@
/**
* The function call generated by the model was invalid.
*/
MALFORMED_FUNCTION_CALL: 'MALFORMED_FUNCTION_CALL'
MALFORMED_FUNCTION_CALL: 'MALFORMED_FUNCTION_CALL',
/**
* Image generation stopped due to safety settings.
*/
IMAGE_SAFETY: 'IMAGE_SAFETY',
/**
* Image generation stopped because generated images has other prohibited
* content.
*/
IMAGE_PROHIBITED_CONTENT: 'IMAGE_PROHIBITED_CONTENT',
/**
* Image generation stopped due to recitation.
*/
IMAGE_RECITATION: 'IMAGE_RECITATION',
/**
* Image generation stopped because of other miscellaneous issue.
*/
IMAGE_OTHER: 'IMAGE_OTHER',
/**
* The model was expected to generate an image, but none was generated.
*/
NO_IMAGE: 'NO_IMAGE'
} as const;

/**
Expand Down Expand Up @@ -414,3 +435,56 @@
* @beta
*/
export type Language = (typeof Language)[keyof typeof Language];

/**
* Aspect ratios for generated images.
* @public
*/
export const AspectRatio = {
/**
* Square (1:1) aspect ratio.
*/
SQUARE_1x1: '1:1',

Check failure on line 447 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'SQUARE_1x1' is not in camel case

Check failure on line 447 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'SQUARE_1x1' is not in camel case
/**
* Portrait (2:3) aspect ratio.
*/
PORTRAIT_2x3: '2:3',

Check failure on line 451 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'PORTRAIT_2x3' is not in camel case

Check failure on line 451 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'PORTRAIT_2x3' is not in camel case
/**
* Landscape (3:2) aspect ratio.
*/
LANDSCAPE_3x2: '3:2',

Check failure on line 455 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'LANDSCAPE_3x2' is not in camel case

Check failure on line 455 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'LANDSCAPE_3x2' is not in camel case
/**
* Portrait (3:4) aspect ratio.
*/
PORTRAIT_3x4: '3:4',

Check failure on line 459 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'PORTRAIT_3x4' is not in camel case

Check failure on line 459 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'PORTRAIT_3x4' is not in camel case
/**
* Landscape (4:3) aspect ratio.
*/
LANDSCAPE_4x3: '4:3',

Check failure on line 463 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'LANDSCAPE_4x3' is not in camel case

Check failure on line 463 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'LANDSCAPE_4x3' is not in camel case
/**
* Portrait (4:5) aspect ratio.
*/
PORTRAIT_4x5: '4:5',

Check failure on line 467 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'PORTRAIT_4x5' is not in camel case

Check failure on line 467 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'PORTRAIT_4x5' is not in camel case
/**
* Landscape (5:4) aspect ratio.
*/
LANDSCAPE_5x4: '5:4',

Check failure on line 471 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'LANDSCAPE_5x4' is not in camel case

Check failure on line 471 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'LANDSCAPE_5x4' is not in camel case
/**
* Portrait (9:16) aspect ratio.
*/
PORTRAIT_9x16: '9:16',

Check failure on line 475 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'PORTRAIT_9x16' is not in camel case

Check failure on line 475 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'PORTRAIT_9x16' is not in camel case
/**
* Landscape (16:9) aspect ratio.
*/
LANDSCAPE_16x9: '16:9',

Check failure on line 479 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'LANDSCAPE_16x9' is not in camel case

Check failure on line 479 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'LANDSCAPE_16x9' is not in camel case
/**
* Landscape (21:9) aspect ratio.
*/
LANDSCAPE_21x9: '21:9'

Check failure on line 483 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Lint

Identifier 'LANDSCAPE_21x9' is not in camel case

Check failure on line 483 in packages/ai/src/types/enums.ts

View workflow job for this annotation

GitHub Actions / Test Packages With Changed Files in Chrome and Node

Identifier 'LANDSCAPE_21x9' is not in camel case
} as const;

/**
* Aspect ratios for generated images.
* @public
*/
export type AspectRatio = (typeof AspectRatio)[keyof typeof AspectRatio];
18 changes: 18 additions & 0 deletions packages/ai/src/types/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
LanguageModelPromptOptions
} from './language-model';
import {
AspectRatio,
FunctionCallingMode,
HarmBlockMethod,
HarmBlockThreshold,
Expand Down Expand Up @@ -133,6 +134,12 @@ export interface GenerationConfig {
* Configuration for "thinking" behavior of compatible Gemini models.
*/
thinkingConfig?: ThinkingConfig;
/**
* Configuration for image generation.
*
* @beta
*/
imageConfig?: ImageConfig;
}

/**
Expand Down Expand Up @@ -441,6 +448,17 @@ export interface ThinkingConfig {
includeThoughts?: boolean;
}

/**
* Configuration for image generation.
* @public
*/
export interface ImageConfig {
/**
* The aspect ratio of the generated images.
*/
aspectRatio?: AspectRatio;
}

/**
* Configuration for a pre-built voice.
*
Expand Down
Loading