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
26 changes: 11 additions & 15 deletions google/genai/_gaos/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion google/genai/_gaos/types/triggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -40,6 +45,8 @@
from .triggerupdate import TriggerUpdate, TriggerUpdateParam, TriggerUpdateStatus

__all__ = [
"Interaction",
"InteractionParam",
"ListTriggerExecutionsResponse",
"ListTriggerExecutionsResponseTypedDict",
"ListTriggersResponse",
Expand All @@ -65,6 +72,8 @@
"Trigger": ".trigger",
"TriggerStatus": ".trigger",
"TriggerTypedDict": ".trigger",
"Interaction": ".triggercreateparams",
"InteractionParam": ".triggercreateparams",
"TriggerCreateParams": ".triggercreateparams",
"TriggerCreateParamsParam": ".triggercreateparams",
"TriggerExecution": ".triggerexecution",
Expand Down
56 changes: 30 additions & 26 deletions google/genai/_gaos/types/triggers/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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]
Expand All @@ -76,29 +70,21 @@ 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."""


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.
Expand All @@ -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."""

Expand All @@ -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."""

Expand All @@ -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",
]
)
Expand Down
37 changes: 30 additions & 7 deletions google/genai/_gaos/types/triggers/triggercreateparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
Loading