Skip to content
Merged
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,666 changes: 1,666 additions & 0 deletions google/genai/_gaos/environments.py

Large diffs are not rendered by default.

69 changes: 69 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,72 @@ 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 list_environments(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().list_environments, *args, **kwargs)

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

def delete_environment(self, *args: Any, **kwargs: Any) -> Any:
return wrap_sdk_call(super().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 list_environments(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().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 delete_environment(self, *args: Any, **kwargs: Any) -> Any:
return await async_wrap_sdk_call(super().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 +947,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
26 changes: 26 additions & 0 deletions google/genai/_gaos/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
DeleteAgentRequest,
DeleteAgentRequestParam,
)
from .deleteenvironment import (
DeleteEnvironmentRequest,
DeleteEnvironmentRequestParam,
)
from .deleteinteraction import (
DeleteInteractionGlobals,
DeleteInteractionGlobalsTypedDict,
Expand All @@ -85,6 +89,11 @@
GetAgentRequest,
GetAgentRequestParam,
)
from .getenvironment import GetEnvironmentRequest, GetEnvironmentRequestParam
from .getenvironmentfiles import (
GetEnvironmentFilesRequest,
GetEnvironmentFilesRequestParam,
)
from .getinteractionbyid import (
GetInteractionByIDGlobals,
GetInteractionByIDGlobalsTypedDict,
Expand All @@ -111,6 +120,7 @@
ListAgentsRequest,
ListAgentsRequestParam,
)
from .listenvironments import ListEnvironmentsRequest, ListEnvironmentsRequestParam
from .listtriggerexecutions import (
ListTriggerExecutionsGlobals,
ListTriggerExecutionsGlobalsTypedDict,
Expand Down Expand Up @@ -190,6 +200,8 @@
"DeleteAgentGlobalsTypedDict",
"DeleteAgentRequest",
"DeleteAgentRequestParam",
"DeleteEnvironmentRequest",
"DeleteEnvironmentRequestParam",
"DeleteInteractionGlobals",
"DeleteInteractionGlobalsTypedDict",
"DeleteInteractionRequest",
Expand All @@ -206,6 +218,10 @@
"GetAgentGlobalsTypedDict",
"GetAgentRequest",
"GetAgentRequestParam",
"GetEnvironmentFilesRequest",
"GetEnvironmentFilesRequestParam",
"GetEnvironmentRequest",
"GetEnvironmentRequestParam",
"GetInteractionByIDGlobals",
"GetInteractionByIDGlobalsTypedDict",
"GetInteractionByIDRequest",
Expand All @@ -224,6 +240,8 @@
"ListAgentsGlobalsTypedDict",
"ListAgentsRequest",
"ListAgentsRequestParam",
"ListEnvironmentsRequest",
"ListEnvironmentsRequestParam",
"ListTriggerExecutionsGlobals",
"ListTriggerExecutionsGlobalsTypedDict",
"ListTriggerExecutionsRequest",
Expand Down Expand Up @@ -287,6 +305,8 @@
"DeleteAgentGlobalsTypedDict": ".deleteagent",
"DeleteAgentRequest": ".deleteagent",
"DeleteAgentRequestParam": ".deleteagent",
"DeleteEnvironmentRequest": ".deleteenvironment",
"DeleteEnvironmentRequestParam": ".deleteenvironment",
"DeleteInteractionGlobals": ".deleteinteraction",
"DeleteInteractionGlobalsTypedDict": ".deleteinteraction",
"DeleteInteractionRequest": ".deleteinteraction",
Expand All @@ -303,6 +323,10 @@
"GetAgentGlobalsTypedDict": ".getagent",
"GetAgentRequest": ".getagent",
"GetAgentRequestParam": ".getagent",
"GetEnvironmentRequest": ".getenvironment",
"GetEnvironmentRequestParam": ".getenvironment",
"GetEnvironmentFilesRequest": ".getenvironmentfiles",
"GetEnvironmentFilesRequestParam": ".getenvironmentfiles",
"GetInteractionByIDGlobals": ".getinteractionbyid",
"GetInteractionByIDGlobalsTypedDict": ".getinteractionbyid",
"GetInteractionByIDRequest": ".getinteractionbyid",
Expand All @@ -321,6 +345,8 @@
"ListAgentsGlobalsTypedDict": ".listagents",
"ListAgentsRequest": ".listagents",
"ListAgentsRequestParam": ".listagents",
"ListEnvironmentsRequest": ".listenvironments",
"ListEnvironmentsRequestParam": ".listenvironments",
"ListTriggerExecutionsGlobals": ".listtriggerexecutions",
"ListTriggerExecutionsGlobalsTypedDict": ".listtriggerexecutions",
"ListTriggerExecutionsRequest": ".listtriggerexecutions",
Expand Down
34 changes: 34 additions & 0 deletions google/genai/_gaos/models/deleteenvironment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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
from ..utils import FieldMetadata, PathParamMetadata
from typing_extensions import Annotated, TypedDict


class DeleteEnvironmentRequestParam(TypedDict):
environment: str
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""


class DeleteEnvironmentRequest(BaseModel):
environment: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""
34 changes: 34 additions & 0 deletions google/genai/_gaos/models/getenvironment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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
from ..utils import FieldMetadata, PathParamMetadata
from typing_extensions import Annotated, TypedDict


class GetEnvironmentRequestParam(TypedDict):
environment: str
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""


class GetEnvironmentRequest(BaseModel):
environment: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""
91 changes: 91 additions & 0 deletions google/genai/_gaos/models/getenvironmentfiles.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 ..utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class GetEnvironmentFilesRequestParam(TypedDict):
environment: str
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""
path: str
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""
page_size: NotRequired[int]
r"""Optional. Maximum number of entries to return per page (for directory
listing). If unspecified, defaults to 100. Maximum is 1000.
"""
page_token: NotRequired[str]
r"""Optional. Pagination token for directory listing."""
recursive: NotRequired[bool]
r"""Optional. If true and the path is a directory, recursively lists all files
and subdirectories. Defaults to false (immediate children only).
"""


class GetEnvironmentFilesRequest(BaseModel):
environment: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""

path: Annotated[
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
]
r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122."""

page_size: Annotated[
Optional[int],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Optional. Maximum number of entries to return per page (for directory
listing). If unspecified, defaults to 100. Maximum is 1000.
"""

page_token: Annotated[
Optional[str],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Optional. Pagination token for directory listing."""

recursive: Annotated[
Optional[bool],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Optional. If true and the path is a directory, recursively lists all files
and subdirectories. Defaults to false (immediate children only).
"""

@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["page_size", "page_token", "recursive"])
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