Skip to content

Commit 5dbe69e

Browse files
Annhiluccopybara-github
authored andcommitted
feat: Add ImageConfig to GenerationConfig for image generation in Interactions
PiperOrigin-RevId: 853878385
1 parent e72ebf4 commit 5dbe69e

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

google/genai/_interactions/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from .tool_choice import ToolChoice as ToolChoice
3333
from .usage_param import UsageParam as UsageParam
3434
from .content_stop import ContentStop as ContentStop
35+
from .image_config import ImageConfig as ImageConfig
3536
from .text_content import TextContent as TextContent
3637
from .allowed_tools import AllowedTools as AllowedTools
3738
from .audio_content import AudioContent as AudioContent
@@ -54,6 +55,7 @@
5455
from .interaction_event import InteractionEvent as InteractionEvent
5556
from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
5657
from .document_mime_type import DocumentMimeType as DocumentMimeType
58+
from .image_config_param import ImageConfigParam as ImageConfigParam
5759
from .text_content_param import TextContentParam as TextContentParam
5860
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
5961
from .url_context_result import URLContextResult as URLContextResult

google/genai/_interactions/types/generation_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from .._models import BaseModel
2222
from .tool_choice import ToolChoice
23+
from .image_config import ImageConfig
2324
from .speech_config import SpeechConfig
2425
from .thinking_level import ThinkingLevel
2526

@@ -29,6 +30,9 @@
2930
class GenerationConfig(BaseModel):
3031
"""Configuration parameters for model interactions."""
3132

33+
image_config: Optional[ImageConfig] = None
34+
"""Configuration for image interaction."""
35+
3236
max_output_tokens: Optional[int] = None
3337
"""The maximum number of tokens to include in the response."""
3438

google/genai/_interactions/types/generation_config_param.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .._types import SequenceNotStr
2424
from .thinking_level import ThinkingLevel
2525
from .tool_choice_param import ToolChoiceParam
26+
from .image_config_param import ImageConfigParam
2627
from .speech_config_param import SpeechConfigParam
2728

2829
__all__ = ["GenerationConfigParam"]
@@ -31,6 +32,9 @@
3132
class GenerationConfigParam(TypedDict, total=False):
3233
"""Configuration parameters for model interactions."""
3334

35+
image_config: ImageConfigParam
36+
"""Configuration for image interaction."""
37+
3438
max_output_tokens: int
3539
"""The maximum number of tokens to include in the response."""
3640

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from typing import Optional
19+
from typing_extensions import Literal
20+
21+
from .._models import BaseModel
22+
23+
__all__ = ["ImageConfig"]
24+
25+
26+
class ImageConfig(BaseModel):
27+
"""The configuration for image interaction."""
28+
29+
aspect_ratio: Optional[Literal["1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9"]] = None
30+
31+
image_size: Optional[Literal["1K", "2K", "4K"]] = None
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17+
18+
from __future__ import annotations
19+
20+
from typing_extensions import Literal, TypedDict
21+
22+
__all__ = ["ImageConfigParam"]
23+
24+
25+
class ImageConfigParam(TypedDict, total=False):
26+
"""The configuration for image interaction."""
27+
28+
aspect_ratio: Literal["1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9"]
29+
30+
image_size: Literal["1K", "2K", "4K"]

0 commit comments

Comments
 (0)