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
1,367 changes: 1,367 additions & 0 deletions google/genai/_gaos/environments.py

Large diffs are not rendered by default.

95 changes: 95 additions & 0 deletions google/genai/_gaos/google_genai.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
from .triggers import Triggers as GeneratedTriggers
from .webhooks import AsyncWebhooks as GeneratedAsyncWebhooks
from .webhooks import Webhooks as GeneratedWebhooks
from .environments import AsyncEnvironments as GeneratedAsyncEnvironments
from .environments import Environments as GeneratedEnvironments


GOOGLE_GENAI_API_REVISION = _GOOGLE_GENAI_API_REVISION
Expand Down Expand Up @@ -759,6 +761,98 @@ async def list_executions(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().list_executions, *args, **kwargs)


class GeminiNextGenEnvironments(GeneratedEnvironments):
"""Public environments resource backed by the NextGen client."""

def __init__(self, api_client: Any):
sdk = build_google_genai_client(api_client)
super().__init__(sdk.sdk_configuration, parent_ref=sdk)

if not TYPE_CHECKING:
@property
def with_raw_response(self):
return _RawResponseAccessorProxy(super().with_raw_response)

@property
def with_streaming_response(self):
return _RawResponseAccessorProxy(super().with_streaming_response)

def create_environment(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().create_environment, *args, **kwargs)

def create(self, *args: Any, **kwargs: Any) -> Any:
if 'environment' in kwargs:
kwargs['body'] = kwargs.pop('environment')
return self.create_environment(*args, **kwargs)

def list_environments(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().list_environments, *args, **kwargs)

def list(self, *args: Any, **kwargs: Any) -> Any:
return self.list_environments(*args, **kwargs)

def get_environment(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().get_environment, *args, **kwargs)

def get(self, *args: Any, **kwargs: Any) -> Any:
return self.get_environment(*args, **kwargs)

def delete_environment(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().delete_environment, *args, **kwargs)

def delete(self, *args: Any, **kwargs: Any) -> Any:
return self.delete_environment(*args, **kwargs)

def get_environment_files(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().get_environment_files, *args, **kwargs)

# NOTE: update_environment, patch_environment are handled by fallback if they exist, but we assume they aren't generated based on our openapi.json.


class AsyncGeminiNextGenEnvironments(GeneratedAsyncEnvironments):
"""Async public environments resource backed by the NextGen client."""

def __init__(self, api_client: Any):
sdk = build_google_genai_async_client(api_client)
super().__init__(sdk.sdk_configuration, parent_ref=sdk)

if not TYPE_CHECKING:
@property
def with_raw_response(self):
return _AsyncRawResponseAccessorProxy(super().with_raw_response)

@property
def with_streaming_response(self):
return _AsyncRawResponseAccessorProxy(super().with_streaming_response)

async def create_environment(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().create_environment, *args, **kwargs)

async def create(self, *args: Any, **kwargs: Any) -> Any:
return await self.create_environment(*args, **kwargs)

async def list_environments(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().list_environments, *args, **kwargs)

async def list(self, *args: Any, **kwargs: Any) -> Any:
return await self.list_environments(*args, **kwargs)

async def get_environment(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().get_environment, *args, **kwargs)

async def get(self, *args: Any, **kwargs: Any) -> Any:
return await self.get_environment(*args, **kwargs)

async def delete_environment(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().delete_environment, *args, **kwargs)

async def delete(self, *args: Any, **kwargs: Any) -> Any:
return await self.delete_environment(*args, **kwargs)

async def get_environment_files(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().get_environment_files, *args, **kwargs)


def _add_output_properties_if_interaction(value: Any) -> Any:
normalized = _normalize_interaction_shape(value)
if normalized is None:
Expand Down Expand Up @@ -879,6 +973,7 @@ def _get_value(value: Any, name: str) -> Any:
return value.get(name)
return getattr(value, name, None)


# Allowed create() body keys, derived from the generated request models so the
# set tracks the schema; output-only fields are excluded.
_CREATE_BODY_KEYS = frozenset(
Expand Down
56 changes: 56 additions & 0 deletions google/genai/_gaos/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
CreateAgentRequest,
CreateAgentRequestParam,
)
from .createenvironment import (
CreateEnvironmentGlobals,
CreateEnvironmentGlobalsTypedDict,
CreateEnvironmentRequest,
CreateEnvironmentRequestParam,
)
from .createinteraction import (
CreateInteractionGlobals,
CreateInteractionGlobalsTypedDict,
Expand Down Expand Up @@ -61,6 +67,12 @@
DeleteAgentRequest,
DeleteAgentRequestParam,
)
from .deleteenvironment import (
DeleteEnvironmentGlobals,
DeleteEnvironmentGlobalsTypedDict,
DeleteEnvironmentRequest,
DeleteEnvironmentRequestParam,
)
from .deleteinteraction import (
DeleteInteractionGlobals,
DeleteInteractionGlobalsTypedDict,
Expand All @@ -85,6 +97,12 @@
GetAgentRequest,
GetAgentRequestParam,
)
from .getenvironment import (
GetEnvironmentGlobals,
GetEnvironmentGlobalsTypedDict,
GetEnvironmentRequest,
GetEnvironmentRequestParam,
)
from .getinteractionbyid import (
GetInteractionByIDGlobals,
GetInteractionByIDGlobalsTypedDict,
Expand All @@ -111,6 +129,12 @@
ListAgentsRequest,
ListAgentsRequestParam,
)
from .listenvironments import (
ListEnvironmentsGlobals,
ListEnvironmentsGlobalsTypedDict,
ListEnvironmentsRequest,
ListEnvironmentsRequestParam,
)
from .listtriggerexecutions import (
ListTriggerExecutionsGlobals,
ListTriggerExecutionsGlobalsTypedDict,
Expand Down Expand Up @@ -170,6 +194,10 @@
"CreateAgentGlobalsTypedDict",
"CreateAgentRequest",
"CreateAgentRequestParam",
"CreateEnvironmentGlobals",
"CreateEnvironmentGlobalsTypedDict",
"CreateEnvironmentRequest",
"CreateEnvironmentRequestParam",
"CreateInteractionGlobals",
"CreateInteractionGlobalsTypedDict",
"CreateInteractionRequest",
Expand All @@ -190,6 +218,10 @@
"DeleteAgentGlobalsTypedDict",
"DeleteAgentRequest",
"DeleteAgentRequestParam",
"DeleteEnvironmentGlobals",
"DeleteEnvironmentGlobalsTypedDict",
"DeleteEnvironmentRequest",
"DeleteEnvironmentRequestParam",
"DeleteInteractionGlobals",
"DeleteInteractionGlobalsTypedDict",
"DeleteInteractionRequest",
Expand All @@ -206,6 +238,10 @@
"GetAgentGlobalsTypedDict",
"GetAgentRequest",
"GetAgentRequestParam",
"GetEnvironmentGlobals",
"GetEnvironmentGlobalsTypedDict",
"GetEnvironmentRequest",
"GetEnvironmentRequestParam",
"GetInteractionByIDGlobals",
"GetInteractionByIDGlobalsTypedDict",
"GetInteractionByIDRequest",
Expand All @@ -224,6 +260,10 @@
"ListAgentsGlobalsTypedDict",
"ListAgentsRequest",
"ListAgentsRequestParam",
"ListEnvironmentsGlobals",
"ListEnvironmentsGlobalsTypedDict",
"ListEnvironmentsRequest",
"ListEnvironmentsRequestParam",
"ListTriggerExecutionsGlobals",
"ListTriggerExecutionsGlobalsTypedDict",
"ListTriggerExecutionsRequest",
Expand Down Expand Up @@ -267,6 +307,10 @@
"CreateAgentGlobalsTypedDict": ".createagent",
"CreateAgentRequest": ".createagent",
"CreateAgentRequestParam": ".createagent",
"CreateEnvironmentGlobals": ".createenvironment",
"CreateEnvironmentGlobalsTypedDict": ".createenvironment",
"CreateEnvironmentRequest": ".createenvironment",
"CreateEnvironmentRequestParam": ".createenvironment",
"CreateInteractionGlobals": ".createinteraction",
"CreateInteractionGlobalsTypedDict": ".createinteraction",
"CreateInteractionRequest": ".createinteraction",
Expand All @@ -287,6 +331,10 @@
"DeleteAgentGlobalsTypedDict": ".deleteagent",
"DeleteAgentRequest": ".deleteagent",
"DeleteAgentRequestParam": ".deleteagent",
"DeleteEnvironmentGlobals": ".deleteenvironment",
"DeleteEnvironmentGlobalsTypedDict": ".deleteenvironment",
"DeleteEnvironmentRequest": ".deleteenvironment",
"DeleteEnvironmentRequestParam": ".deleteenvironment",
"DeleteInteractionGlobals": ".deleteinteraction",
"DeleteInteractionGlobalsTypedDict": ".deleteinteraction",
"DeleteInteractionRequest": ".deleteinteraction",
Expand All @@ -303,6 +351,10 @@
"GetAgentGlobalsTypedDict": ".getagent",
"GetAgentRequest": ".getagent",
"GetAgentRequestParam": ".getagent",
"GetEnvironmentGlobals": ".getenvironment",
"GetEnvironmentGlobalsTypedDict": ".getenvironment",
"GetEnvironmentRequest": ".getenvironment",
"GetEnvironmentRequestParam": ".getenvironment",
"GetInteractionByIDGlobals": ".getinteractionbyid",
"GetInteractionByIDGlobalsTypedDict": ".getinteractionbyid",
"GetInteractionByIDRequest": ".getinteractionbyid",
Expand All @@ -321,6 +373,10 @@
"ListAgentsGlobalsTypedDict": ".listagents",
"ListAgentsRequest": ".listagents",
"ListAgentsRequestParam": ".listagents",
"ListEnvironmentsGlobals": ".listenvironments",
"ListEnvironmentsGlobalsTypedDict": ".listenvironments",
"ListEnvironmentsRequest": ".listenvironments",
"ListEnvironmentsRequestParam": ".listenvironments",
"ListTriggerExecutionsGlobals": ".listtriggerexecutions",
"ListTriggerExecutionsGlobalsTypedDict": ".listtriggerexecutions",
"ListTriggerExecutionsRequest": ".listtriggerexecutions",
Expand Down
91 changes: 91 additions & 0 deletions google/genai/_gaos/models/createenvironment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# pyformat: disable

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from ..types import BaseModel, UNSET_SENTINEL
from ..types.environments import environment as environments_environment
from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class CreateEnvironmentGlobalsTypedDict(TypedDict):
api_version: NotRequired[str]
r"""Which version of the API to use."""


class CreateEnvironmentGlobals(BaseModel):
api_version: Annotated[
Optional[str],
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
] = None
r"""Which version of the API to use."""

@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["api_version"])
serialized = handler(self)
m = {}

for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))

if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val

return m


class CreateEnvironmentRequestParam(TypedDict):
api_version: NotRequired[str]
r"""Which version of the API to use."""
body: NotRequired[environments_environment.EnvironmentInputParam]
r"""Required. The environment to create."""


class CreateEnvironmentRequest(BaseModel):
api_version: Annotated[
Optional[str],
FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
] = None
r"""Which version of the API to use."""

body: Annotated[
Optional[environments_environment.EnvironmentInput],
FieldMetadata(request=RequestMetadata(media_type="application/json")),
] = None
r"""Required. The environment to create."""

@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["api_version", "body"])
serialized = handler(self)
m = {}

for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))

if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val

return m
Loading
Loading