Skip to content
Open
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
46 changes: 46 additions & 0 deletions google/genai/_interactions/resources/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def create(
input: interaction_create_params.Input,
model: ModelParam,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -109,6 +110,12 @@ def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -155,6 +162,7 @@ def create(
model: ModelParam,
stream: Literal[True],
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -185,6 +193,12 @@ def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -391,6 +405,7 @@ def create(
model: ModelParam,
stream: bool,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -421,6 +436,12 @@ def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -464,6 +485,7 @@ def create(
input: interaction_create_params.Input,
model: ModelParam | Omit = omit,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -519,6 +541,7 @@ def create(
"input": input,
"model": model,
"background": background,
"cached_content": cached_content,
"environment": environment,
"generation_config": generation_config,
"previous_interaction_id": previous_interaction_id,
Expand Down Expand Up @@ -820,6 +843,7 @@ async def create(
input: interaction_create_params.Input,
model: ModelParam,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -849,6 +873,12 @@ async def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -895,6 +925,7 @@ async def create(
model: ModelParam,
stream: Literal[True],
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -925,6 +956,12 @@ async def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -1131,6 +1168,7 @@ async def create(
model: ModelParam,
stream: bool,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -1161,6 +1199,12 @@ async def create(

background: Input only. Whether to run the model interaction in the background.

cached_content:
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`

environment: The environment configuration for the interaction. Can be an object specifying
remote environment sources or a string referencing an existing environment ID.

Expand Down Expand Up @@ -1204,6 +1248,7 @@ async def create(
input: interaction_create_params.Input,
model: ModelParam | Omit = omit,
background: bool | Omit = omit,
cached_content: str | Omit = omit,
environment: interaction_create_params.Environment | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
Expand Down Expand Up @@ -1255,6 +1300,7 @@ async def create(
"input": input,
"model": model,
"background": background,
"cached_content": cached_content,
"environment": environment,
"generation_config": generation_config,
"previous_interaction_id": previous_interaction_id,
Expand Down
14 changes: 14 additions & 0 deletions google/genai/_interactions/types/generation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,26 @@
class GenerationConfig(BaseModel):
"""Configuration parameters for model interactions."""

frequency_penalty: Optional[float] = None
"""
Penalizes tokens based on their frequency in the generated text. A positive
value helps to reduce the repetition of words and phrases. Valid values can
range from [-2.0, 2.0].
"""

image_config: Optional[ImageConfig] = None
"""Configuration for image interaction."""

max_output_tokens: Optional[int] = None
"""The maximum number of tokens to include in the response."""

presence_penalty: Optional[float] = None
"""Penalizes tokens that have already appeared in the generated text.

A positive value encourages the model to generate more diverse and less
repetitive text. Valid values can range from [-2.0, 2.0].
"""

seed: Optional[int] = None
"""Seed used in decoding for reproducibility."""

Expand Down
14 changes: 14 additions & 0 deletions google/genai/_interactions/types/generation_config_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,26 @@
class GenerationConfigParam(TypedDict, total=False):
"""Configuration parameters for model interactions."""

frequency_penalty: float
"""
Penalizes tokens based on their frequency in the generated text. A positive
value helps to reduce the repetition of words and phrases. Valid values can
range from [-2.0, 2.0].
"""

image_config: ImageConfigParam
"""Configuration for image interaction."""

max_output_tokens: int
"""The maximum number of tokens to include in the response."""

presence_penalty: float
"""Penalizes tokens that have already appeared in the generated text.

A positive value encourages the model to generate more diverse and less
repetitive text. Valid values can range from [-2.0, 2.0].
"""

seed: int
"""Seed used in decoding for reproducibility."""

Expand Down
8 changes: 8 additions & 0 deletions google/genai/_interactions/types/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ class Interaction(BaseModel):
agent_config: Optional[AgentConfig] = None
"""Configuration parameters for the agent interaction."""

cached_content: Optional[str] = None
"""
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`
"""

environment: Optional[Environment] = None
"""The environment configuration for the interaction.

Expand Down
8 changes: 8 additions & 0 deletions google/genai/_interactions/types/interaction_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class BaseCreateModelInteractionParams(TypedDict, total=False):
background: bool
"""Input only. Whether to run the model interaction in the background."""

cached_content: str
"""
The name of the cached content used as context to serve the prediction. Note:
only used in explicit caching, where users can have control over caching (e.g.
what content to cache) and enjoy guaranteed cost savings. Format:
`projects/{project}/locations/{location}/cachedContents/{cachedContent}`
"""

environment: Environment
"""The environment configuration for the interaction.

Expand Down
Loading