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
92 changes: 91 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 @@ export const FinishReason = {
/**
* 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,72 @@ export const Language = {
* @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',
/**
* Portrait (2:3) aspect ratio.
*/
'PORTRAIT_2x3': '2:3',
/**
* Landscape (3:2) aspect ratio.
*/
'LANDSCAPE_3x2': '3:2',
/**
* Portrait (3:4) aspect ratio.
*/
'PORTRAIT_3x4': '3:4',
/**
* Landscape (4:3) aspect ratio.
*/
'LANDSCAPE_4x3': '4:3',
/**
* Portrait (4:5) aspect ratio.
*/
'PORTRAIT_4x5': '4:5',
/**
* Landscape (5:4) aspect ratio.
*/
'LANDSCAPE_5x4': '5:4',
/**
* Portrait (9:16) aspect ratio.
*/
'PORTRAIT_9x16': '9:16',
/**
* Landscape (16:9) aspect ratio.
*/
'LANDSCAPE_16x9': '16:9',
/**
* Landscape (21:9) aspect ratio.
*/
'LANDSCAPE_21x9': '21:9'
} as const;

/**
* Aspect ratios for generated images.
* @public
*/
export type AspectRatio = (typeof AspectRatio)[keyof typeof AspectRatio];

/**
* Specifies the size of generated images.
* @public
*/
export const ImageSize = {
'SIZE_1K': '1K',
'SIZE_2K': '2K',
'SIZE_4K': '4K',
} as const;

/**
* Specifies the size of generated images.
* @public
*/
export type ImageSize = (typeof ImageSize)[keyof typeof ImageSize];
24 changes: 24 additions & 0 deletions packages/ai/src/types/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import {
LanguageModelPromptOptions
} from './language-model';
import {
AspectRatio,
FunctionCallingMode,
HarmBlockMethod,
HarmBlockThreshold,
HarmCategory,
ImageSize,
InferenceMode,
ResponseModality
} from './enums';
Expand Down Expand Up @@ -133,6 +135,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 +449,22 @@ export interface ThinkingConfig {
includeThoughts?: boolean;
}

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

/**
* The size of generated images..
*/
imageSize?: ImageSize;
}

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