diff --git a/google/genai/_gaos/triggers.py b/google/genai/_gaos/triggers.py index df24c6920..26eb91e7d 100644 --- a/google/genai/_gaos/triggers.py +++ b/google/genai/_gaos/triggers.py @@ -21,10 +21,10 @@ from ._hooks import AfterParseErrorContext, HookContext, ResponseContext from .basesdk import AsyncBaseSDK, BaseSDK from .types import OptionalNullable, UNSET, interactions, triggers -from .types.interactions import ( - createagentinteraction as interactions_createagentinteraction, +from .types.triggers import ( + triggercreateparams as triggers_triggercreateparams, + triggerupdate as triggers_triggerupdate, ) -from .types.triggers import triggerupdate as triggers_triggerupdate from .utils import get_security_from_env, response_helpers from .utils.unmarshal_json_response import unmarshal_json_response import httpx @@ -200,8 +200,8 @@ def create( self, *, interaction: Union[ - interactions_createagentinteraction.CreateAgentInteraction, - interactions_createagentinteraction.CreateAgentInteractionParam, + triggers_triggercreateparams.Interaction, + triggers_triggercreateparams.InteractionParam, ], schedule: str, time_zone: str, @@ -218,7 +218,7 @@ def create( r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. - :param interaction: Interaction for generating the completion using agents. + :param interaction: Required. The interaction request template to be executed. :param schedule: Required. The cron schedule on which the trigger should run. Standard cron format. :param time_zone: Required. Time zone in which the schedule should be interpreted. @@ -253,9 +253,7 @@ def create( display_name=display_name, environment_id=environment_id, execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model( - interaction, interactions.CreateAgentInteraction - ), + interaction=utils.get_pydantic_model(interaction, triggers.Interaction), max_consecutive_failures=max_consecutive_failures, schedule=schedule, time_zone=time_zone, @@ -1377,8 +1375,8 @@ async def create( self, *, interaction: Union[ - interactions_createagentinteraction.CreateAgentInteraction, - interactions_createagentinteraction.CreateAgentInteractionParam, + triggers_triggercreateparams.Interaction, + triggers_triggercreateparams.InteractionParam, ], schedule: str, time_zone: str, @@ -1395,7 +1393,7 @@ async def create( r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. - :param interaction: Interaction for generating the completion using agents. + :param interaction: Required. The interaction request template to be executed. :param schedule: Required. The cron schedule on which the trigger should run. Standard cron format. :param time_zone: Required. Time zone in which the schedule should be interpreted. @@ -1430,9 +1428,7 @@ async def create( display_name=display_name, environment_id=environment_id, execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model( - interaction, interactions.CreateAgentInteraction - ), + interaction=utils.get_pydantic_model(interaction, triggers.Interaction), max_consecutive_failures=max_consecutive_failures, schedule=schedule, time_zone=time_zone, diff --git a/google/genai/_gaos/types/triggers/__init__.py b/google/genai/_gaos/types/triggers/__init__.py index b87aff2ab..777d184bc 100644 --- a/google/genai/_gaos/types/triggers/__init__.py +++ b/google/genai/_gaos/types/triggers/__init__.py @@ -31,7 +31,12 @@ ListTriggersResponseTypedDict, ) from .trigger import Trigger, TriggerStatus, TriggerTypedDict - from .triggercreateparams import TriggerCreateParams, TriggerCreateParamsParam + from .triggercreateparams import ( + Interaction, + InteractionParam, + TriggerCreateParams, + TriggerCreateParamsParam, + ) from .triggerexecution import ( TriggerExecution, TriggerExecutionStatus, @@ -40,6 +45,8 @@ from .triggerupdate import TriggerUpdate, TriggerUpdateParam, TriggerUpdateStatus __all__ = [ + "Interaction", + "InteractionParam", "ListTriggerExecutionsResponse", "ListTriggerExecutionsResponseTypedDict", "ListTriggersResponse", @@ -65,6 +72,8 @@ "Trigger": ".trigger", "TriggerStatus": ".trigger", "TriggerTypedDict": ".trigger", + "Interaction": ".triggercreateparams", + "InteractionParam": ".triggercreateparams", "TriggerCreateParams": ".triggercreateparams", "TriggerCreateParamsParam": ".triggercreateparams", "TriggerExecution": ".triggerexecution", diff --git a/google/genai/_gaos/types/triggers/trigger.py b/google/genai/_gaos/types/triggers/trigger.py index 9e9757d4d..ff7bb1c6c 100644 --- a/google/genai/_gaos/types/triggers/trigger.py +++ b/google/genai/_gaos/types/triggers/trigger.py @@ -18,9 +18,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ..interactions import createagentinteraction as interactions_createagentinteraction from datetime import datetime +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from ..interactions import interaction as interactions_interaction from pydantic import model_serializer from typing import Literal, Optional, Union from typing_extensions import NotRequired, TypedDict @@ -40,16 +40,6 @@ class TriggerTypedDict(TypedDict): r"""A trigger configuration that is scheduled to run an agent.""" - id: str - r"""Required. Output only. Identifier. The ID of the trigger.""" - interaction: interactions_createagentinteraction.CreateAgentInteractionParam - r"""Interaction for generating the completion using agents.""" - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" consecutive_failure_count: NotRequired[int] r"""Output only. The number of consecutive failures that have occurred since the last successful execution. @@ -62,6 +52,10 @@ class TriggerTypedDict(TypedDict): r"""Optional. The environment ID for the trigger execution.""" execution_timeout_seconds: NotRequired[int] r"""Optional. The execution timeout for the triggered interaction.""" + id: NotRequired[str] + r"""Required. Output only. Identifier. The ID of the trigger.""" + interaction: NotRequired[interactions_interaction.InteractionTypedDict] + r"""The Interaction resource.""" last_pause_time: NotRequired[datetime] r"""Output only. The time when the trigger was last paused.""" last_resume_time: NotRequired[datetime] @@ -76,8 +70,14 @@ class TriggerTypedDict(TypedDict): r"""Output only. The time when the trigger is scheduled to run next.""" previous_interaction_id: NotRequired[str] r"""Output only. The ID of the last interaction created by this trigger.""" + schedule: NotRequired[str] + r"""Required. The cron schedule on which the trigger should run. + Standard cron format. + """ status: NotRequired[TriggerStatus] r"""Output only. The current status of the trigger.""" + time_zone: NotRequired[str] + r"""Required. Time zone in which the schedule should be interpreted.""" update_time: NotRequired[datetime] r"""Output only. The time when the trigger was last updated.""" @@ -85,20 +85,6 @@ class TriggerTypedDict(TypedDict): class Trigger(BaseModel): r"""A trigger configuration that is scheduled to run an agent.""" - id: str - r"""Required. Output only. Identifier. The ID of the trigger.""" - - interaction: interactions_createagentinteraction.CreateAgentInteraction - r"""Interaction for generating the completion using agents.""" - - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - consecutive_failure_count: Optional[int] = None r"""Output only. The number of consecutive failures that have occurred since the last successful execution. @@ -116,6 +102,12 @@ class Trigger(BaseModel): execution_timeout_seconds: Optional[int] = None r"""Optional. The execution timeout for the triggered interaction.""" + id: Optional[str] = None + r"""Required. Output only. Identifier. The ID of the trigger.""" + + interaction: Optional[interactions_interaction.Interaction] = None + r"""The Interaction resource.""" + last_pause_time: Optional[datetime] = None r"""Output only. The time when the trigger was last paused.""" @@ -136,9 +128,17 @@ class Trigger(BaseModel): previous_interaction_id: Optional[str] = None r"""Output only. The ID of the last interaction created by this trigger.""" + schedule: Optional[str] = None + r"""Required. The cron schedule on which the trigger should run. + Standard cron format. + """ + status: Optional[TriggerStatus] = None r"""Output only. The current status of the trigger.""" + time_zone: Optional[str] = None + r"""Required. Time zone in which the schedule should be interpreted.""" + update_time: Optional[datetime] = None r"""Output only. The time when the trigger was last updated.""" @@ -151,13 +151,17 @@ def serialize_model(self, handler): "display_name", "environment_id", "execution_timeout_seconds", + "id", + "interaction", "last_pause_time", "last_resume_time", "last_run_time", "max_consecutive_failures", "next_run_time", "previous_interaction_id", + "schedule", "status", + "time_zone", "update_time", ] ) diff --git a/google/genai/_gaos/types/triggers/triggercreateparams.py b/google/genai/_gaos/types/triggers/triggercreateparams.py index 2f20a9293..25efac79d 100644 --- a/google/genai/_gaos/types/triggers/triggercreateparams.py +++ b/google/genai/_gaos/types/triggers/triggercreateparams.py @@ -19,17 +19,40 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL -from ..interactions import createagentinteraction as interactions_createagentinteraction +from ..interactions import ( + createagentinteraction as interactions_createagentinteraction, + createmodelinteraction as interactions_createmodelinteraction, +) from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +from typing import Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +InteractionParam = TypeAliasType( + "InteractionParam", + Union[ + interactions_createagentinteraction.CreateAgentInteractionParam, + interactions_createmodelinteraction.CreateModelInteractionParam, + ], +) +r"""Required. The interaction request template to be executed.""" + + +Interaction = TypeAliasType( + "Interaction", + Union[ + interactions_createagentinteraction.CreateAgentInteraction, + interactions_createmodelinteraction.CreateModelInteraction, + ], +) +r"""Required. The interaction request template to be executed.""" class TriggerCreateParamsParam(TypedDict): r"""Parameters for creating a trigger.""" - interaction: interactions_createagentinteraction.CreateAgentInteractionParam - r"""Interaction for generating the completion using agents.""" + interaction: InteractionParam + r"""Required. The interaction request template to be executed.""" schedule: str r"""Required. The cron schedule on which the trigger should run. Standard cron format. @@ -51,8 +74,8 @@ class TriggerCreateParamsParam(TypedDict): class TriggerCreateParams(BaseModel): r"""Parameters for creating a trigger.""" - interaction: interactions_createagentinteraction.CreateAgentInteraction - r"""Interaction for generating the completion using agents.""" + interaction: Interaction + r"""Required. The interaction request template to be executed.""" schedule: str r"""Required. The cron schedule on which the trigger should run.