From 028e01df8585ea1632efc5161a2ac2b3fb8e94df Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 19 Aug 2026 23:48:43 -0700 Subject: [PATCH] chore: regenerate PiperOrigin-RevId: 967617202 --- .../genai/_gaos/_hooks/google_genai_auth.py | 1 + google/genai/_gaos/_hooks/types.py | 2 +- google/genai/_gaos/_version.py | 6 +- google/genai/_gaos/agents.py | 615 ++++---- google/genai/_gaos/basesdk.py | 2 +- google/genai/_gaos/environments.py | 330 ++--- .../_gaos/errors/cancelinteractionbyid.py | 2 +- .../genai/_gaos/errors/createinteraction.py | 2 +- .../genai/_gaos/errors/deleteinteraction.py | 2 +- .../genai/_gaos/errors/getinteractionbyid.py | 2 +- google/genai/_gaos/google_genai.py | 10 +- google/genai/_gaos/interactions.py | 1300 ++++++++--------- .../genai/_gaos/models/createinteraction.py | 4 +- google/genai/_gaos/models/createtrigger.py | 4 +- .../genai/_gaos/models/getinteractionbyid.py | 38 +- google/genai/_gaos/models/pingwebhook.py | 4 +- google/genai/_gaos/sdk.py | 94 +- google/genai/_gaos/sdkconfiguration.py | 4 +- google/genai/_gaos/triggers.py | 564 +++---- google/genai/_gaos/types/agents/agent.py | 2 +- .../_gaos/types/agents/agentlistresponse.py | 2 +- google/genai/_gaos/types/agents/agenttool.py | 4 +- .../_gaos/types/environments/environment.py | 2 +- .../environments/listenvironmentsresponse.py | 2 +- .../_gaos/types/interactions/allowedtools.py | 2 +- .../types/interactions/allowlistentry.py | 4 +- .../_gaos/types/interactions/annotation.py | 4 +- .../_gaos/types/interactions/audiocontent.py | 12 +- .../interactions/codeexecutioncalldelta.py | 4 +- .../interactions/codeexecutioncallstep.py | 9 +- .../interactions/codeexecutionresultstep.py | 7 +- .../interactions/codemenderagentconfig.py | 4 +- .../genai/_gaos/types/interactions/content.py | 12 +- .../interactions/createagentinteraction.py | 180 +-- .../interactions/createmodelinteraction.py | 162 +- .../interactions/deepresearchagentconfig.py | 2 +- .../types/interactions/documentcontent.py | 12 +- .../_gaos/types/interactions/environment.py | 4 +- .../environmentnetworkegressallowlist.py | 2 +- .../_gaos/types/interactions/errorevent.py | 2 +- .../types/interactions/filesearchcallstep.py | 7 +- .../interactions/filesearchresultdelta.py | 2 +- .../interactions/filesearchresultstep.py | 7 +- .../_gaos/types/interactions/findrequest.py | 2 +- .../_gaos/types/interactions/fixrequest.py | 2 +- .../types/interactions/functionresultdelta.py | 4 +- .../types/interactions/functionresultstep.py | 4 +- .../interactions/functionresultsubcontent.py | 4 +- .../types/interactions/generationconfig.py | 34 +- .../types/interactions/googlemapscalldelta.py | 4 +- .../types/interactions/googlemapscallstep.py | 9 +- .../types/interactions/googlemapsresult.py | 2 +- .../interactions/googlemapsresultdelta.py | 2 +- .../interactions/googlemapsresultplaces.py | 2 +- .../interactions/googlemapsresultstep.py | 9 +- .../interactions/googlesearchcalldelta.py | 4 +- .../interactions/googlesearchcallstep.py | 8 +- .../interactions/googlesearchresultdelta.py | 2 +- .../interactions/googlesearchresultstep.py | 9 +- .../_gaos/types/interactions/imagecontent.py | 14 +- .../_gaos/types/interactions/imagedelta.py | 2 +- .../_gaos/types/interactions/interaction.py | 344 ++--- .../interactions/interactioncompletedevent.py | 16 +- .../interactions/interactioncreatedevent.py | 16 +- .../types/interactions/interactionsinput.py | 4 +- .../types/interactions/interactionsseevent.py | 20 +- .../interactionsseeventinteraction.py | 46 +- .../interactions/interactionssestreamevent.py | 2 +- .../_gaos/types/interactions/mcpserver.py | 2 +- .../interactions/mcpservertoolresultdelta.py | 4 +- .../interactions/mcpservertoolresultstep.py | 8 +- .../types/interactions/modalitytokens.py | 2 +- .../types/interactions/modeloutputstep.py | 4 +- .../_gaos/types/interactions/placecitation.py | 2 +- .../types/interactions/ragretrievalconfig.py | 2 +- .../types/interactions/ragstoreconfig.py | 2 +- .../_gaos/types/interactions/retrieval.py | 4 +- .../types/interactions/retrievalcalldelta.py | 4 +- .../_gaos/types/interactions/safetysetting.py | 2 +- .../_gaos/types/interactions/speakerconfig.py | 2 +- google/genai/_gaos/types/interactions/step.py | 70 +- .../_gaos/types/interactions/stepdelta.py | 4 +- .../_gaos/types/interactions/stepdeltadata.py | 4 +- .../types/interactions/stepdeltametadata.py | 2 +- .../_gaos/types/interactions/stepstart.py | 2 +- .../_gaos/types/interactions/stepstop.py | 2 +- .../types/interactions/textannotationdelta.py | 2 +- .../_gaos/types/interactions/textcontent.py | 2 +- .../_gaos/types/interactions/thoughtstep.py | 9 +- .../interactions/thoughtsummarycontent.py | 4 +- .../types/interactions/thoughtsummarydelta.py | 2 +- google/genai/_gaos/types/interactions/tool.py | 4 +- .../types/interactions/toolchoiceconfig.py | 2 +- .../types/interactions/urlcontextcalldelta.py | 4 +- .../types/interactions/urlcontextcallstep.py | 9 +- .../interactions/urlcontextresultdelta.py | 2 +- .../interactions/urlcontextresultstep.py | 9 +- .../genai/_gaos/types/interactions/usage.py | 2 +- .../_gaos/types/interactions/userinputstep.py | 2 +- .../_gaos/types/interactions/videocontent.py | 50 +- .../_gaos/types/interactions/videodelta.py | 2 +- google/genai/_gaos/types/security.py | 28 +- .../triggers/listtriggerexecutionsresponse.py | 2 +- .../types/triggers/listtriggersresponse.py | 2 +- google/genai/_gaos/types/triggers/trigger.py | 2 +- .../types/triggers/triggercreateparams.py | 22 +- .../_gaos/types/triggers/triggerexecution.py | 2 +- .../_gaos/types/webhooks/signingsecret.py | 2 +- google/genai/_gaos/types/webhooks/webhook.py | 2 +- .../types/webhooks/webhooklistresponse.py | 2 +- google/genai/_gaos/utils/security.py | 6 +- .../_gaos/utils/unmarshal_json_response.py | 7 +- google/genai/_gaos/webhooks.py | 718 ++++----- 113 files changed, 2548 insertions(+), 2475 deletions(-) diff --git a/google/genai/_gaos/_hooks/google_genai_auth.py b/google/genai/_gaos/_hooks/google_genai_auth.py index 64687f78d..cca475e2d 100644 --- a/google/genai/_gaos/_hooks/google_genai_auth.py +++ b/google/genai/_gaos/_hooks/google_genai_auth.py @@ -105,6 +105,7 @@ def _apply_default_headers( + def _apply_user_project( hook_ctx: BeforeRequestContext, request: httpx.Request ) -> None: diff --git a/google/genai/_gaos/_hooks/types.py b/google/genai/_gaos/_hooks/types.py index 961a5f5cf..c9501bfcc 100644 --- a/google/genai/_gaos/_hooks/types.py +++ b/google/genai/_gaos/_hooks/types.py @@ -16,8 +16,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from ..sdkconfiguration import SDKConfiguration from abc import ABC, abstractmethod +from ..sdkconfiguration import SDKConfiguration import httpx from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union diff --git a/google/genai/_gaos/_version.py b/google/genai/_gaos/_version.py index 114706005..1270aa47d 100644 --- a/google/genai/_gaos/_version.py +++ b/google/genai/_gaos/_version.py @@ -22,8 +22,10 @@ __version__: str = "2.4.1-preview.5" __response_mode_header__: str = "x-google-genai-response-mode" __openapi_doc_version__: str = "v1beta" -__gen_version__: str = "2.924.0" -__user_agent__: str = "speakeasy-sdk/python 2.4.1-preview.5 2.924.0 v1beta google-genai" +__gen_version__: str = "internal" +__user_agent__: str = ( + "speakeasy-sdk/python 2.4.1-preview.5 internal v1beta google-genai" +) try: if __package__ is not None: diff --git a/google/genai/_gaos/agents.py b/google/genai/_gaos/agents.py index 425ff97a8..030cef3a5 100644 --- a/google/genai/_gaos/agents.py +++ b/google/genai/_gaos/agents.py @@ -16,11 +16,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .basesdk import AsyncBaseSDK, BaseSDK from . import errors, models, types, utils from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK from .types import OptionalNullable, UNSET, agents, interactions -from .types.agents import agent as agents_agent, agenttool as agents_agenttool +from .types.agents import ( + agent as agents_agent, + agenttool as agents_agenttool, +) from .utils import get_security_from_env, response_helpers from .utils.unmarshal_json_response import unmarshal_json_response import httpx @@ -36,44 +39,25 @@ def with_raw_response(self): def with_streaming_response(self): return AgentsWithStreamingResponse(self) - def create( + def list( self, *, api_version: Optional[str] = None, - agent_config: Optional[ - Union[agents_agent.AgentConfig, agents_agent.AgentConfigParam] - ] = None, - base_agent: Optional[str] = None, - base_environment: Optional[ - Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] - ] = None, - description: Optional[str] = None, - id: Optional[str] = None, - system_instruction: Optional[str] = None, - tools: Optional[ - Union[ - Iterable[agents_agenttool.AgentTool], - Iterable[agents_agenttool.AgentToolParam], - ] - ] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + parent: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.Agent: - r"""Creates a new Agent (Typed version for SDK). + ) -> agents.AgentListResponse: + r"""Lists all Agents. :param api_version: Which version of the API to use. - :param agent_config: Configuration parameters for the agent. - :param base_agent: The base agent to extend. - :param base_environment: The environment configuration for the agent. - :param description: Agent description for developers to quickly read and understand. - :param id: The unique identifier for the agent. - :param system_instruction: System instruction for the agent. - :param tools: The tools available to the agent. + :param page_size: + :param page_token: + :param parent: :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -90,46 +74,33 @@ def create( else: base_url = self._get_url(base_url, url_variables) - request = models.CreateAgentRequest( + request = models.ListAgentsRequest( api_version=api_version, - body=agents.Agent( - agent_config=utils.get_pydantic_model( - agent_config, Optional[agents.AgentConfig] - ), - base_agent=base_agent, - base_environment=utils.get_pydantic_model( - base_environment, Optional[agents.BaseEnvironment] - ), - description=description, - id=id, - system_instruction=system_instruction, - tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), - ), + page_size=page_size, + page_token=page_token, + parent=parent, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="POST", + method="GET", path="/{api_version}/agents", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateAgentGlobals( + _globals=models.ListAgentsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, False, False, "json", agents.Agent, extra_body=extra_body - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -161,14 +132,16 @@ def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response(agents.Agent, http_res, validate=False) + return unmarshal_json_response( + agents.AgentListResponse, http_res, validate=False + ) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateAgent", + operation_id="ListAgents", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -177,49 +150,19 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "create", - "lang": "sh", - "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "research-assistant-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "description": "A helpful research assistant.",\n "system_instruction": "You are a helpful research assistant.",\n "base_environment": "remote",\n "tools": [{"type": "google_search"}]\n }\'\n', - }, - { - "label": "create", - "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"research-assistant-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n description="A helpful research assistant.",\n system_instruction="You are a helpful research assistant.",\n base_environment="remote",\n tools=[{"type": "google_search"}],\n)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', - }, - { - "label": "create", - "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n description: 'A helpful research assistant.',\n system_instruction: 'You are a helpful research assistant.',\n base_environment: 'remote',\n tools: [{ type: 'google_search' }],\n});\nif (!agent.id) {\n throw new Error('Agent creation failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", - }, - { - "label": "with_sources", - "lang": "sh", - "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "data-analyst-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",\n "base_environment": {\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report."\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates"\n }\n ]\n }\n }\'\n', - }, - { - "label": "with_sources", - "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"data-analyst-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",\n base_environment={\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report.",\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates",\n },\n ],\n },\n)\nprint(f"Created agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', - }, - { - "label": "with_sources", - "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Always include visualizations and export results as PDF.',\n base_environment: {\n type: 'remote',\n sources: [\n {\n type: 'inline',\n target: '.agents/AGENTS.md',\n content: 'Always use matplotlib for charts. Include a summary table in every report.',\n },\n {\n type: 'repository',\n source: 'https://github.com/my-org/analysis-templates',\n target: '/workspace/templates',\n },\n ],\n },\n});\nconsole.log(`Created agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", - }, - { - "label": "fork_from_env", + "label": "list", "lang": "sh", - "source": '# Step 1: Set up the environment interactively\nRESPONSE=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "agent": "antigravity-preview-05-2026",\n "input": "Write a basic Hello World template to /workspace/template.py.",\n "environment": "remote"\n }\')\nENV_ID=$(echo $RESPONSE | python3 -c "import sys,json; print(json.load(sys.stdin)[\'environment_id\'])")\n\n# Step 2: Fork that environment into a named agent\ncurl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{\n \\"id\\": \\"my-data-analyst\\",\n \\"base_agent\\": \\"antigravity-preview-05-2026\\",\n \\"system_instruction\\": \\"You are a data analyst. Use the template at /workspace/template.py for all reports.\\",\n \\"base_environment\\": \\"$ENV_ID\\"\n }"\n', + "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "fork_from_env", + "label": "list", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Step 1: Set up the environment interactively.\ninteraction = client.interactions.create(\n agent="antigravity-preview-05-2026",\n input="Write a basic Hello World template to /workspace/template.py.",\n environment="remote",\n)\n\n# Step 2: Fork that environment into a named agent.\nagent_id = f"my-data-analyst-{uuid.uuid4().hex[:8]}"\nagent = client.agents.create(\n id=agent_id,\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Use the template at /workspace/template.py for all reports.",\n base_environment=interaction.environment_id,\n)\nprint(f"Forked agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + "source": "from google import genai\n\nclient = genai.Client()\nresponse = client.agents.list()\nfor agent in response.agents or []:\n print(agent.id)\n", }, { - "label": "fork_from_env", + "label": "list", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Step 1: Set up the environment interactively.\nconst interaction = await ai.interactions.create({\n agent: 'antigravity-preview-05-2026',\n input: 'Write a basic Hello World template to /workspace/template.py.',\n environment: 'remote',\n});\n\n// Step 2: Fork that environment into a named agent.\nconst agentId = `my-data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Use the template at /workspace/template.py for all reports.',\n base_environment: interaction.environment_id,\n});\nconsole.log(`Forked agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agents = await ai.agents.list();\nfor (const agent of (agents.agents ?? [])) {\n console.log(agent.id);\n}\n", }, ] }, @@ -270,25 +213,44 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def list( + def create( self, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - parent: Optional[str] = None, + agent_config: Optional[ + Union[agents_agent.AgentConfig, agents_agent.AgentConfigParam] + ] = None, + base_agent: Optional[str] = None, + base_environment: Optional[ + Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] + ] = None, + description: Optional[str] = None, + id: Optional[str] = None, + system_instruction: Optional[str] = None, + tools: Optional[ + Union[ + Iterable[agents_agenttool.AgentTool], + Iterable[agents_agenttool.AgentToolParam], + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.AgentListResponse: - r"""Lists all Agents. + ) -> agents.Agent: + r"""Creates a new Agent (Typed version for SDK). :param api_version: Which version of the API to use. - :param page_size: - :param page_token: - :param parent: + :param agent_config: Configuration parameters for the agent. + :param base_agent: The base agent to extend. + :param base_environment: The environment configuration for the agent. + :param description: Agent description for developers to quickly read and understand. + :param id: The unique identifier for the agent. + :param system_instruction: System instruction for the agent. + :param tools: The tools available to the agent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -305,33 +267,46 @@ def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListAgentsRequest( + request = models.CreateAgentRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, - parent=parent, + body=agents.Agent( + agent_config=utils.get_pydantic_model( + agent_config, Optional[agents.AgentConfig] + ), + base_agent=base_agent, + base_environment=utils.get_pydantic_model( + base_environment, Optional[agents.BaseEnvironment] + ), + description=description, + id=id, + system_instruction=system_instruction, + tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", + method="POST", path="/{api_version}/agents", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListAgentsGlobals( + _globals=models.CreateAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, False, False, "json", agents.Agent, extra_body=extra_body + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -363,16 +338,14 @@ def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - agents.AgentListResponse, http_res, validate=False - ) + return unmarshal_json_response(agents.Agent, http_res, validate=False) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListAgents", + operation_id="CreateAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -381,19 +354,49 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "list", + "label": "create", "lang": "sh", - "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "research-assistant-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "description": "A helpful research assistant.",\n "system_instruction": "You are a helpful research assistant.",\n "base_environment": "remote",\n "tools": [{"type": "google_search"}]\n }\'\n', }, { - "label": "list", + "label": "create", "lang": "python", - "source": "from google import genai\n\nclient = genai.Client()\nresponse = client.agents.list()\nfor agent in response.agents or []:\n print(agent.id)\n", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"research-assistant-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n description="A helpful research assistant.",\n system_instruction="You are a helpful research assistant.",\n base_environment="remote",\n tools=[{"type": "google_search"}],\n)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', }, { - "label": "list", + "label": "create", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agents = await ai.agents.list();\nfor (const agent of (agents.agents ?? [])) {\n console.log(agent.id);\n}\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n description: 'A helpful research assistant.',\n system_instruction: 'You are a helpful research assistant.',\n base_environment: 'remote',\n tools: [{ type: 'google_search' }],\n});\nif (!agent.id) {\n throw new Error('Agent creation failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", + }, + { + "label": "with_sources", + "lang": "sh", + "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "data-analyst-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",\n "base_environment": {\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report."\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates"\n }\n ]\n }\n }\'\n', + }, + { + "label": "with_sources", + "lang": "python", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"data-analyst-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",\n base_environment={\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report.",\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates",\n },\n ],\n },\n)\nprint(f"Created agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + }, + { + "label": "with_sources", + "lang": "javascript", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Always include visualizations and export results as PDF.',\n base_environment: {\n type: 'remote',\n sources: [\n {\n type: 'inline',\n target: '.agents/AGENTS.md',\n content: 'Always use matplotlib for charts. Include a summary table in every report.',\n },\n {\n type: 'repository',\n source: 'https://github.com/my-org/analysis-templates',\n target: '/workspace/templates',\n },\n ],\n },\n});\nconsole.log(`Created agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", + }, + { + "label": "fork_from_env", + "lang": "sh", + "source": '# Step 1: Set up the environment interactively\nRESPONSE=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "agent": "antigravity-preview-05-2026",\n "input": "Write a basic Hello World template to /workspace/template.py.",\n "environment": "remote"\n }\')\nENV_ID=$(echo $RESPONSE | python3 -c "import sys,json; print(json.load(sys.stdin)[\'environment_id\'])")\n\n# Step 2: Fork that environment into a named agent\ncurl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{\n \\"id\\": \\"my-data-analyst\\",\n \\"base_agent\\": \\"antigravity-preview-05-2026\\",\n \\"system_instruction\\": \\"You are a data analyst. Use the template at /workspace/template.py for all reports.\\",\n \\"base_environment\\": \\"$ENV_ID\\"\n }"\n', + }, + { + "label": "fork_from_env", + "lang": "python", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Step 1: Set up the environment interactively.\ninteraction = client.interactions.create(\n agent="antigravity-preview-05-2026",\n input="Write a basic Hello World template to /workspace/template.py.",\n environment="remote",\n)\n\n# Step 2: Fork that environment into a named agent.\nagent_id = f"my-data-analyst-{uuid.uuid4().hex[:8]}"\nagent = client.agents.create(\n id=agent_id,\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Use the template at /workspace/template.py for all reports.",\n base_environment=interaction.environment_id,\n)\nprint(f"Forked agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + }, + { + "label": "fork_from_env", + "lang": "javascript", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Step 1: Set up the environment interactively.\nconst interaction = await ai.interactions.create({\n agent: 'antigravity-preview-05-2026',\n input: 'Write a basic Hello World template to /workspace/template.py.',\n environment: 'remote',\n});\n\n// Step 2: Fork that environment into a named agent.\nconst agentId = `my-data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Use the template at /workspace/template.py for all reports.',\n base_environment: interaction.environment_id,\n});\nconsole.log(`Forked agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", }, ] }, @@ -444,7 +447,7 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def get( + def delete( self, id: str, *, @@ -452,8 +455,8 @@ def get( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.Agent: - r"""Gets a specific Agent. + ) -> interactions.Empty: + r"""Deletes an Agent. :param id: :param api_version: Which version of the API to use. @@ -475,7 +478,7 @@ def get( else: base_url = self._get_url(base_url, url_variables) - request = models.GetAgentRequest( + request = models.DeleteAgentRequest( api_version=api_version, id=id, ) @@ -484,7 +487,7 @@ def get( http_headers ) req = self._build_request( - method="GET", + method="DELETE", path="/{api_version}/agents/{id}", base_url=base_url, url_variables=url_variables, @@ -496,7 +499,7 @@ def get( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetAgentGlobals( + _globals=models.DeleteAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -531,14 +534,16 @@ def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response(agents.Agent, http_res, validate=False) + return unmarshal_json_response( + interactions.Empty, http_res, validate=False + ) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetAgent", + operation_id="DeleteAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -547,19 +552,19 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "get", + "label": "delete", "lang": "sh", - "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X DELETE https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "get", + "label": "delete", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to retrieve.\nagent_id = f"test-agent-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="A test agent.",\n base_environment="remote",\n)\n\nagent = client.agents.get(agent_id)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to delete.\nagent_id = f"delete-test-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="Temporary agent for deletion.",\n base_environment="remote",\n)\n\nclient.agents.delete(agent_id)\nprint("Agent deleted successfully.")\n', }, { - "label": "get", + "label": "delete", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to retrieve.\nconst agentId = `test-agent-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'A test agent.',\n base_environment: 'remote',\n});\n\nconst agent = await ai.agents.get(agentId);\nif (!agent.id) {\n throw new Error('Agent retrieval failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to delete.\nconst agentId = `delete-test-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'Temporary agent for deletion.',\n base_environment: 'remote',\n});\n\nawait ai.agents.delete(agentId);\nconsole.log('Agent deleted successfully.');\n", }, ] }, @@ -610,7 +615,7 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def delete( + def get( self, id: str, *, @@ -618,8 +623,8 @@ def delete( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes an Agent. + ) -> agents.Agent: + r"""Gets a specific Agent. :param id: :param api_version: Which version of the API to use. @@ -641,7 +646,7 @@ def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteAgentRequest( + request = models.GetAgentRequest( api_version=api_version, id=id, ) @@ -650,7 +655,7 @@ def delete( http_headers ) req = self._build_request( - method="DELETE", + method="GET", path="/{api_version}/agents/{id}", base_url=base_url, url_variables=url_variables, @@ -662,7 +667,7 @@ def delete( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteAgentGlobals( + _globals=models.GetAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -697,16 +702,14 @@ def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) + return unmarshal_json_response(agents.Agent, http_res, validate=False) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteAgent", + operation_id="GetAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -715,19 +718,19 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "delete", + "label": "get", "lang": "sh", - "source": 'curl -X DELETE https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "delete", + "label": "get", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to delete.\nagent_id = f"delete-test-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="Temporary agent for deletion.",\n base_environment="remote",\n)\n\nclient.agents.delete(agent_id)\nprint("Agent deleted successfully.")\n', + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to retrieve.\nagent_id = f"test-agent-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="A test agent.",\n base_environment="remote",\n)\n\nagent = client.agents.get(agent_id)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', }, { - "label": "delete", + "label": "get", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to delete.\nconst agentId = `delete-test-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'Temporary agent for deletion.',\n base_environment: 'remote',\n});\n\nawait ai.agents.delete(agentId);\nconsole.log('Agent deleted successfully.');\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to retrieve.\nconst agentId = `test-agent-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'A test agent.',\n base_environment: 'remote',\n});\n\nconst agent = await ai.agents.get(agentId);\nif (!agent.id) {\n throw new Error('Agent retrieval failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", }, ] }, @@ -782,31 +785,31 @@ def _speakeasy_parse_response(http_res): class AgentsWithRawResponse: def __init__(self, sdk: Agents) -> None: self._sdk = sdk + self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") self.create = response_helpers.to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") - self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") self.delete = response_helpers.to_raw_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") class AgentsWithStreamingResponse: def __init__(self, sdk: Agents) -> None: self._sdk = sdk - self.create = response_helpers.to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) self.list = response_helpers.to_streamed_response_wrapper( sdk.list, "extra_headers" ) - self.get = response_helpers.to_streamed_response_wrapper( - sdk.get, "extra_headers" + self.create = response_helpers.to_streamed_response_wrapper( + sdk.create, "extra_headers" ) self.delete = response_helpers.to_streamed_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.to_streamed_response_wrapper( + sdk.get, "extra_headers" + ) class AsyncAgents(AsyncBaseSDK): @@ -818,44 +821,25 @@ def with_raw_response(self): def with_streaming_response(self): return AsyncAgentsWithStreamingResponse(self) - async def create( + async def list( self, *, api_version: Optional[str] = None, - agent_config: Optional[ - Union[agents_agent.AgentConfig, agents_agent.AgentConfigParam] - ] = None, - base_agent: Optional[str] = None, - base_environment: Optional[ - Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] - ] = None, - description: Optional[str] = None, - id: Optional[str] = None, - system_instruction: Optional[str] = None, - tools: Optional[ - Union[ - Iterable[agents_agenttool.AgentTool], - Iterable[agents_agenttool.AgentToolParam], - ] - ] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + parent: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.Agent: - r"""Creates a new Agent (Typed version for SDK). + ) -> agents.AgentListResponse: + r"""Lists all Agents. :param api_version: Which version of the API to use. - :param agent_config: Configuration parameters for the agent. - :param base_agent: The base agent to extend. - :param base_environment: The environment configuration for the agent. - :param description: Agent description for developers to quickly read and understand. - :param id: The unique identifier for the agent. - :param system_instruction: System instruction for the agent. - :param tools: The tools available to the agent. + :param page_size: + :param page_token: + :param parent: :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -870,48 +854,35 @@ async def create( if server_url is not None: base_url = server_url else: - base_url = self._get_url(base_url, url_variables) - - request = models.CreateAgentRequest( - api_version=api_version, - body=agents.Agent( - agent_config=utils.get_pydantic_model( - agent_config, Optional[agents.AgentConfig] - ), - base_agent=base_agent, - base_environment=utils.get_pydantic_model( - base_environment, Optional[agents.BaseEnvironment] - ), - description=description, - id=id, - system_instruction=system_instruction, - tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), - ), + base_url = self._get_url(base_url, url_variables) + + request = models.ListAgentsRequest( + api_version=api_version, + page_size=page_size, + page_token=page_token, + parent=parent, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="POST", + method="GET", path="/{api_version}/agents", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateAgentGlobals( + _globals=models.ListAgentsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, False, False, "json", agents.Agent, extra_body=extra_body - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -943,14 +914,16 @@ async def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response(agents.Agent, http_res, validate=False) + return unmarshal_json_response( + agents.AgentListResponse, http_res, validate=False + ) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateAgent", + operation_id="ListAgents", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -959,49 +932,19 @@ async def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "create", - "lang": "sh", - "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "research-assistant-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "description": "A helpful research assistant.",\n "system_instruction": "You are a helpful research assistant.",\n "base_environment": "remote",\n "tools": [{"type": "google_search"}]\n }\'\n', - }, - { - "label": "create", - "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"research-assistant-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n description="A helpful research assistant.",\n system_instruction="You are a helpful research assistant.",\n base_environment="remote",\n tools=[{"type": "google_search"}],\n)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', - }, - { - "label": "create", - "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n description: 'A helpful research assistant.',\n system_instruction: 'You are a helpful research assistant.',\n base_environment: 'remote',\n tools: [{ type: 'google_search' }],\n});\nif (!agent.id) {\n throw new Error('Agent creation failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", - }, - { - "label": "with_sources", - "lang": "sh", - "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "data-analyst-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",\n "base_environment": {\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report."\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates"\n }\n ]\n }\n }\'\n', - }, - { - "label": "with_sources", - "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"data-analyst-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",\n base_environment={\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report.",\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates",\n },\n ],\n },\n)\nprint(f"Created agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', - }, - { - "label": "with_sources", - "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Always include visualizations and export results as PDF.',\n base_environment: {\n type: 'remote',\n sources: [\n {\n type: 'inline',\n target: '.agents/AGENTS.md',\n content: 'Always use matplotlib for charts. Include a summary table in every report.',\n },\n {\n type: 'repository',\n source: 'https://github.com/my-org/analysis-templates',\n target: '/workspace/templates',\n },\n ],\n },\n});\nconsole.log(`Created agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", - }, - { - "label": "fork_from_env", + "label": "list", "lang": "sh", - "source": '# Step 1: Set up the environment interactively\nRESPONSE=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "agent": "antigravity-preview-05-2026",\n "input": "Write a basic Hello World template to /workspace/template.py.",\n "environment": "remote"\n }\')\nENV_ID=$(echo $RESPONSE | python3 -c "import sys,json; print(json.load(sys.stdin)[\'environment_id\'])")\n\n# Step 2: Fork that environment into a named agent\ncurl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{\n \\"id\\": \\"my-data-analyst\\",\n \\"base_agent\\": \\"antigravity-preview-05-2026\\",\n \\"system_instruction\\": \\"You are a data analyst. Use the template at /workspace/template.py for all reports.\\",\n \\"base_environment\\": \\"$ENV_ID\\"\n }"\n', + "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "fork_from_env", + "label": "list", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Step 1: Set up the environment interactively.\ninteraction = client.interactions.create(\n agent="antigravity-preview-05-2026",\n input="Write a basic Hello World template to /workspace/template.py.",\n environment="remote",\n)\n\n# Step 2: Fork that environment into a named agent.\nagent_id = f"my-data-analyst-{uuid.uuid4().hex[:8]}"\nagent = client.agents.create(\n id=agent_id,\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Use the template at /workspace/template.py for all reports.",\n base_environment=interaction.environment_id,\n)\nprint(f"Forked agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + "source": "from google import genai\n\nclient = genai.Client()\nresponse = client.agents.list()\nfor agent in response.agents or []:\n print(agent.id)\n", }, { - "label": "fork_from_env", + "label": "list", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Step 1: Set up the environment interactively.\nconst interaction = await ai.interactions.create({\n agent: 'antigravity-preview-05-2026',\n input: 'Write a basic Hello World template to /workspace/template.py.',\n environment: 'remote',\n});\n\n// Step 2: Fork that environment into a named agent.\nconst agentId = `my-data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Use the template at /workspace/template.py for all reports.',\n base_environment: interaction.environment_id,\n});\nconsole.log(`Forked agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agents = await ai.agents.list();\nfor (const agent of (agents.agents ?? [])) {\n console.log(agent.id);\n}\n", }, ] }, @@ -1055,25 +998,44 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def list( + async def create( self, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - parent: Optional[str] = None, + agent_config: Optional[ + Union[agents_agent.AgentConfig, agents_agent.AgentConfigParam] + ] = None, + base_agent: Optional[str] = None, + base_environment: Optional[ + Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] + ] = None, + description: Optional[str] = None, + id: Optional[str] = None, + system_instruction: Optional[str] = None, + tools: Optional[ + Union[ + Iterable[agents_agenttool.AgentTool], + Iterable[agents_agenttool.AgentToolParam], + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.AgentListResponse: - r"""Lists all Agents. + ) -> agents.Agent: + r"""Creates a new Agent (Typed version for SDK). :param api_version: Which version of the API to use. - :param page_size: - :param page_token: - :param parent: + :param agent_config: Configuration parameters for the agent. + :param base_agent: The base agent to extend. + :param base_environment: The environment configuration for the agent. + :param description: Agent description for developers to quickly read and understand. + :param id: The unique identifier for the agent. + :param system_instruction: System instruction for the agent. + :param tools: The tools available to the agent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1090,33 +1052,46 @@ async def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListAgentsRequest( + request = models.CreateAgentRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, - parent=parent, + body=agents.Agent( + agent_config=utils.get_pydantic_model( + agent_config, Optional[agents.AgentConfig] + ), + base_agent=base_agent, + base_environment=utils.get_pydantic_model( + base_environment, Optional[agents.BaseEnvironment] + ), + description=description, + id=id, + system_instruction=system_instruction, + tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="GET", + method="POST", path="/{api_version}/agents", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListAgentsGlobals( + _globals=models.CreateAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, False, False, "json", agents.Agent, extra_body=extra_body + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1148,16 +1123,14 @@ async def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - agents.AgentListResponse, http_res, validate=False - ) + return unmarshal_json_response(agents.Agent, http_res, validate=False) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListAgents", + operation_id="CreateAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1166,19 +1139,49 @@ async def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "list", + "label": "create", "lang": "sh", - "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "research-assistant-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "description": "A helpful research assistant.",\n "system_instruction": "You are a helpful research assistant.",\n "base_environment": "remote",\n "tools": [{"type": "google_search"}]\n }\'\n', }, { - "label": "list", + "label": "create", "lang": "python", - "source": "from google import genai\n\nclient = genai.Client()\nresponse = client.agents.list()\nfor agent in response.agents or []:\n print(agent.id)\n", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"research-assistant-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n description="A helpful research assistant.",\n system_instruction="You are a helpful research assistant.",\n base_environment="remote",\n tools=[{"type": "google_search"}],\n)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', }, { - "label": "list", + "label": "create", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agents = await ai.agents.list();\nfor (const agent of (agents.agents ?? [])) {\n console.log(agent.id);\n}\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n description: 'A helpful research assistant.',\n system_instruction: 'You are a helpful research assistant.',\n base_environment: 'remote',\n tools: [{ type: 'google_search' }],\n});\nif (!agent.id) {\n throw new Error('Agent creation failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", + }, + { + "label": "with_sources", + "lang": "sh", + "source": 'curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "id": "data-analyst-abc123",\n "base_agent": "antigravity-preview-05-2026",\n "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",\n "base_environment": {\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report."\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates"\n }\n ]\n }\n }\'\n', + }, + { + "label": "with_sources", + "lang": "python", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\nagent = client.agents.create(\n id=f"data-analyst-{uuid.uuid4().hex[:8]}",\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",\n base_environment={\n "type": "remote",\n "sources": [\n {\n "type": "inline",\n "target": ".agents/AGENTS.md",\n "content": "Always use matplotlib for charts. Include a summary table in every report.",\n },\n {\n "type": "repository",\n "source": "https://github.com/my-org/analysis-templates",\n "target": "/workspace/templates",\n },\n ],\n },\n)\nprint(f"Created agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + }, + { + "label": "with_sources", + "lang": "javascript", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\nconst agentId = `data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Always include visualizations and export results as PDF.',\n base_environment: {\n type: 'remote',\n sources: [\n {\n type: 'inline',\n target: '.agents/AGENTS.md',\n content: 'Always use matplotlib for charts. Include a summary table in every report.',\n },\n {\n type: 'repository',\n source: 'https://github.com/my-org/analysis-templates',\n target: '/workspace/templates',\n },\n ],\n },\n});\nconsole.log(`Created agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", + }, + { + "label": "fork_from_env", + "lang": "sh", + "source": '# Step 1: Set up the environment interactively\nRESPONSE=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "agent": "antigravity-preview-05-2026",\n "input": "Write a basic Hello World template to /workspace/template.py.",\n "environment": "remote"\n }\')\nENV_ID=$(echo $RESPONSE | python3 -c "import sys,json; print(json.load(sys.stdin)[\'environment_id\'])")\n\n# Step 2: Fork that environment into a named agent\ncurl -X POST https://generativelanguage.googleapis.com/v1beta/agents \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{\n \\"id\\": \\"my-data-analyst\\",\n \\"base_agent\\": \\"antigravity-preview-05-2026\\",\n \\"system_instruction\\": \\"You are a data analyst. Use the template at /workspace/template.py for all reports.\\",\n \\"base_environment\\": \\"$ENV_ID\\"\n }"\n', + }, + { + "label": "fork_from_env", + "lang": "python", + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Step 1: Set up the environment interactively.\ninteraction = client.interactions.create(\n agent="antigravity-preview-05-2026",\n input="Write a basic Hello World template to /workspace/template.py.",\n environment="remote",\n)\n\n# Step 2: Fork that environment into a named agent.\nagent_id = f"my-data-analyst-{uuid.uuid4().hex[:8]}"\nagent = client.agents.create(\n id=agent_id,\n base_agent="antigravity-preview-05-2026",\n system_instruction="You are a data analyst. Use the template at /workspace/template.py for all reports.",\n base_environment=interaction.environment_id,\n)\nprint(f"Forked agent: {agent.id}")\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + }, + { + "label": "fork_from_env", + "lang": "javascript", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Step 1: Set up the environment interactively.\nconst interaction = await ai.interactions.create({\n agent: 'antigravity-preview-05-2026',\n input: 'Write a basic Hello World template to /workspace/template.py.',\n environment: 'remote',\n});\n\n// Step 2: Fork that environment into a named agent.\nconst agentId = `my-data-analyst-${crypto.randomUUID().slice(0, 8)}`;\nconst agent = await ai.agents.create({\n id: agentId,\n base_agent: 'antigravity-preview-05-2026',\n system_instruction: 'You are a data analyst. Use the template at /workspace/template.py for all reports.',\n base_environment: interaction.environment_id,\n});\nconsole.log(`Forked agent: ${agent.id}`);\n\n// [cleanup]\nif (agent.id) await ai.agents.delete(agent.id);\n// [/cleanup]\n", }, ] }, @@ -1232,7 +1235,7 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def get( + async def delete( self, id: str, *, @@ -1240,8 +1243,8 @@ async def get( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> agents.Agent: - r"""Gets a specific Agent. + ) -> interactions.Empty: + r"""Deletes an Agent. :param id: :param api_version: Which version of the API to use. @@ -1263,7 +1266,7 @@ async def get( else: base_url = self._get_url(base_url, url_variables) - request = models.GetAgentRequest( + request = models.DeleteAgentRequest( api_version=api_version, id=id, ) @@ -1272,7 +1275,7 @@ async def get( http_headers ) req = self._build_request_async( - method="GET", + method="DELETE", path="/{api_version}/agents/{id}", base_url=base_url, url_variables=url_variables, @@ -1284,7 +1287,7 @@ async def get( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetAgentGlobals( + _globals=models.DeleteAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1319,14 +1322,16 @@ async def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response(agents.Agent, http_res, validate=False) + return unmarshal_json_response( + interactions.Empty, http_res, validate=False + ) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetAgent", + operation_id="DeleteAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1335,19 +1340,19 @@ async def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "get", + "label": "delete", "lang": "sh", - "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X DELETE https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "get", + "label": "delete", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to retrieve.\nagent_id = f"test-agent-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="A test agent.",\n base_environment="remote",\n)\n\nagent = client.agents.get(agent_id)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to delete.\nagent_id = f"delete-test-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="Temporary agent for deletion.",\n base_environment="remote",\n)\n\nclient.agents.delete(agent_id)\nprint("Agent deleted successfully.")\n', }, { - "label": "get", + "label": "delete", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to retrieve.\nconst agentId = `test-agent-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'A test agent.',\n base_environment: 'remote',\n});\n\nconst agent = await ai.agents.get(agentId);\nif (!agent.id) {\n throw new Error('Agent retrieval failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to delete.\nconst agentId = `delete-test-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'Temporary agent for deletion.',\n base_environment: 'remote',\n});\n\nawait ai.agents.delete(agentId);\nconsole.log('Agent deleted successfully.');\n", }, ] }, @@ -1401,7 +1406,7 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def delete( + async def get( self, id: str, *, @@ -1409,8 +1414,8 @@ async def delete( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes an Agent. + ) -> agents.Agent: + r"""Gets a specific Agent. :param id: :param api_version: Which version of the API to use. @@ -1432,7 +1437,7 @@ async def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteAgentRequest( + request = models.GetAgentRequest( api_version=api_version, id=id, ) @@ -1441,7 +1446,7 @@ async def delete( http_headers ) req = self._build_request_async( - method="DELETE", + method="GET", path="/{api_version}/agents/{id}", base_url=base_url, url_variables=url_variables, @@ -1453,7 +1458,7 @@ async def delete( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteAgentGlobals( + _globals=models.GetAgentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1488,16 +1493,14 @@ async def _speakeasy_parse_response(http_res): "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) + return unmarshal_json_response(agents.Agent, http_res, validate=False) raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteAgent", + operation_id="GetAgent", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1506,19 +1509,19 @@ async def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "delete", + "label": "get", "lang": "sh", - "source": 'curl -X DELETE https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": 'curl -X GET https://generativelanguage.googleapis.com/v1beta/agents/ag_abc123 \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "delete", + "label": "get", "lang": "python", - "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to delete.\nagent_id = f"delete-test-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="Temporary agent for deletion.",\n base_environment="remote",\n)\n\nclient.agents.delete(agent_id)\nprint("Agent deleted successfully.")\n', + "source": 'import uuid\nfrom google import genai\n\nclient = genai.Client()\n\n# Create an agent so we have a valid ID to retrieve.\nagent_id = f"test-agent-{uuid.uuid4().hex[:8]}"\nclient.agents.create(\n id=agent_id,\n base_agent="waverunner",\n description="A test agent.",\n base_environment="remote",\n)\n\nagent = client.agents.get(agent_id)\nprint(agent.id)\n\n# [cleanup]\nclient.agents.delete(agent.id)\n# [/cleanup]\n', }, { - "label": "delete", + "label": "get", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to delete.\nconst agentId = `delete-test-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'Temporary agent for deletion.',\n base_environment: 'remote',\n});\n\nawait ai.agents.delete(agentId);\nconsole.log('Agent deleted successfully.');\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// Create an agent so we have a valid ID to retrieve.\nconst agentId = `test-agent-${crypto.randomUUID().slice(0, 8)}`;\nawait ai.agents.create({\n id: agentId,\n base_agent: 'waverunner',\n description: 'A test agent.',\n base_environment: 'remote',\n});\n\nconst agent = await ai.agents.get(agentId);\nif (!agent.id) {\n throw new Error('Agent retrieval failed: ID is undefined');\n}\nconsole.log(agent.id);\n\n// [cleanup]\nawait ai.agents.delete(agent.id);\n// [/cleanup]\n", }, ] }, @@ -1576,32 +1579,32 @@ async def _speakeasy_parse_response(http_res): class AsyncAgentsWithRawResponse: def __init__(self, sdk: AsyncAgents) -> None: self._sdk = sdk - self.create = response_helpers.async_to_raw_response_wrapper( - sdk.create, "extra_headers" - ) self.list = response_helpers.async_to_raw_response_wrapper( sdk.list, "extra_headers" ) - self.get = response_helpers.async_to_raw_response_wrapper( - sdk.get, "extra_headers" + self.create = response_helpers.async_to_raw_response_wrapper( + sdk.create, "extra_headers" ) self.delete = response_helpers.async_to_raw_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.async_to_raw_response_wrapper( + sdk.get, "extra_headers" + ) class AsyncAgentsWithStreamingResponse: def __init__(self, sdk: AsyncAgents) -> None: self._sdk = sdk - self.create = response_helpers.async_to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) self.list = response_helpers.async_to_streamed_response_wrapper( sdk.list, "extra_headers" ) - self.get = response_helpers.async_to_streamed_response_wrapper( - sdk.get, "extra_headers" + self.create = response_helpers.async_to_streamed_response_wrapper( + sdk.create, "extra_headers" ) self.delete = response_helpers.async_to_streamed_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.async_to_streamed_response_wrapper( + sdk.get, "extra_headers" + ) diff --git a/google/genai/_gaos/basesdk.py b/google/genai/_gaos/basesdk.py index 2a2fa7292..8ad7d3047 100644 --- a/google/genai/_gaos/basesdk.py +++ b/google/genai/_gaos/basesdk.py @@ -16,6 +16,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .sdkconfiguration import SDKConfiguration from . import errors, types, utils from ._hooks import ( AfterErrorContext, @@ -23,7 +24,6 @@ BeforeRequestContext, HookContext, ) -from .sdkconfiguration import SDKConfiguration from .utils import RetryConfig, SerializedRequestBody, get_body_content import httpx diff --git a/google/genai/_gaos/environments.py b/google/genai/_gaos/environments.py index 63debf44e..78596a00c 100644 --- a/google/genai/_gaos/environments.py +++ b/google/genai/_gaos/environments.py @@ -16,9 +16,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .basesdk import AsyncBaseSDK, BaseSDK from . import errors, models, types, utils from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK from .types import OptionalNullable, UNSET, environments, interactions from .types.environments import ( createenvironmentrequest as environments_createenvironmentrequest, @@ -39,35 +39,23 @@ def with_raw_response(self): def with_streaming_response(self): return EnvironmentsWithStreamingResponse(self) - def create_environment( + def list_environments( self, *, api_version: Optional[str] = None, - network: Optional[ - Union[ - environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnion, - environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnionParam, - ] - ] = None, - sources: Optional[ - Union[ - Iterable[interactions_source.Source], - Iterable[interactions_source.SourceParam], - ] - ] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.Environment: - r"""Creates an environment. + ) -> environments.ListEnvironmentsResponse: + r"""Lists environments. :param api_version: Which version of the API to use. - :param network: Network configuration for the environment. - :param sources: Sources to be mounted into the environment. + :param page_size: Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. + :param page_token: Optional. Pagination token. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -84,46 +72,32 @@ def create_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.CreateEnvironmentRequest( + request = models.ListEnvironmentsRequest( api_version=api_version, - body=environments.CreateEnvironmentRequest( - network=utils.get_pydantic_model( - network, Optional[environments.CreateEnvironmentRequestNetworkUnion] - ), - sources=utils.get_pydantic_model( - sources, Optional[List[interactions.Source]] - ), - ), + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="POST", + method="GET", path="/{api_version}/environments", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateEnvironmentGlobals( + _globals=models.ListEnvironmentsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - environments.CreateEnvironmentRequest, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -156,7 +130,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.Environment, http_res, validate=False + environments.ListEnvironmentsResponse, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -164,7 +138,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateEnvironment", + operation_id="ListEnvironments", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -218,23 +192,35 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def list_environments( + def create_environment( self, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + network: Optional[ + Union[ + environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnion, + environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnionParam, + ] + ] = None, + sources: Optional[ + Union[ + Iterable[interactions_source.Source], + Iterable[interactions_source.SourceParam], + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.ListEnvironmentsResponse: - r"""Lists environments. + ) -> environments.Environment: + r"""Creates an environment. :param api_version: Which version of the API to use. - :param page_size: Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. + :param network: Network configuration for the environment. + :param sources: Sources to be mounted into the environment. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -251,32 +237,46 @@ def list_environments( else: base_url = self._get_url(base_url, url_variables) - request = models.ListEnvironmentsRequest( + request = models.CreateEnvironmentRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, + body=environments.CreateEnvironmentRequest( + network=utils.get_pydantic_model( + network, Optional[environments.CreateEnvironmentRequestNetworkUnion] + ), + sources=utils.get_pydantic_model( + sources, Optional[List[interactions.Source]] + ), + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", + method="POST", path="/{api_version}/environments", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListEnvironmentsGlobals( + _globals=models.CreateEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + environments.CreateEnvironmentRequest, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -309,7 +309,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.ListEnvironmentsResponse, http_res, validate=False + environments.Environment, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -317,7 +317,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListEnvironments", + operation_id="CreateEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -371,7 +371,7 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def get_environment( + def delete_environment( self, id: str, *, @@ -379,8 +379,8 @@ def get_environment( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.Environment: - r"""Gets an environment. + ) -> interactions.Empty: + r"""Deletes an environment. :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. :param api_version: Which version of the API to use. @@ -402,7 +402,7 @@ def get_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.GetEnvironmentRequest( + request = models.DeleteEnvironmentRequest( api_version=api_version, id=id, ) @@ -411,7 +411,7 @@ def get_environment( http_headers ) req = self._build_request( - method="GET", + method="DELETE", path="/{api_version}/environments/{id}", base_url=base_url, url_variables=url_variables, @@ -423,7 +423,7 @@ def get_environment( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetEnvironmentGlobals( + _globals=models.DeleteEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -459,7 +459,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.Environment, http_res, validate=False + interactions.Empty, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -467,7 +467,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetEnvironment", + operation_id="DeleteEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -521,7 +521,7 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def delete_environment( + def get_environment( self, id: str, *, @@ -529,8 +529,8 @@ def delete_environment( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes an environment. + ) -> environments.Environment: + r"""Gets an environment. :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. :param api_version: Which version of the API to use. @@ -552,7 +552,7 @@ def delete_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteEnvironmentRequest( + request = models.GetEnvironmentRequest( api_version=api_version, id=id, ) @@ -561,7 +561,7 @@ def delete_environment( http_headers ) req = self._build_request( - method="DELETE", + method="GET", path="/{api_version}/environments/{id}", base_url=base_url, url_variables=url_variables, @@ -573,7 +573,7 @@ def delete_environment( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteEnvironmentGlobals( + _globals=models.GetEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -609,7 +609,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + environments.Environment, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -617,7 +617,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteEnvironment", + operation_id="GetEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -675,35 +675,35 @@ def _speakeasy_parse_response(http_res): class EnvironmentsWithRawResponse: def __init__(self, sdk: Environments) -> None: self._sdk = sdk - self.create_environment = response_helpers.to_raw_response_wrapper( - sdk.create_environment, "extra_headers" - ) self.list_environments = response_helpers.to_raw_response_wrapper( sdk.list_environments, "extra_headers" ) - self.get_environment = response_helpers.to_raw_response_wrapper( - sdk.get_environment, "extra_headers" + self.create_environment = response_helpers.to_raw_response_wrapper( + sdk.create_environment, "extra_headers" ) self.delete_environment = response_helpers.to_raw_response_wrapper( sdk.delete_environment, "extra_headers" ) + self.get_environment = response_helpers.to_raw_response_wrapper( + sdk.get_environment, "extra_headers" + ) class EnvironmentsWithStreamingResponse: def __init__(self, sdk: Environments) -> None: self._sdk = sdk - self.create_environment = response_helpers.to_streamed_response_wrapper( - sdk.create_environment, "extra_headers" - ) self.list_environments = response_helpers.to_streamed_response_wrapper( sdk.list_environments, "extra_headers" ) - self.get_environment = response_helpers.to_streamed_response_wrapper( - sdk.get_environment, "extra_headers" + self.create_environment = response_helpers.to_streamed_response_wrapper( + sdk.create_environment, "extra_headers" ) self.delete_environment = response_helpers.to_streamed_response_wrapper( sdk.delete_environment, "extra_headers" ) + self.get_environment = response_helpers.to_streamed_response_wrapper( + sdk.get_environment, "extra_headers" + ) class AsyncEnvironments(AsyncBaseSDK): @@ -715,35 +715,23 @@ def with_raw_response(self): def with_streaming_response(self): return AsyncEnvironmentsWithStreamingResponse(self) - async def create_environment( + async def list_environments( self, *, api_version: Optional[str] = None, - network: Optional[ - Union[ - environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnion, - environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnionParam, - ] - ] = None, - sources: Optional[ - Union[ - Iterable[interactions_source.Source], - Iterable[interactions_source.SourceParam], - ] - ] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.Environment: - r"""Creates an environment. + ) -> environments.ListEnvironmentsResponse: + r"""Lists environments. :param api_version: Which version of the API to use. - :param network: Network configuration for the environment. - :param sources: Sources to be mounted into the environment. + :param page_size: Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. + :param page_token: Optional. Pagination token. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -760,46 +748,32 @@ async def create_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.CreateEnvironmentRequest( + request = models.ListEnvironmentsRequest( api_version=api_version, - body=environments.CreateEnvironmentRequest( - network=utils.get_pydantic_model( - network, Optional[environments.CreateEnvironmentRequestNetworkUnion] - ), - sources=utils.get_pydantic_model( - sources, Optional[List[interactions.Source]] - ), - ), + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="POST", + method="GET", path="/{api_version}/environments", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateEnvironmentGlobals( + _globals=models.ListEnvironmentsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - environments.CreateEnvironmentRequest, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -832,7 +806,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.Environment, http_res, validate=False + environments.ListEnvironmentsResponse, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -840,7 +814,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateEnvironment", + operation_id="ListEnvironments", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -897,23 +871,35 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def list_environments( + async def create_environment( self, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + network: Optional[ + Union[ + environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnion, + environments_createenvironmentrequest.CreateEnvironmentRequestNetworkUnionParam, + ] + ] = None, + sources: Optional[ + Union[ + Iterable[interactions_source.Source], + Iterable[interactions_source.SourceParam], + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.ListEnvironmentsResponse: - r"""Lists environments. + ) -> environments.Environment: + r"""Creates an environment. :param api_version: Which version of the API to use. - :param page_size: Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. + :param network: Network configuration for the environment. + :param sources: Sources to be mounted into the environment. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -930,32 +916,46 @@ async def list_environments( else: base_url = self._get_url(base_url, url_variables) - request = models.ListEnvironmentsRequest( + request = models.CreateEnvironmentRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, + body=environments.CreateEnvironmentRequest( + network=utils.get_pydantic_model( + network, Optional[environments.CreateEnvironmentRequestNetworkUnion] + ), + sources=utils.get_pydantic_model( + sources, Optional[List[interactions.Source]] + ), + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="GET", + method="POST", path="/{api_version}/environments", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListEnvironmentsGlobals( + _globals=models.CreateEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + environments.CreateEnvironmentRequest, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -988,7 +988,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.ListEnvironmentsResponse, http_res, validate=False + environments.Environment, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -996,7 +996,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListEnvironments", + operation_id="CreateEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1053,7 +1053,7 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def get_environment( + async def delete_environment( self, id: str, *, @@ -1061,8 +1061,8 @@ async def get_environment( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> environments.Environment: - r"""Gets an environment. + ) -> interactions.Empty: + r"""Deletes an environment. :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. :param api_version: Which version of the API to use. @@ -1084,7 +1084,7 @@ async def get_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.GetEnvironmentRequest( + request = models.DeleteEnvironmentRequest( api_version=api_version, id=id, ) @@ -1093,7 +1093,7 @@ async def get_environment( http_headers ) req = self._build_request_async( - method="GET", + method="DELETE", path="/{api_version}/environments/{id}", base_url=base_url, url_variables=url_variables, @@ -1105,7 +1105,7 @@ async def get_environment( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetEnvironmentGlobals( + _globals=models.DeleteEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1141,7 +1141,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - environments.Environment, http_res, validate=False + interactions.Empty, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -1149,7 +1149,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetEnvironment", + operation_id="DeleteEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1206,7 +1206,7 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def delete_environment( + async def get_environment( self, id: str, *, @@ -1214,8 +1214,8 @@ async def delete_environment( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes an environment. + ) -> environments.Environment: + r"""Gets an environment. :param id: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. :param api_version: Which version of the API to use. @@ -1237,7 +1237,7 @@ async def delete_environment( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteEnvironmentRequest( + request = models.GetEnvironmentRequest( api_version=api_version, id=id, ) @@ -1246,7 +1246,7 @@ async def delete_environment( http_headers ) req = self._build_request_async( - method="DELETE", + method="GET", path="/{api_version}/environments/{id}", base_url=base_url, url_variables=url_variables, @@ -1258,7 +1258,7 @@ async def delete_environment( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteEnvironmentGlobals( + _globals=models.GetEnvironmentGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1294,7 +1294,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + environments.Environment, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -1302,7 +1302,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteEnvironment", + operation_id="GetEnvironment", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1363,32 +1363,32 @@ async def _speakeasy_parse_response(http_res): class AsyncEnvironmentsWithRawResponse: def __init__(self, sdk: AsyncEnvironments) -> None: self._sdk = sdk - self.create_environment = response_helpers.async_to_raw_response_wrapper( - sdk.create_environment, "extra_headers" - ) self.list_environments = response_helpers.async_to_raw_response_wrapper( sdk.list_environments, "extra_headers" ) - self.get_environment = response_helpers.async_to_raw_response_wrapper( - sdk.get_environment, "extra_headers" + self.create_environment = response_helpers.async_to_raw_response_wrapper( + sdk.create_environment, "extra_headers" ) self.delete_environment = response_helpers.async_to_raw_response_wrapper( sdk.delete_environment, "extra_headers" ) + self.get_environment = response_helpers.async_to_raw_response_wrapper( + sdk.get_environment, "extra_headers" + ) class AsyncEnvironmentsWithStreamingResponse: def __init__(self, sdk: AsyncEnvironments) -> None: self._sdk = sdk - self.create_environment = response_helpers.async_to_streamed_response_wrapper( - sdk.create_environment, "extra_headers" - ) self.list_environments = response_helpers.async_to_streamed_response_wrapper( sdk.list_environments, "extra_headers" ) - self.get_environment = response_helpers.async_to_streamed_response_wrapper( - sdk.get_environment, "extra_headers" + self.create_environment = response_helpers.async_to_streamed_response_wrapper( + sdk.create_environment, "extra_headers" ) self.delete_environment = response_helpers.async_to_streamed_response_wrapper( sdk.delete_environment, "extra_headers" ) + self.get_environment = response_helpers.async_to_streamed_response_wrapper( + sdk.get_environment, "extra_headers" + ) diff --git a/google/genai/_gaos/errors/cancelinteractionbyid.py b/google/genai/_gaos/errors/cancelinteractionbyid.py index 3ebea6d31..6e5235bb4 100644 --- a/google/genai/_gaos/errors/cancelinteractionbyid.py +++ b/google/genai/_gaos/errors/cancelinteractionbyid.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from dataclasses import dataclass, field from . import GenAiError from ..types import BaseModel from ..types.interactions import error as interactions_error -from dataclasses import dataclass, field import httpx from typing import Optional diff --git a/google/genai/_gaos/errors/createinteraction.py b/google/genai/_gaos/errors/createinteraction.py index 8e8332393..3b2095858 100644 --- a/google/genai/_gaos/errors/createinteraction.py +++ b/google/genai/_gaos/errors/createinteraction.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from dataclasses import dataclass, field from . import GenAiError from ..types import BaseModel from ..types.interactions import error as interactions_error -from dataclasses import dataclass, field import httpx from typing import Optional diff --git a/google/genai/_gaos/errors/deleteinteraction.py b/google/genai/_gaos/errors/deleteinteraction.py index 4ae8ff328..1d4406fcf 100644 --- a/google/genai/_gaos/errors/deleteinteraction.py +++ b/google/genai/_gaos/errors/deleteinteraction.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from dataclasses import dataclass, field from . import GenAiError from ..types import BaseModel from ..types.interactions import error as interactions_error -from dataclasses import dataclass, field import httpx from typing import Optional diff --git a/google/genai/_gaos/errors/getinteractionbyid.py b/google/genai/_gaos/errors/getinteractionbyid.py index 72b48a921..0ed3bc4fa 100644 --- a/google/genai/_gaos/errors/getinteractionbyid.py +++ b/google/genai/_gaos/errors/getinteractionbyid.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from dataclasses import dataclass, field from . import GenAiError from ..types import BaseModel from ..types.interactions import error as interactions_error -from dataclasses import dataclass, field import httpx from typing import Optional diff --git a/google/genai/_gaos/google_genai.py b/google/genai/_gaos/google_genai.py index dc9b3e44c..7802554f4 100644 --- a/google/genai/_gaos/google_genai.py +++ b/google/genai/_gaos/google_genai.py @@ -1003,7 +1003,15 @@ def _normalize_create_body(body: dict[str, Any]) -> dict[str, Any]: if not _is_content_list(input_value): return body - return {**body, 'input': [{'type': 'user_input', 'content': input_value}]} + normalized_content = [_normalize_content_block(item) for item in input_value] + return {**body, 'input': [{'type': 'user_input', 'content': normalized_content}]} + + +def _normalize_content_block(value: dict[str, Any]) -> dict[str, Any]: + if 'text' in value and 'type' not in value: + return {**value, 'type': 'text'} + return value + def _is_content_list(value: Any) -> bool: diff --git a/google/genai/_gaos/interactions.py b/google/genai/_gaos/interactions.py index 52fe581f6..f9a0cff9b 100644 --- a/google/genai/_gaos/interactions.py +++ b/google/genai/_gaos/interactions.py @@ -16,9 +16,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .basesdk import AsyncBaseSDK, BaseSDK from . import errors, models, types, utils from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK from .types import BaseModel, OptionalNullable, UNSET, interactions from .utils import get_security_from_env, response_helpers from .utils.eventstreaming import AsyncStream, Stream @@ -65,23 +65,23 @@ def create( self, *, api_version: Optional[str] = None, + background: bool = ..., + environment: interactions.CreateModelInteractionEnvironmentParam = ..., + generation_config: interactions.GenerationConfigParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., model: interactions.Model, - stream: Union[Literal[False], None] = None, + previous_interaction_id: str = ..., + response_format: interactions.CreateModelInteractionResponseFormatParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., + safety_settings: List[interactions.SafetySettingParam] = ..., + service_tier: interactions.ServiceTier = ..., store: bool = ..., - background: bool = ..., + stream: Union[Literal[False], None] = None, system_instruction: str = ..., tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., - previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., webhook_config: interactions.WebhookConfigParam = ..., - response_format: interactions.CreateModelInteractionResponseFormatParam = ..., - environment: interactions.CreateModelInteractionEnvironmentParam = ..., - generation_config: interactions.GenerationConfigParam = ..., - safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -92,23 +92,23 @@ def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -120,23 +120,23 @@ def create( self, *, api_version: Optional[str] = None, + background: bool = ..., + environment: interactions.CreateModelInteractionEnvironmentParam = ..., + generation_config: interactions.GenerationConfigParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., model: interactions.Model, - stream: Literal[True], + previous_interaction_id: str = ..., + response_format: interactions.CreateModelInteractionResponseFormatParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., + safety_settings: List[interactions.SafetySettingParam] = ..., + service_tier: interactions.ServiceTier = ..., store: bool = ..., - background: bool = ..., + stream: Literal[True], system_instruction: str = ..., tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., - previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., webhook_config: interactions.WebhookConfigParam = ..., - response_format: interactions.CreateModelInteractionResponseFormatParam = ..., - environment: interactions.CreateModelInteractionEnvironmentParam = ..., - generation_config: interactions.GenerationConfigParam = ..., - safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -147,23 +147,23 @@ def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -176,22 +176,22 @@ def create( *, api_version: Optional[str] = None, agent: interactions.AgentOption, - stream: Union[Literal[False], None] = None, - store: bool = ..., + agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., background: bool = ..., - system_instruction: str = ..., - tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., + environment: interactions.CreateAgentInteractionEnvironmentParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., - webhook_config: interactions.WebhookConfigParam = ..., response_format: interactions.CreateAgentInteractionResponseFormatParam = ..., - environment: interactions.CreateAgentInteractionEnvironmentParam = ..., - agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, + service_tier: interactions.ServiceTier = ..., + store: bool = ..., + stream: Union[Literal[False], None] = None, + system_instruction: str = ..., + tools: List[interactions.ToolParam] = ..., + webhook_config: interactions.WebhookConfigParam = ..., extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -203,22 +203,22 @@ def create( :param api_version: Which version of the API to use. :param agent: The agent to interact with. - :param stream: Input only. Whether the interaction will be streamed. - :param store: Input only. Whether to store the response and request for later retrieval. + :param agent_config: Configuration parameters for the agent interaction. :param background: Input only. Whether to run the model interaction in the background. - :param system_instruction: System instruction for the interaction. - :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: - :param webhook_config: Message for configuring webhook events for a request. :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param agent_config: Configuration parameters for the agent interaction. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. + :param service_tier: + :param store: Input only. Whether to store the response and request for later retrieval. + :param stream: Input only. Whether the interaction will be streamed. + :param system_instruction: System instruction for the interaction. + :param tools: A list of tool declarations the model may call during interaction. + :param webhook_config: Message for configuring webhook events for a request. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -231,22 +231,22 @@ def create( *, api_version: Optional[str] = None, agent: interactions.AgentOption, - stream: Literal[True], - store: bool = ..., + agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., background: bool = ..., - system_instruction: str = ..., - tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., + environment: interactions.CreateAgentInteractionEnvironmentParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., - webhook_config: interactions.WebhookConfigParam = ..., response_format: interactions.CreateAgentInteractionResponseFormatParam = ..., - environment: interactions.CreateAgentInteractionEnvironmentParam = ..., - agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, + service_tier: interactions.ServiceTier = ..., + store: bool = ..., + stream: Literal[True], + system_instruction: str = ..., + tools: List[interactions.ToolParam] = ..., + webhook_config: interactions.WebhookConfigParam = ..., extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -258,22 +258,22 @@ def create( :param api_version: Which version of the API to use. :param agent: The agent to interact with. - :param stream: Input only. Whether the interaction will be streamed. - :param store: Input only. Whether to store the response and request for later retrieval. + :param agent_config: Configuration parameters for the agent interaction. :param background: Input only. Whether to run the model interaction in the background. - :param system_instruction: System instruction for the interaction. - :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: - :param webhook_config: Message for configuring webhook events for a request. :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param agent_config: Configuration parameters for the agent interaction. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. + :param service_tier: + :param store: Input only. Whether to store the response and request for later retrieval. + :param stream: Input only. Whether the interaction will be streamed. + :param system_instruction: System instruction for the interaction. + :param tools: A list of tool declarations the model may call during interaction. + :param webhook_config: Message for configuring webhook events for a request. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -299,23 +299,23 @@ def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param agent: The agent to interact with. :param agent_config: Configuration parameters for the agent interaction. :param extra_headers: Additional headers to set or replace on requests. @@ -342,23 +342,23 @@ def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param agent: The agent to interact with. :param agent_config: Configuration parameters for the agent interaction. :param extra_headers: Additional headers to set or replace on requests. @@ -366,16 +366,16 @@ def create( :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ - if "model" in body_kwargs and "agent" in body_kwargs: - raise ValueError("Cannot supply both 'model' and 'agent'.") - if "model" in body_kwargs and "agent_config" in body_kwargs: - raise ValueError("Cannot supply both 'model' and 'agent_config'.") if "generation_config" in body_kwargs and "agent" in body_kwargs: raise ValueError("Cannot supply both 'generation_config' and 'agent'.") if "generation_config" in body_kwargs and "agent_config" in body_kwargs: raise ValueError( "Cannot supply both 'generation_config' and 'agent_config'." ) + if "model" in body_kwargs and "agent" in body_kwargs: + raise ValueError("Cannot supply both 'model' and 'agent'.") + if "model" in body_kwargs and "agent_config" in body_kwargs: + raise ValueError("Cannot supply both 'model' and 'agent_config'.") base_url = None url_variables = None retries: OptionalNullable[utils.RetryConfig] = UNSET @@ -717,107 +717,20 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - @overload - def get( + def delete( self, id: str, *, - stream: Union[Literal[False], None] = None, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, api_version: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Interaction: - r"""Retrieving an interaction - - Retrieves the full details of a single interaction based on its `Interaction.id`. - - :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def get( - self, - id: str, - *, - stream: Literal[True], - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> Stream[interactions.InteractionSSEEvent]: - r"""Retrieving an interaction - - Retrieves the full details of a single interaction based on its `Interaction.id`. - - :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - @overload - def get( - self, - id: str, - *, - stream: bool, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> Union[interactions.Interaction, Stream[interactions.InteractionSSEEvent]]: - r"""Retrieving an interaction - - Retrieves the full details of a single interaction based on its `Interaction.id`. - - :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - - def get( - self, - id: str, - *, - stream: Optional[bool] = False, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> Union[interactions.Interaction, Stream[interactions.InteractionSSEEvent]]: - r"""Retrieving an interaction + ): + r"""Deleting an interaction - Retrieves the full details of a single interaction based on its `Interaction.id`. + Deletes the interaction by id. - :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. + :param id: The unique identifier of the interaction to delete. :param api_version: Which version of the API to use. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. @@ -837,19 +750,16 @@ def get( else: base_url = self._get_url(base_url, url_variables) - request = models.GetInteractionByIDRequest( - id=id, - stream=stream, - last_event_id=last_event_id, - include_input=include_input, + request = models.DeleteInteractionRequest( api_version=api_version, + id=id, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", + method="DELETE", path="/{api_version}/interactions/{id}", base_url=base_url, url_variables=url_variables, @@ -858,12 +768,10 @@ def get( request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value="text/event-stream" - if stream is True - else "application/json", + accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetInteractionByIDGlobals( + _globals=models.DeleteInteractionGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -888,67 +796,39 @@ def get( def _speakeasy_parse_response(http_res): response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - http_res_text = utils.stream_to_text(http_res) - return unmarshal_json_response( - interactions.Interaction, http_res, http_res_text, validate=False - ) - if utils.match_response(http_res, "200", "text/event-stream"): - return Stream( - http_res, - lambda raw: unmarshal_json_response( - interactions.InteractionSSEStreamEvent, - http_res, - raw, - validate=False, - ).data, - sentinel="[DONE]", - client_ref=self, - ) + if utils.match_response(http_res, "200", "*"): + return if utils.match_response(http_res, "4XX", "application/json"): - http_res_text = utils.stream_to_text(http_res) try: response_data = unmarshal_json_response( - errors.GetInteractionByIDClientErrorData, - http_res, - http_res_text, - ) - raise errors.GetInteractionByIDClientError( - response_data, http_res, http_res_text + errors.DeleteInteractionClientErrorData, http_res ) + raise errors.DeleteInteractionClientError(response_data, http_res) except errors.ResponseValidationError as e: raise errors.GenAiDefaultError( "Error response body did not match expected schema", http_res, - http_res_text, + http_res.text, ) from e if utils.match_response(http_res, "5XX", "application/json"): - http_res_text = utils.stream_to_text(http_res) try: response_data = unmarshal_json_response( - errors.GetInteractionByIDServerErrorData, - http_res, - http_res_text, - ) - raise errors.GetInteractionByIDServerError( - response_data, http_res, http_res_text + errors.DeleteInteractionServerErrorData, http_res ) + raise errors.DeleteInteractionServerError(response_data, http_res) except errors.ResponseValidationError as e: raise errors.GenAiDefaultError( "Error response body did not match expected schema", http_res, - http_res_text, + http_res.text, ) from e - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "Unexpected response received", http_res, http_res_text - ) + raise errors.GenAiDefaultError("Unexpected response received", http_res) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="getInteractionById", + operation_id="deleteInteraction", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -957,19 +837,19 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "get", + "label": "delete", "lang": "sh", - "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -H "Api-Revision: 2026-05-20" \\\n -d \'{"model": "gemini-3.6-flash", "input": "Say hello."}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Api-Revision: 2026-05-20"\n', + "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\ -d \'{"model": "gemini-3.6-flash", "input": "Hello"}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X DELETE "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', }, { - "label": "get", + "label": "delete", "lang": "python", - "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Say hello."\n)\n# [/setup]\n\ninteraction = client.interactions.get(id=created.id)\nprint(interaction.status)\n', + "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Hello",\n)\n# [/setup]\n\nclient.interactions.delete(id=created.id)\nprint("Interaction deleted successfully.")\n', }, { - "label": "get", + "label": "delete", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Say hello.'\n});\n// [/setup]\n\nconst interaction = await ai.interactions.get(created.id);\nconsole.log(interaction.status);\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Hello',\n});\n// [/setup]\n\nawait ai.interactions.delete(created.id);\nconsole.log('Interaction deleted successfully.');\n", }, ] }, @@ -979,7 +859,7 @@ def _speakeasy_parse_response(http_res): hook_ctx=_speakeasy_hook_ctx, request=req, is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=stream is True or _speakeasy_response_mode == "streaming", + stream=_speakeasy_response_mode == "streaming", retry_config=retry_config, ) if _speakeasy_response_mode != "parsed": @@ -1004,7 +884,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_response_cls( raw=http_res, parser=_speakeasy_parse_response, - mode=("event_stream" if stream is True else "buffered"), + mode="buffered", client_ref=self, hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), hooks=self.sdk_configuration.__dict__.get("_hooks"), @@ -1020,21 +900,108 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def delete( + @overload + def get( self, id: str, *, api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Union[Literal[False], None] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ): - r"""Deleting an interaction + ) -> interactions.Interaction: + r"""Retrieving an interaction - Deletes the interaction by id. + Retrieves the full details of a single interaction based on its `Interaction.id`. - :param id: The unique identifier of the interaction to delete. + :param id: The unique identifier of the interaction to retrieve. + :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + + @overload + def get( + self, + id: str, + *, + api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Literal[True], + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ) -> Stream[interactions.InteractionSSEEvent]: + r"""Retrieving an interaction + + Retrieves the full details of a single interaction based on its `Interaction.id`. + + :param id: The unique identifier of the interaction to retrieve. :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + + @overload + def get( + self, + id: str, + *, + api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: bool, + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ) -> Union[interactions.Interaction, Stream[interactions.InteractionSSEEvent]]: + r"""Retrieving an interaction + + Retrieves the full details of a single interaction based on its `Interaction.id`. + + :param id: The unique identifier of the interaction to retrieve. + :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + + def get( + self, + id: str, + *, + api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Optional[bool] = False, + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ) -> Union[interactions.Interaction, Stream[interactions.InteractionSSEEvent]]: + r"""Retrieving an interaction + + Retrieves the full details of a single interaction based on its `Interaction.id`. + + :param id: The unique identifier of the interaction to retrieve. + :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -1053,16 +1020,19 @@ def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteInteractionRequest( - id=id, + request = models.GetInteractionByIDRequest( api_version=api_version, + id=id, + include_input=include_input, + last_event_id=last_event_id, + stream=stream, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="DELETE", + method="GET", path="/{api_version}/interactions/{id}", base_url=base_url, url_variables=url_variables, @@ -1071,10 +1041,12 @@ def delete( request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", - accept_header_value="application/json", + accept_header_value="text/event-stream" + if stream is True + else "application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteInteractionGlobals( + _globals=models.GetInteractionByIDGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1099,39 +1071,67 @@ def delete( def _speakeasy_parse_response(http_res): response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return + if utils.match_response(http_res, "200", "application/json"): + http_res_text = utils.stream_to_text(http_res) + return unmarshal_json_response( + interactions.Interaction, http_res, http_res_text, validate=False + ) + if utils.match_response(http_res, "200", "text/event-stream"): + return Stream( + http_res, + lambda raw: unmarshal_json_response( + interactions.InteractionSSEStreamEvent, + http_res, + raw, + validate=False, + ).data, + sentinel="[DONE]", + client_ref=self, + ) if utils.match_response(http_res, "4XX", "application/json"): + http_res_text = utils.stream_to_text(http_res) try: response_data = unmarshal_json_response( - errors.DeleteInteractionClientErrorData, http_res + errors.GetInteractionByIDClientErrorData, + http_res, + http_res_text, + ) + raise errors.GetInteractionByIDClientError( + response_data, http_res, http_res_text ) - raise errors.DeleteInteractionClientError(response_data, http_res) except errors.ResponseValidationError as e: raise errors.GenAiDefaultError( "Error response body did not match expected schema", http_res, - http_res.text, + http_res_text, ) from e if utils.match_response(http_res, "5XX", "application/json"): + http_res_text = utils.stream_to_text(http_res) try: response_data = unmarshal_json_response( - errors.DeleteInteractionServerErrorData, http_res + errors.GetInteractionByIDServerErrorData, + http_res, + http_res_text, + ) + raise errors.GetInteractionByIDServerError( + response_data, http_res, http_res_text ) - raise errors.DeleteInteractionServerError(response_data, http_res) except errors.ResponseValidationError as e: raise errors.GenAiDefaultError( "Error response body did not match expected schema", http_res, - http_res.text, + http_res_text, ) from e - raise errors.GenAiDefaultError("Unexpected response received", http_res) + http_res_text = utils.stream_to_text(http_res) + raise errors.GenAiDefaultError( + "Unexpected response received", http_res, http_res_text + ) _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="deleteInteraction", + operation_id="getInteractionById", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1140,19 +1140,19 @@ def _speakeasy_parse_response(http_res): extensions={ "x-codeSamples": [ { - "label": "delete", + "label": "get", "lang": "sh", - "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\ -d \'{"model": "gemini-3.6-flash", "input": "Hello"}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X DELETE "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\\n -H "Api-Revision: 2026-05-20" \\\n -d \'{"model": "gemini-3.6-flash", "input": "Say hello."}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Api-Revision: 2026-05-20"\n', }, { - "label": "delete", + "label": "get", "lang": "python", - "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Hello",\n)\n# [/setup]\n\nclient.interactions.delete(id=created.id)\nprint("Interaction deleted successfully.")\n', + "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Say hello."\n)\n# [/setup]\n\ninteraction = client.interactions.get(id=created.id)\nprint(interaction.status)\n', }, { - "label": "delete", + "label": "get", "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Hello',\n});\n// [/setup]\n\nawait ai.interactions.delete(created.id);\nconsole.log('Interaction deleted successfully.');\n", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Say hello.'\n});\n// [/setup]\n\nconst interaction = await ai.interactions.get(created.id);\nconsole.log(interaction.status);\n", }, ] }, @@ -1162,7 +1162,7 @@ def _speakeasy_parse_response(http_res): hook_ctx=_speakeasy_hook_ctx, request=req, is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", + stream=stream is True or _speakeasy_response_mode == "streaming", retry_config=retry_config, ) if _speakeasy_response_mode != "parsed": @@ -1187,7 +1187,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_response_cls( raw=http_res, parser=_speakeasy_parse_response, - mode="buffered", + mode=("event_stream" if stream is True else "buffered"), client_ref=self, hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), hooks=self.sdk_configuration.__dict__.get("_hooks"), @@ -1237,8 +1237,8 @@ def cancel( base_url = self._get_url(base_url, url_variables) request = models.CancelInteractionByIDRequest( - id=id, api_version=api_version, + id=id, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( @@ -1399,10 +1399,10 @@ def __init__(self, sdk: Interactions) -> None: self.create = response_helpers.to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") self.delete = response_helpers.to_raw_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") self.cancel = response_helpers.to_raw_response_wrapper( sdk.cancel, "extra_headers" ) @@ -1414,12 +1414,12 @@ def __init__(self, sdk: Interactions) -> None: self.create = response_helpers.to_streamed_response_wrapper( sdk.create, "extra_headers" ) - self.get = response_helpers.to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) self.delete = response_helpers.to_streamed_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.to_streamed_response_wrapper( + sdk.get, "extra_headers" + ) self.cancel = response_helpers.to_streamed_response_wrapper( sdk.cancel, "extra_headers" ) @@ -1463,23 +1463,23 @@ async def create( self, *, api_version: Optional[str] = None, + background: bool = ..., + environment: interactions.CreateModelInteractionEnvironmentParam = ..., + generation_config: interactions.GenerationConfigParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., model: interactions.Model, - stream: Union[Literal[False], None] = None, + previous_interaction_id: str = ..., + response_format: interactions.CreateModelInteractionResponseFormatParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., + safety_settings: List[interactions.SafetySettingParam] = ..., + service_tier: interactions.ServiceTier = ..., store: bool = ..., - background: bool = ..., + stream: Union[Literal[False], None] = None, system_instruction: str = ..., tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., - previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., webhook_config: interactions.WebhookConfigParam = ..., - response_format: interactions.CreateModelInteractionResponseFormatParam = ..., - environment: interactions.CreateModelInteractionEnvironmentParam = ..., - generation_config: interactions.GenerationConfigParam = ..., - safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -1490,23 +1490,23 @@ async def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -1518,23 +1518,23 @@ async def create( self, *, api_version: Optional[str] = None, + background: bool = ..., + environment: interactions.CreateModelInteractionEnvironmentParam = ..., + generation_config: interactions.GenerationConfigParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., model: interactions.Model, - stream: Literal[True], + previous_interaction_id: str = ..., + response_format: interactions.CreateModelInteractionResponseFormatParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., + safety_settings: List[interactions.SafetySettingParam] = ..., + service_tier: interactions.ServiceTier = ..., store: bool = ..., - background: bool = ..., + stream: Literal[True], system_instruction: str = ..., tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., - previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., webhook_config: interactions.WebhookConfigParam = ..., - response_format: interactions.CreateModelInteractionResponseFormatParam = ..., - environment: interactions.CreateModelInteractionEnvironmentParam = ..., - generation_config: interactions.GenerationConfigParam = ..., - safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -1545,23 +1545,23 @@ async def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -1574,22 +1574,22 @@ async def create( *, api_version: Optional[str] = None, agent: interactions.AgentOption, - stream: Union[Literal[False], None] = None, - store: bool = ..., + agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., background: bool = ..., - system_instruction: str = ..., - tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., + environment: interactions.CreateAgentInteractionEnvironmentParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., - webhook_config: interactions.WebhookConfigParam = ..., response_format: interactions.CreateAgentInteractionResponseFormatParam = ..., - environment: interactions.CreateAgentInteractionEnvironmentParam = ..., - agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, + service_tier: interactions.ServiceTier = ..., + store: bool = ..., + stream: Union[Literal[False], None] = None, + system_instruction: str = ..., + tools: List[interactions.ToolParam] = ..., + webhook_config: interactions.WebhookConfigParam = ..., extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -1601,22 +1601,22 @@ async def create( :param api_version: Which version of the API to use. :param agent: The agent to interact with. - :param stream: Input only. Whether the interaction will be streamed. - :param store: Input only. Whether to store the response and request for later retrieval. + :param agent_config: Configuration parameters for the agent interaction. :param background: Input only. Whether to run the model interaction in the background. - :param system_instruction: System instruction for the interaction. - :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: - :param webhook_config: Message for configuring webhook events for a request. :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param agent_config: Configuration parameters for the agent interaction. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. + :param service_tier: + :param store: Input only. Whether to store the response and request for later retrieval. + :param stream: Input only. Whether the interaction will be streamed. + :param system_instruction: System instruction for the interaction. + :param tools: A list of tool declarations the model may call during interaction. + :param webhook_config: Message for configuring webhook events for a request. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -1629,22 +1629,22 @@ async def create( *, api_version: Optional[str] = None, agent: interactions.AgentOption, - stream: Literal[True], - store: bool = ..., + agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., background: bool = ..., - system_instruction: str = ..., - tools: List[interactions.ToolParam] = ..., - response_modalities: List[interactions.ResponseModality] = ..., - response_mime_type: str = ..., + environment: interactions.CreateAgentInteractionEnvironmentParam = ..., + input: interactions.InteractionsInputParam, + labels: Dict[str, str] = ..., previous_interaction_id: str = ..., - service_tier: interactions.ServiceTier = ..., - webhook_config: interactions.WebhookConfigParam = ..., response_format: interactions.CreateAgentInteractionResponseFormatParam = ..., - environment: interactions.CreateAgentInteractionEnvironmentParam = ..., - agent_config: interactions.CreateAgentInteractionAgentConfigParam = ..., + response_mime_type: str = ..., + response_modalities: List[interactions.ResponseModality] = ..., safety_settings: List[interactions.SafetySettingParam] = ..., - labels: Dict[str, str] = ..., - input: interactions.InteractionsInputParam, + service_tier: interactions.ServiceTier = ..., + store: bool = ..., + stream: Literal[True], + system_instruction: str = ..., + tools: List[interactions.ToolParam] = ..., + webhook_config: interactions.WebhookConfigParam = ..., extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -1656,22 +1656,22 @@ async def create( :param api_version: Which version of the API to use. :param agent: The agent to interact with. - :param stream: Input only. Whether the interaction will be streamed. + :param agent_config: Configuration parameters for the agent interaction. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param agent_config: Configuration parameters for the agent interaction. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -1697,23 +1697,23 @@ async def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param agent: The agent to interact with. :param agent_config: Configuration parameters for the agent interaction. :param extra_headers: Additional headers to set or replace on requests. @@ -1740,23 +1740,23 @@ async def create( Creates a new interaction. :param api_version: Which version of the API to use. + :param background: Input only. Whether to run the model interaction in the background. + :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. + :param generation_config: Configuration parameters for model interactions. + :param input: The input for the interaction. + :param labels: The labels with user-defined metadata for the request. :param model: The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - :param stream: Input only. Whether the interaction will be streamed. + :param previous_interaction_id: The ID of the previous interaction, if any. + :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. + :param response_mime_type: The mime type of the response. This is required if response_format is set. + :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). + :param safety_settings: Safety settings for the interaction. + :param service_tier: :param store: Input only. Whether to store the response and request for later retrieval. - :param background: Input only. Whether to run the model interaction in the background. + :param stream: Input only. Whether the interaction will be streamed. :param system_instruction: System instruction for the interaction. :param tools: A list of tool declarations the model may call during interaction. - :param response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - :param response_mime_type: The mime type of the response. This is required if response_format is set. - :param previous_interaction_id: The ID of the previous interaction, if any. - :param service_tier: :param webhook_config: Message for configuring webhook events for a request. - :param response_format: Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field. - :param environment: The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID. - :param generation_config: Configuration parameters for model interactions. - :param safety_settings: Safety settings for the interaction. - :param labels: The labels with user-defined metadata for the request. - :param input: The input for the interaction. :param agent: The agent to interact with. :param agent_config: Configuration parameters for the agent interaction. :param extra_headers: Additional headers to set or replace on requests. @@ -1764,16 +1764,16 @@ async def create( :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ - if "model" in body_kwargs and "agent" in body_kwargs: - raise ValueError("Cannot supply both 'model' and 'agent'.") - if "model" in body_kwargs and "agent_config" in body_kwargs: - raise ValueError("Cannot supply both 'model' and 'agent_config'.") if "generation_config" in body_kwargs and "agent" in body_kwargs: raise ValueError("Cannot supply both 'generation_config' and 'agent'.") if "generation_config" in body_kwargs and "agent_config" in body_kwargs: raise ValueError( "Cannot supply both 'generation_config' and 'agent_config'." ) + if "model" in body_kwargs and "agent" in body_kwargs: + raise ValueError("Cannot supply both 'model' and 'agent'.") + if "model" in body_kwargs and "agent_config" in body_kwargs: + raise ValueError("Cannot supply both 'model' and 'agent_config'.") base_url = None url_variables = None retries: OptionalNullable[utils.RetryConfig] = UNSET @@ -2118,15 +2118,201 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) + async def delete( + self, + id: str, + *, + api_version: Optional[str] = None, + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ): + r"""Deleting an interaction + + Deletes the interaction by id. + + :param id: The unique identifier of the interaction to delete. + :param api_version: Which version of the API to use. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + base_url = None + url_variables = None + retries: OptionalNullable[utils.RetryConfig] = UNSET + server_url = None + http_headers = extra_headers + timeout_ms = self._coerce_timeout_ms(timeout) + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeleteInteractionRequest( + api_version=api_version, + id=id, + ) + + _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( + http_headers + ) + req = self._build_request_async( + method="DELETE", + path="/{api_version}/interactions/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + extra_query_params=extra_query, + _globals=models.DeleteInteractionGlobals( + api_version=self.sdk_configuration.globals.api_version, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "attempt-count-backoff", + utils.BackoffStrategy(500, 8000, 2, 30000), + True, + max_retries=4, + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "409", "429", "5XX"]) + + async def _speakeasy_parse_response(http_res): + response_data: Any = None + if utils.match_response(http_res, "200", "*"): + return + if utils.match_response(http_res, "4XX", "application/json"): + try: + response_data = unmarshal_json_response( + errors.DeleteInteractionClientErrorData, http_res + ) + raise errors.DeleteInteractionClientError(response_data, http_res) + except errors.ResponseValidationError as e: + raise errors.GenAiDefaultError( + "Error response body did not match expected schema", + http_res, + http_res.text, + ) from e + if utils.match_response(http_res, "5XX", "application/json"): + try: + response_data = unmarshal_json_response( + errors.DeleteInteractionServerErrorData, http_res + ) + raise errors.DeleteInteractionServerError(response_data, http_res) + except errors.ResponseValidationError as e: + raise errors.GenAiDefaultError( + "Error response body did not match expected schema", + http_res, + http_res.text, + ) from e + + raise errors.GenAiDefaultError("Unexpected response received", http_res) + + _speakeasy_hook_ctx = HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteInteraction", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, types.Security + ), + tags=None, + extensions={ + "x-codeSamples": [ + { + "label": "delete", + "lang": "sh", + "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\ -d \'{"model": "gemini-3.6-flash", "input": "Hello"}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X DELETE "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', + }, + { + "label": "delete", + "lang": "python", + "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Hello",\n)\n# [/setup]\n\nclient.interactions.delete(id=created.id)\nprint("Interaction deleted successfully.")\n', + }, + { + "label": "delete", + "lang": "javascript", + "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Hello',\n});\n// [/setup]\n\nawait ai.interactions.delete(created.id);\nconsole.log('Interaction deleted successfully.');\n", + }, + ] + }, + response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), + ) + http_res = await self.do_request_async( + hook_ctx=_speakeasy_hook_ctx, + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + stream=_speakeasy_response_mode == "streaming", + retry_config=retry_config, + ) + if _speakeasy_response_mode != "parsed": + if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): + await http_res.aread() + try: + await _speakeasy_parse_response(http_res) + except Exception as parse_exc_: + await response_helpers.raise_parse_error_async( + self.sdk_configuration.__dict__.get("_async_hooks"), + self.sdk_configuration.__dict__.get("_hooks"), + AfterParseErrorContext(_speakeasy_hook_ctx), + http_res, + parse_exc_, + ) + _speakeasy_response_cls = ( + response_helpers.AsyncStreamedAPIResponse + if _speakeasy_response_mode == "streaming" + else response_helpers.AsyncAPIResponse + ) + return cast( + Any, + _speakeasy_response_cls( + raw=http_res, + parser=_speakeasy_parse_response, + mode="buffered", + client_ref=self, + hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), + hooks=self.sdk_configuration.__dict__.get("_hooks"), + async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), + ), + ) + try: + return await _speakeasy_parse_response(http_res) + except Exception as parse_exc_: + await response_helpers.raise_parse_error_async( + self.sdk_configuration.__dict__.get("_async_hooks"), + self.sdk_configuration.__dict__.get("_hooks"), + AfterParseErrorContext(_speakeasy_hook_ctx), + http_res, + parse_exc_, + ) + @overload async def get( self, id: str, *, - stream: Union[Literal[False], None] = None, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Union[Literal[False], None] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, @@ -2136,10 +2322,10 @@ async def get( Retrieves the full details of a single interaction based on its `Interaction.id`. :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2150,10 +2336,10 @@ async def get( self, id: str, *, - stream: Literal[True], - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Literal[True], extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, @@ -2163,10 +2349,10 @@ async def get( Retrieves the full details of a single interaction based on its `Interaction.id`. :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2177,10 +2363,10 @@ async def get( self, id: str, *, - stream: bool, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: bool, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, @@ -2190,10 +2376,10 @@ async def get( Retrieves the full details of a single interaction based on its `Interaction.id`. :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2203,10 +2389,10 @@ async def get( self, id: str, *, - stream: Optional[bool] = False, - last_event_id: Optional[str] = None, - include_input: Optional[bool] = False, api_version: Optional[str] = None, + include_input: Optional[bool] = False, + last_event_id: Optional[str] = None, + stream: Optional[bool] = False, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, @@ -2216,10 +2402,10 @@ async def get( Retrieves the full details of a single interaction based on its `Interaction.id`. :param id: The unique identifier of the interaction to retrieve. - :param stream: If set to true, the generated content will be streamed incrementally. - :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. - :param include_input: If set to true, includes the input in the response. :param api_version: Which version of the API to use. + :param include_input: If set to true, includes the input in the response. + :param last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true. + :param stream: If set to true, the generated content will be streamed incrementally. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2239,11 +2425,11 @@ async def get( base_url = self._get_url(base_url, url_variables) request = models.GetInteractionByIDRequest( + api_version=api_version, id=id, - stream=stream, - last_event_id=last_event_id, include_input=include_input, - api_version=api_version, + last_event_id=last_event_id, + stream=stream, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( @@ -2424,192 +2610,6 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def delete( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ): - r"""Deleting an interaction - - Deletes the interaction by id. - - :param id: The unique identifier of the interaction to delete. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.DeleteInteractionRequest( - id=id, - api_version=api_version, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="DELETE", - path="/{api_version}/interactions/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.DeleteInteractionGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - if utils.match_response(http_res, "4XX", "application/json"): - try: - response_data = unmarshal_json_response( - errors.DeleteInteractionClientErrorData, http_res - ) - raise errors.DeleteInteractionClientError(response_data, http_res) - except errors.ResponseValidationError as e: - raise errors.GenAiDefaultError( - "Error response body did not match expected schema", - http_res, - http_res.text, - ) from e - if utils.match_response(http_res, "5XX", "application/json"): - try: - response_data = unmarshal_json_response( - errors.DeleteInteractionServerErrorData, http_res - ) - raise errors.DeleteInteractionServerError(response_data, http_res) - except errors.ResponseValidationError as e: - raise errors.GenAiDefaultError( - "Error response body did not match expected schema", - http_res, - http_res.text, - ) from e - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="deleteInteraction", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions={ - "x-codeSamples": [ - { - "label": "delete", - "lang": "sh", - "source": '# [setup]\nINTERACTION_ID=$(curl -s -X POST https://generativelanguage.googleapis.com/v1beta/interactions \\\n -H "x-goog-api-key: $GEMINI_API_KEY" \\\n -H "Content-Type: application/json" \\ -d \'{"model": "gemini-3.6-flash", "input": "Hello"}\' \\\n | python3 -c "import sys,json; print(json.load(sys.stdin)[\'id\'])")\n# [/setup]\n\ncurl -X DELETE "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \\\n -H "x-goog-api-key: $GEMINI_API_KEY"\n', - }, - { - "label": "delete", - "lang": "python", - "source": 'from google import genai\n\nclient = genai.Client()\n\n# [setup]\ncreated = client.interactions.create(\n model="gemini-3.6-flash",\n input="Hello",\n)\n# [/setup]\n\nclient.interactions.delete(id=created.id)\nprint("Interaction deleted successfully.")\n', - }, - { - "label": "delete", - "lang": "javascript", - "source": "import {GoogleGenAI} from '@google/genai';\n\nconst ai = new GoogleGenAI({});\n\n// [setup]\nconst created = await ai.interactions.create({\n model: 'gemini-3.6-flash',\n input: 'Hello',\n});\n// [/setup]\n\nawait ai.interactions.delete(created.id);\nconsole.log('Interaction deleted successfully.');\n", - }, - ] - }, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - async def cancel( self, id: str, @@ -2644,8 +2644,8 @@ async def cancel( base_url = self._get_url(base_url, url_variables) request = models.CancelInteractionByIDRequest( - id=id, api_version=api_version, + id=id, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( @@ -2809,12 +2809,12 @@ def __init__(self, sdk: AsyncInteractions) -> None: self.create = response_helpers.async_to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.get = response_helpers.async_to_raw_response_wrapper( - sdk.get, "extra_headers" - ) self.delete = response_helpers.async_to_raw_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.async_to_raw_response_wrapper( + sdk.get, "extra_headers" + ) self.cancel = response_helpers.async_to_raw_response_wrapper( sdk.cancel, "extra_headers" ) @@ -2826,12 +2826,12 @@ def __init__(self, sdk: AsyncInteractions) -> None: self.create = response_helpers.async_to_streamed_response_wrapper( sdk.create, "extra_headers" ) - self.get = response_helpers.async_to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) self.delete = response_helpers.async_to_streamed_response_wrapper( sdk.delete, "extra_headers" ) + self.get = response_helpers.async_to_streamed_response_wrapper( + sdk.get, "extra_headers" + ) self.cancel = response_helpers.async_to_streamed_response_wrapper( sdk.cancel, "extra_headers" ) diff --git a/google/genai/_gaos/models/createinteraction.py b/google/genai/_gaos/models/createinteraction.py index 6e9a57206..3e8ee34cb 100644 --- a/google/genai/_gaos/models/createinteraction.py +++ b/google/genai/_gaos/models/createinteraction.py @@ -63,8 +63,8 @@ def serialize_model(self, handler): CreateInteractionRequestBodyParam = TypeAliasType( "CreateInteractionRequestBodyParam", Union[ - interactions_createmodelinteraction.CreateModelInteractionParam, interactions_createagentinteraction.CreateAgentInteractionParam, + interactions_createmodelinteraction.CreateModelInteractionParam, ], ) r"""The request body.""" @@ -73,8 +73,8 @@ def serialize_model(self, handler): CreateInteractionRequestBody = TypeAliasType( "CreateInteractionRequestBody", Union[ - interactions_createmodelinteraction.CreateModelInteraction, interactions_createagentinteraction.CreateAgentInteraction, + interactions_createmodelinteraction.CreateModelInteraction, ], ) r"""The request body.""" diff --git a/google/genai/_gaos/models/createtrigger.py b/google/genai/_gaos/models/createtrigger.py index 2e4c8ddcb..62e6e2b8c 100644 --- a/google/genai/_gaos/models/createtrigger.py +++ b/google/genai/_gaos/models/createtrigger.py @@ -18,7 +18,9 @@ from __future__ import annotations from ..types import BaseModel, UNSET_SENTINEL -from ..types.triggers import triggercreateparams as triggers_triggercreateparams +from ..types.triggers import ( + triggercreateparams as triggers_triggercreateparams, +) from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata from pydantic import model_serializer from typing import Optional diff --git a/google/genai/_gaos/models/getinteractionbyid.py b/google/genai/_gaos/models/getinteractionbyid.py index 9360d64f6..e20a042d6 100644 --- a/google/genai/_gaos/models/getinteractionbyid.py +++ b/google/genai/_gaos/models/getinteractionbyid.py @@ -62,14 +62,14 @@ def serialize_model(self, handler): class GetInteractionByIDRequestParam(TypedDict): id: str r"""The unique identifier of the interaction to retrieve.""" - stream: NotRequired[bool] - r"""If set to true, the generated content will be streamed incrementally.""" - last_event_id: NotRequired[str] - r"""Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.""" - include_input: NotRequired[bool] - r"""If set to true, includes the input in the response.""" api_version: NotRequired[str] r"""Which version of the API to use.""" + include_input: NotRequired[bool] + r"""If set to true, includes the input in the response.""" + last_event_id: NotRequired[str] + r"""Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.""" + stream: NotRequired[bool] + r"""If set to true, the generated content will be streamed incrementally.""" class GetInteractionByIDRequest(BaseModel): @@ -78,17 +78,11 @@ class GetInteractionByIDRequest(BaseModel): ] r"""The unique identifier of the interaction to retrieve.""" - stream: Annotated[ - Optional[bool], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = False - r"""If set to true, the generated content will be streamed incrementally.""" - - last_event_id: Annotated[ + api_version: Annotated[ Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), ] = None - r"""Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.""" + r"""Which version of the API to use.""" include_input: Annotated[ Optional[bool], @@ -99,16 +93,22 @@ class GetInteractionByIDRequest(BaseModel): ] = False r"""If set to true, includes the input in the response.""" - api_version: Annotated[ + last_event_id: Annotated[ Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None - r"""Which version of the API to use.""" + r"""Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.""" + + stream: Annotated[ + Optional[bool], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = False + r"""If set to true, the generated content will be streamed incrementally.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["stream", "last_event_id", "include_input", "api_version"] + ["api_version", "include_input", "last_event_id", "stream"] ) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/models/pingwebhook.py b/google/genai/_gaos/models/pingwebhook.py index f2644c154..ef89ee5c4 100644 --- a/google/genai/_gaos/models/pingwebhook.py +++ b/google/genai/_gaos/models/pingwebhook.py @@ -18,7 +18,9 @@ from __future__ import annotations from ..types import BaseModel, UNSET_SENTINEL -from ..types.webhooks import pingwebhookrequest as webhooks_pingwebhookrequest +from ..types.webhooks import ( + pingwebhookrequest as webhooks_pingwebhookrequest, +) from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata from pydantic import model_serializer from typing import Optional diff --git a/google/genai/_gaos/sdk.py b/google/genai/_gaos/sdk.py index 06fd8e874..8be0cda3a 100644 --- a/google/genai/_gaos/sdk.py +++ b/google/genai/_gaos/sdk.py @@ -16,8 +16,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from . import models, types, utils -from ._hooks import AsyncSDKHooks, SDKHooks, init_async_hooks from .basesdk import AsyncBaseSDK, BaseSDK from .httpclient import ( AsyncHttpClient, @@ -27,9 +25,11 @@ close_clients_async, ) from .sdkconfiguration import SDKConfiguration -from .types import OptionalNullable, UNSET from .utils.logger import Logger, get_default_logger from .utils.retries import RetryConfig +from . import models, types, utils +from ._hooks import AsyncSDKHooks, SDKHooks, init_async_hooks +from .types import OptionalNullable, UNSET import httpx import importlib import importlib.util @@ -56,17 +56,17 @@ def with_raw_response(self): def with_streaming_response(self): return GenAIWithStreamingResponse(self) - interactions: "Interactions" - webhooks: "Webhooks" agents: "Agents" - triggers: "Triggers" environments: "Environments" + interactions: "Interactions" + triggers: "Triggers" + webhooks: "Webhooks" _sub_sdk_map = { - "interactions": (".interactions", "Interactions"), - "webhooks": (".webhooks", "Webhooks"), "agents": (".agents", "Agents"), - "triggers": (".triggers", "Triggers"), "environments": (".environments", "Environments"), + "interactions": (".interactions", "Interactions"), + "triggers": (".triggers", "Triggers"), + "webhooks": (".webhooks", "Webhooks"), } def __init__( @@ -211,24 +211,24 @@ def __init__(self, sdk: GenAI) -> None: self._sdk = sdk @property - def interactions(self): - return self._sdk.interactions.with_raw_response + def agents(self): + return self._sdk.agents.with_raw_response @property - def webhooks(self): - return self._sdk.webhooks.with_raw_response + def environments(self): + return self._sdk.environments.with_raw_response @property - def agents(self): - return self._sdk.agents.with_raw_response + def interactions(self): + return self._sdk.interactions.with_raw_response @property def triggers(self): return self._sdk.triggers.with_raw_response @property - def environments(self): - return self._sdk.environments.with_raw_response + def webhooks(self): + return self._sdk.webhooks.with_raw_response class GenAIWithStreamingResponse: @@ -236,24 +236,24 @@ def __init__(self, sdk: GenAI) -> None: self._sdk = sdk @property - def interactions(self): - return self._sdk.interactions.with_streaming_response + def agents(self): + return self._sdk.agents.with_streaming_response @property - def webhooks(self): - return self._sdk.webhooks.with_streaming_response + def environments(self): + return self._sdk.environments.with_streaming_response @property - def agents(self): - return self._sdk.agents.with_streaming_response + def interactions(self): + return self._sdk.interactions.with_streaming_response @property def triggers(self): return self._sdk.triggers.with_streaming_response @property - def environments(self): - return self._sdk.environments.with_streaming_response + def webhooks(self): + return self._sdk.webhooks.with_streaming_response class AsyncGenAI(AsyncBaseSDK): @@ -267,17 +267,17 @@ def with_raw_response(self): def with_streaming_response(self): return AsyncGenAIWithStreamingResponse(self) - interactions: "AsyncInteractions" - webhooks: "AsyncWebhooks" agents: "AsyncAgents" - triggers: "AsyncTriggers" environments: "AsyncEnvironments" + interactions: "AsyncInteractions" + triggers: "AsyncTriggers" + webhooks: "AsyncWebhooks" _sub_sdk_map = { - "interactions": (".interactions", "AsyncInteractions"), - "webhooks": (".webhooks", "AsyncWebhooks"), "agents": (".agents", "AsyncAgents"), - "triggers": (".triggers", "AsyncTriggers"), "environments": (".environments", "AsyncEnvironments"), + "interactions": (".interactions", "AsyncInteractions"), + "triggers": (".triggers", "AsyncTriggers"), + "webhooks": (".webhooks", "AsyncWebhooks"), } def __init__( @@ -420,24 +420,24 @@ def __init__(self, sdk: AsyncGenAI) -> None: self._sdk = sdk @property - def interactions(self): - return self._sdk.interactions.with_raw_response + def agents(self): + return self._sdk.agents.with_raw_response @property - def webhooks(self): - return self._sdk.webhooks.with_raw_response + def environments(self): + return self._sdk.environments.with_raw_response @property - def agents(self): - return self._sdk.agents.with_raw_response + def interactions(self): + return self._sdk.interactions.with_raw_response @property def triggers(self): return self._sdk.triggers.with_raw_response @property - def environments(self): - return self._sdk.environments.with_raw_response + def webhooks(self): + return self._sdk.webhooks.with_raw_response class AsyncGenAIWithStreamingResponse: @@ -445,21 +445,21 @@ def __init__(self, sdk: AsyncGenAI) -> None: self._sdk = sdk @property - def interactions(self): - return self._sdk.interactions.with_streaming_response + def agents(self): + return self._sdk.agents.with_streaming_response @property - def webhooks(self): - return self._sdk.webhooks.with_streaming_response + def environments(self): + return self._sdk.environments.with_streaming_response @property - def agents(self): - return self._sdk.agents.with_streaming_response + def interactions(self): + return self._sdk.interactions.with_streaming_response @property def triggers(self): return self._sdk.triggers.with_streaming_response @property - def environments(self): - return self._sdk.environments.with_streaming_response + def webhooks(self): + return self._sdk.webhooks.with_streaming_response diff --git a/google/genai/_gaos/sdkconfiguration.py b/google/genai/_gaos/sdkconfiguration.py index fb3d0c91a..9a1a2dc8b 100644 --- a/google/genai/_gaos/sdkconfiguration.py +++ b/google/genai/_gaos/sdkconfiguration.py @@ -16,7 +16,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from . import models, types from ._version import ( __gen_version__, __openapi_doc_version__, @@ -24,9 +23,10 @@ __version__, ) from .httpclient import AsyncHttpClient, HttpClient -from .types import OptionalNullable, UNSET from .utils import Logger, RetryConfig, remove_suffix from dataclasses import dataclass +from . import models, types +from .types import OptionalNullable, UNSET from pydantic import Field from typing import Callable, Dict, Optional, Tuple, Union diff --git a/google/genai/_gaos/triggers.py b/google/genai/_gaos/triggers.py index 4ec871e3f..ad9450ae3 100644 --- a/google/genai/_gaos/triggers.py +++ b/google/genai/_gaos/triggers.py @@ -16,9 +16,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .basesdk import AsyncBaseSDK, BaseSDK from . import errors, models, types, utils from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK from .types import OptionalNullable, UNSET, interactions, triggers from .types.triggers import ( triggercreateparams as triggers_triggercreateparams, @@ -39,38 +39,25 @@ def with_raw_response(self): def with_streaming_response(self): return TriggersWithStreamingResponse(self) - def create( + def list( self, *, - schedule: str, - time_zone: str, - interaction: Union[ - triggers_triggercreateparams.Interaction, - triggers_triggercreateparams.InteractionParam, - ], api_version: Optional[str] = None, - display_name: Optional[str] = None, - environment_id: Optional[str] = None, - max_consecutive_failures: Optional[int] = None, - execution_timeout_seconds: Optional[int] = None, + filter_: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. + ) -> triggers.ListTriggersResponse: + r"""Lists triggers for a project. - :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. - :param interaction: Required. The interaction request template to be executed. :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param environment_id: Optional. The environment ID for the trigger execution. - :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR). - :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. + :param filter_: Optional. Filter expression (e.g., by state). + :param page_size: Optional. The maximum number of triggers to return per page. + :param page_token: Optional. A page token from a previous ListTriggers call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -87,47 +74,33 @@ def create( else: base_url = self._get_url(base_url, url_variables) - request = models.CreateTriggerRequest( + request = models.ListTriggersRequest( api_version=api_version, - body=triggers.TriggerCreateParams( - schedule=schedule, - time_zone=time_zone, - display_name=display_name, - environment_id=environment_id, - max_consecutive_failures=max_consecutive_failures, - execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model(interaction, triggers.Interaction), - ), + filter_=filter_, + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="POST", + method="GET", path="/{api_version}/triggers", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateTriggerGlobals( + _globals=models.ListTriggersGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerCreateParams, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -150,7 +123,7 @@ def create( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.Trigger, http_res, validate=False + triggers.ListTriggersResponse, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -168,7 +141,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateTrigger", + operation_id="ListTriggers", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -222,25 +195,38 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def list( + def create( self, *, + interaction: Union[ + triggers_triggercreateparams.Interaction, + triggers_triggercreateparams.InteractionParam, + ], + schedule: str, + time_zone: str, api_version: Optional[str] = None, - filter_: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + display_name: Optional[str] = None, + environment_id: Optional[str] = None, + execution_timeout_seconds: Optional[int] = None, + max_consecutive_failures: Optional[int] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggersResponse: - r"""Lists triggers for a project. + ) -> triggers.Trigger: + r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. + :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. :param api_version: Which version of the API to use. - :param filter_: Optional. Filter expression (e.g., by state). - :param page_size: Optional. The maximum number of triggers to return per page. - :param page_token: Optional. A page token from a previous ListTriggers call. + :param display_name: Optional. The display name of the trigger. + :param environment_id: Optional. The environment ID for the trigger execution. + :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. + :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR). :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -257,33 +243,47 @@ def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListTriggersRequest( + request = models.CreateTriggerRequest( api_version=api_version, - filter_=filter_, - page_size=page_size, - page_token=page_token, + body=triggers.TriggerCreateParams( + display_name=display_name, + environment_id=environment_id, + execution_timeout_seconds=execution_timeout_seconds, + interaction=utils.get_pydantic_model(interaction, triggers.Interaction), + max_consecutive_failures=max_consecutive_failures, + schedule=schedule, + time_zone=time_zone, + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", + method="POST", path="/{api_version}/triggers", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListTriggersGlobals( + _globals=models.CreateTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + triggers.TriggerCreateParams, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -306,7 +306,7 @@ def list( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.ListTriggersResponse, http_res, validate=False + triggers.Trigger, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -324,7 +324,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListTriggers", + operation_id="CreateTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -378,7 +378,7 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def get( + def delete( self, id: str, *, @@ -386,8 +386,8 @@ def get( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Gets details of a single trigger. + ) -> interactions.Empty: + r"""Deletes a trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. @@ -409,7 +409,7 @@ def get( else: base_url = self._get_url(base_url, url_variables) - request = models.GetTriggerRequest( + request = models.DeleteTriggerRequest( api_version=api_version, id=id, ) @@ -418,7 +418,7 @@ def get( http_headers ) req = self._build_request( - method="GET", + method="DELETE", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, @@ -430,7 +430,7 @@ def get( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetTriggerGlobals( + _globals=models.DeleteTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -456,7 +456,7 @@ def get( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.Trigger, http_res, validate=False + interactions.Empty, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -474,7 +474,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetTrigger", + operation_id="DeleteTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -528,27 +528,21 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def update( + def get( self, id: str, *, api_version: Optional[str] = None, - display_name: Optional[str] = None, - status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, ) -> triggers.Trigger: - r"""Updates a trigger. + r"""Gets details of a single trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param status: Optional. The status of the trigger. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -565,43 +559,31 @@ def update( else: base_url = self._get_url(base_url, url_variables) - request = models.UpdateTriggerRequest( + request = models.GetTriggerRequest( api_version=api_version, id=id, - body=triggers.TriggerUpdate( - display_name=display_name, - status=status, - ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="PATCH", + method="GET", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.UpdateTriggerGlobals( + _globals=models.GetTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerUpdate, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -642,7 +624,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="UpdateTrigger", + operation_id="GetTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -696,21 +678,27 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def delete( + def update( self, id: str, *, api_version: Optional[str] = None, + display_name: Optional[str] = None, + status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a trigger. + ) -> triggers.Trigger: + r"""Updates a trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. + :param display_name: Optional. The display name of the trigger. + :param status: Optional. The status of the trigger. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -727,31 +715,43 @@ def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteTriggerRequest( + request = models.UpdateTriggerRequest( api_version=api_version, id=id, + body=triggers.TriggerUpdate( + display_name=display_name, + status=status, + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="DELETE", + method="PATCH", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteTriggerGlobals( + _globals=models.UpdateTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + triggers.TriggerUpdate, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -774,7 +774,7 @@ def delete( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + triggers.Trigger, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -792,7 +792,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteTrigger", + operation_id="UpdateTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -846,19 +846,23 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def run( + def list_executions( self, trigger_id: str, *, api_version: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.TriggerExecution: - r"""Runs a trigger immediately. + ) -> triggers.ListTriggerExecutionsResponse: + r"""Lists executions for a trigger. :param trigger_id: Resource name of the trigger. :param api_version: Which version of the API to use. + :param page_size: Optional. The maximum number of executions to return per page. + :param page_token: Optional. A page token from a previous ListTriggerExecutions call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -877,16 +881,18 @@ def run( else: base_url = self._get_url(base_url, url_variables) - request = models.RunTriggerRequest( + request = models.ListTriggerExecutionsRequest( api_version=api_version, trigger_id=trigger_id, + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="POST", + method="GET", path="/{api_version}/triggers/{trigger_id}/executions", base_url=base_url, url_variables=url_variables, @@ -898,7 +904,7 @@ def run( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.RunTriggerGlobals( + _globals=models.ListTriggerExecutionsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -924,7 +930,7 @@ def run( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.TriggerExecution, http_res, validate=False + triggers.ListTriggerExecutionsResponse, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -942,7 +948,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="RunTrigger", + operation_id="ListTriggerExecutions", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -996,23 +1002,19 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def list_executions( + def run( self, trigger_id: str, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggerExecutionsResponse: - r"""Lists executions for a trigger. + ) -> triggers.TriggerExecution: + r"""Runs a trigger immediately. :param trigger_id: Resource name of the trigger. :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of executions to return per page. - :param page_token: Optional. A page token from a previous ListTriggerExecutions call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -1031,18 +1033,16 @@ def list_executions( else: base_url = self._get_url(base_url, url_variables) - request = models.ListTriggerExecutionsRequest( + request = models.RunTriggerRequest( api_version=api_version, trigger_id=trigger_id, - page_size=page_size, - page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", + method="POST", path="/{api_version}/triggers/{trigger_id}/executions", base_url=base_url, url_variables=url_variables, @@ -1054,7 +1054,7 @@ def list_executions( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListTriggerExecutionsGlobals( + _globals=models.RunTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1080,7 +1080,7 @@ def list_executions( def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.ListTriggerExecutionsResponse, http_res, validate=False + triggers.TriggerExecution, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) @@ -1098,7 +1098,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListTriggerExecutions", + operation_id="RunTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1156,31 +1156,34 @@ def _speakeasy_parse_response(http_res): class TriggersWithRawResponse: def __init__(self, sdk: Triggers) -> None: self._sdk = sdk + self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") self.create = response_helpers.to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") + self.delete = response_helpers.to_raw_response_wrapper( + sdk.delete, "extra_headers" + ) self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") self.update = response_helpers.to_raw_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.run = response_helpers.to_raw_response_wrapper(sdk.run, "extra_headers") self.list_executions = response_helpers.to_raw_response_wrapper( sdk.list_executions, "extra_headers" ) + self.run = response_helpers.to_raw_response_wrapper(sdk.run, "extra_headers") class TriggersWithStreamingResponse: def __init__(self, sdk: Triggers) -> None: self._sdk = sdk + self.list = response_helpers.to_streamed_response_wrapper( + sdk.list, "extra_headers" + ) self.create = response_helpers.to_streamed_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.to_streamed_response_wrapper( - sdk.list, "extra_headers" + self.delete = response_helpers.to_streamed_response_wrapper( + sdk.delete, "extra_headers" ) self.get = response_helpers.to_streamed_response_wrapper( sdk.get, "extra_headers" @@ -1188,15 +1191,12 @@ def __init__(self, sdk: Triggers) -> None: self.update = response_helpers.to_streamed_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.to_streamed_response_wrapper( - sdk.delete, "extra_headers" + self.list_executions = response_helpers.to_streamed_response_wrapper( + sdk.list_executions, "extra_headers" ) self.run = response_helpers.to_streamed_response_wrapper( sdk.run, "extra_headers" ) - self.list_executions = response_helpers.to_streamed_response_wrapper( - sdk.list_executions, "extra_headers" - ) class AsyncTriggers(AsyncBaseSDK): @@ -1208,38 +1208,25 @@ def with_raw_response(self): def with_streaming_response(self): return AsyncTriggersWithStreamingResponse(self) - async def create( + async def list( self, *, - schedule: str, - time_zone: str, - interaction: Union[ - triggers_triggercreateparams.Interaction, - triggers_triggercreateparams.InteractionParam, - ], api_version: Optional[str] = None, - display_name: Optional[str] = None, - environment_id: Optional[str] = None, - max_consecutive_failures: Optional[int] = None, - execution_timeout_seconds: Optional[int] = None, + filter_: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. + ) -> triggers.ListTriggersResponse: + r"""Lists triggers for a project. - :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. - :param interaction: Required. The interaction request template to be executed. - :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param environment_id: Optional. The environment ID for the trigger execution. - :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR). - :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. + :param api_version: Which version of the API to use. + :param filter_: Optional. Filter expression (e.g., by state). + :param page_size: Optional. The maximum number of triggers to return per page. + :param page_token: Optional. A page token from a previous ListTriggers call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1256,47 +1243,33 @@ async def create( else: base_url = self._get_url(base_url, url_variables) - request = models.CreateTriggerRequest( + request = models.ListTriggersRequest( api_version=api_version, - body=triggers.TriggerCreateParams( - schedule=schedule, - time_zone=time_zone, - display_name=display_name, - environment_id=environment_id, - max_consecutive_failures=max_consecutive_failures, - execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model(interaction, triggers.Interaction), - ), + filter_=filter_, + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="POST", + method="GET", path="/{api_version}/triggers", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.CreateTriggerGlobals( + _globals=models.ListTriggersGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerCreateParams, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1319,7 +1292,7 @@ async def create( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.Trigger, http_res, validate=False + triggers.ListTriggersResponse, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -1337,7 +1310,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="CreateTrigger", + operation_id="ListTriggers", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1394,25 +1367,38 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def list( + async def create( self, *, + interaction: Union[ + triggers_triggercreateparams.Interaction, + triggers_triggercreateparams.InteractionParam, + ], + schedule: str, + time_zone: str, api_version: Optional[str] = None, - filter_: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, + display_name: Optional[str] = None, + environment_id: Optional[str] = None, + execution_timeout_seconds: Optional[int] = None, + max_consecutive_failures: Optional[int] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggersResponse: - r"""Lists triggers for a project. + ) -> triggers.Trigger: + r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. + :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. :param api_version: Which version of the API to use. - :param filter_: Optional. Filter expression (e.g., by state). - :param page_size: Optional. The maximum number of triggers to return per page. - :param page_token: Optional. A page token from a previous ListTriggers call. + :param display_name: Optional. The display name of the trigger. + :param environment_id: Optional. The environment ID for the trigger execution. + :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. + :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR). :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1429,33 +1415,47 @@ async def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListTriggersRequest( + request = models.CreateTriggerRequest( api_version=api_version, - filter_=filter_, - page_size=page_size, - page_token=page_token, + body=triggers.TriggerCreateParams( + display_name=display_name, + environment_id=environment_id, + execution_timeout_seconds=execution_timeout_seconds, + interaction=utils.get_pydantic_model(interaction, triggers.Interaction), + max_consecutive_failures=max_consecutive_failures, + schedule=schedule, + time_zone=time_zone, + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="GET", + method="POST", path="/{api_version}/triggers", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListTriggersGlobals( + _globals=models.CreateTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + triggers.TriggerCreateParams, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1478,7 +1478,7 @@ async def list( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.ListTriggersResponse, http_res, validate=False + triggers.Trigger, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -1496,7 +1496,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListTriggers", + operation_id="CreateTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1553,7 +1553,7 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def get( + async def delete( self, id: str, *, @@ -1561,8 +1561,8 @@ async def get( extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Gets details of a single trigger. + ) -> interactions.Empty: + r"""Deletes a trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. @@ -1584,7 +1584,7 @@ async def get( else: base_url = self._get_url(base_url, url_variables) - request = models.GetTriggerRequest( + request = models.DeleteTriggerRequest( api_version=api_version, id=id, ) @@ -1593,7 +1593,7 @@ async def get( http_headers ) req = self._build_request_async( - method="GET", + method="DELETE", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, @@ -1605,7 +1605,7 @@ async def get( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.GetTriggerGlobals( + _globals=models.DeleteTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1631,7 +1631,7 @@ async def get( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.Trigger, http_res, validate=False + interactions.Empty, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -1649,7 +1649,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="GetTrigger", + operation_id="DeleteTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1706,27 +1706,21 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def update( + async def get( self, id: str, *, api_version: Optional[str] = None, - display_name: Optional[str] = None, - status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, ) -> triggers.Trigger: - r"""Updates a trigger. + r"""Gets details of a single trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param status: Optional. The status of the trigger. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1743,43 +1737,31 @@ async def update( else: base_url = self._get_url(base_url, url_variables) - request = models.UpdateTriggerRequest( + request = models.GetTriggerRequest( api_version=api_version, id=id, - body=triggers.TriggerUpdate( - display_name=display_name, - status=status, - ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="PATCH", + method="GET", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=True, + request_body_required=False, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.UpdateTriggerGlobals( + _globals=models.GetTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerUpdate, - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1820,7 +1802,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="UpdateTrigger", + operation_id="GetTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1877,21 +1859,27 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def delete( + async def update( self, id: str, *, api_version: Optional[str] = None, + display_name: Optional[str] = None, + status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a trigger. + ) -> triggers.Trigger: + r"""Updates a trigger. :param id: Resource name of the trigger. :param api_version: Which version of the API to use. + :param display_name: Optional. The display name of the trigger. + :param status: Optional. The status of the trigger. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1908,31 +1896,43 @@ async def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteTriggerRequest( + request = models.UpdateTriggerRequest( api_version=api_version, id=id, + body=triggers.TriggerUpdate( + display_name=display_name, + status=status, + ), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="DELETE", + method="PATCH", path="/{api_version}/triggers/{id}", base_url=base_url, url_variables=url_variables, request=request, - request_body_required=False, + request_body_required=True, request_has_path_params=True, request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteTriggerGlobals( + _globals=models.UpdateTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body, + False, + False, + "json", + triggers.TriggerUpdate, + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1955,7 +1955,7 @@ async def delete( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + triggers.Trigger, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -1973,7 +1973,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteTrigger", + operation_id="UpdateTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -2030,19 +2030,23 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def run( + async def list_executions( self, trigger_id: str, *, api_version: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.TriggerExecution: - r"""Runs a trigger immediately. + ) -> triggers.ListTriggerExecutionsResponse: + r"""Lists executions for a trigger. :param trigger_id: Resource name of the trigger. :param api_version: Which version of the API to use. + :param page_size: Optional. The maximum number of executions to return per page. + :param page_token: Optional. A page token from a previous ListTriggerExecutions call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2061,16 +2065,18 @@ async def run( else: base_url = self._get_url(base_url, url_variables) - request = models.RunTriggerRequest( + request = models.ListTriggerExecutionsRequest( api_version=api_version, trigger_id=trigger_id, + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="POST", + method="GET", path="/{api_version}/triggers/{trigger_id}/executions", base_url=base_url, url_variables=url_variables, @@ -2082,7 +2088,7 @@ async def run( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.RunTriggerGlobals( + _globals=models.ListTriggerExecutionsGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -2108,7 +2114,7 @@ async def run( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.TriggerExecution, http_res, validate=False + triggers.ListTriggerExecutionsResponse, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -2126,7 +2132,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="RunTrigger", + operation_id="ListTriggerExecutions", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -2183,23 +2189,19 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def list_executions( + async def run( self, trigger_id: str, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggerExecutionsResponse: - r"""Lists executions for a trigger. + ) -> triggers.TriggerExecution: + r"""Runs a trigger immediately. :param trigger_id: Resource name of the trigger. :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of executions to return per page. - :param page_token: Optional. A page token from a previous ListTriggerExecutions call. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -2218,18 +2220,16 @@ async def list_executions( else: base_url = self._get_url(base_url, url_variables) - request = models.ListTriggerExecutionsRequest( + request = models.RunTriggerRequest( api_version=api_version, trigger_id=trigger_id, - page_size=page_size, - page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="GET", + method="POST", path="/{api_version}/triggers/{trigger_id}/executions", base_url=base_url, url_variables=url_variables, @@ -2241,7 +2241,7 @@ async def list_executions( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListTriggerExecutionsGlobals( + _globals=models.RunTriggerGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -2267,7 +2267,7 @@ async def list_executions( async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "200", "application/json"): return unmarshal_json_response( - triggers.ListTriggerExecutionsResponse, http_res, validate=False + triggers.TriggerExecution, http_res, validate=False ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) @@ -2285,7 +2285,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListTriggerExecutions", + operation_id="RunTrigger", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -2346,11 +2346,14 @@ async def _speakeasy_parse_response(http_res): class AsyncTriggersWithRawResponse: def __init__(self, sdk: AsyncTriggers) -> None: self._sdk = sdk + self.list = response_helpers.async_to_raw_response_wrapper( + sdk.list, "extra_headers" + ) self.create = response_helpers.async_to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.async_to_raw_response_wrapper( - sdk.list, "extra_headers" + self.delete = response_helpers.async_to_raw_response_wrapper( + sdk.delete, "extra_headers" ) self.get = response_helpers.async_to_raw_response_wrapper( sdk.get, "extra_headers" @@ -2358,25 +2361,25 @@ def __init__(self, sdk: AsyncTriggers) -> None: self.update = response_helpers.async_to_raw_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.async_to_raw_response_wrapper( - sdk.delete, "extra_headers" + self.list_executions = response_helpers.async_to_raw_response_wrapper( + sdk.list_executions, "extra_headers" ) self.run = response_helpers.async_to_raw_response_wrapper( sdk.run, "extra_headers" ) - self.list_executions = response_helpers.async_to_raw_response_wrapper( - sdk.list_executions, "extra_headers" - ) class AsyncTriggersWithStreamingResponse: def __init__(self, sdk: AsyncTriggers) -> None: self._sdk = sdk + self.list = response_helpers.async_to_streamed_response_wrapper( + sdk.list, "extra_headers" + ) self.create = response_helpers.async_to_streamed_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.async_to_streamed_response_wrapper( - sdk.list, "extra_headers" + self.delete = response_helpers.async_to_streamed_response_wrapper( + sdk.delete, "extra_headers" ) self.get = response_helpers.async_to_streamed_response_wrapper( sdk.get, "extra_headers" @@ -2384,12 +2387,9 @@ def __init__(self, sdk: AsyncTriggers) -> None: self.update = response_helpers.async_to_streamed_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.async_to_streamed_response_wrapper( - sdk.delete, "extra_headers" + self.list_executions = response_helpers.async_to_streamed_response_wrapper( + sdk.list_executions, "extra_headers" ) self.run = response_helpers.async_to_streamed_response_wrapper( sdk.run, "extra_headers" ) - self.list_executions = response_helpers.async_to_streamed_response_wrapper( - sdk.list_executions, "extra_headers" - ) diff --git a/google/genai/_gaos/types/agents/agent.py b/google/genai/_gaos/types/agents/agent.py index cf556f6ca..68b694d6b 100644 --- a/google/genai/_gaos/types/agents/agent.py +++ b/google/genai/_gaos/types/agents/agent.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .agenttool import AgentTool, AgentToolParam from .. import BaseModel, UNSET_SENTINEL from ..interactions import ( antigravityagentconfig as interactions_antigravityagentconfig, environment as interactions_environment, ) -from .agenttool import AgentTool, AgentToolParam from pydantic import model_serializer from typing import List, Optional, Union from typing_extensions import NotRequired, TypeAliasType, TypedDict diff --git a/google/genai/_gaos/types/agents/agentlistresponse.py b/google/genai/_gaos/types/agents/agentlistresponse.py index 6f83ea600..85fc8afe2 100644 --- a/google/genai/_gaos/types/agents/agentlistresponse.py +++ b/google/genai/_gaos/types/agents/agentlistresponse.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .agent import Agent, AgentParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/agents/agenttool.py b/google/genai/_gaos/types/agents/agenttool.py index 2583bd0cf..ca99662ad 100644 --- a/google/genai/_gaos/types/agents/agenttool.py +++ b/google/genai/_gaos/types/agents/agenttool.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from functools import partial from .. import BaseModel -from ...utils.unions import parse_open_union from ..interactions import ( codeexecution as interactions_codeexecution, function as interactions_function, @@ -26,7 +26,7 @@ mcpserver as interactions_mcpserver, urlcontext as interactions_urlcontext, ) -from functools import partial +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/environments/environment.py b/google/genai/_gaos/types/environments/environment.py index 792be87cf..6969ea525 100644 --- a/google/genai/_gaos/types/environments/environment.py +++ b/google/genai/_gaos/types/environments/environment.py @@ -18,11 +18,11 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ...utils import serialize_int, validate_int from ..interactions import ( environmentnetworkegressallowlist as interactions_environmentnetworkegressallowlist, source as interactions_source, ) +from ...utils import serialize_int, validate_int from pydantic import model_serializer from pydantic.functional_serializers import PlainSerializer from pydantic.functional_validators import BeforeValidator diff --git a/google/genai/_gaos/types/environments/listenvironmentsresponse.py b/google/genai/_gaos/types/environments/listenvironmentsresponse.py index fa2c1f719..add476c6b 100644 --- a/google/genai/_gaos/types/environments/listenvironmentsresponse.py +++ b/google/genai/_gaos/types/environments/listenvironmentsresponse.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .environment import Environment, EnvironmentTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/allowedtools.py b/google/genai/_gaos/types/interactions/allowedtools.py index 475367ca9..b20613b04 100644 --- a/google/genai/_gaos/types/interactions/allowedtools.py +++ b/google/genai/_gaos/types/interactions/allowedtools.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .toolchoicetype import ToolChoiceType +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/allowlistentry.py b/google/genai/_gaos/types/interactions/allowlistentry.py index 3968fa31c..e9ad7d8c5 100644 --- a/google/genai/_gaos/types/interactions/allowlistentry.py +++ b/google/genai/_gaos/types/interactions/allowlistentry.py @@ -24,12 +24,12 @@ TransformParam = TypeAliasType( - "TransformParam", Union[Dict[str, str], List[Dict[str, str]]] + "TransformParam", Union[List[Dict[str, str]], Dict[str, str]] ) r"""Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.""" -Transform = TypeAliasType("Transform", Union[Dict[str, str], List[Dict[str, str]]]) +Transform = TypeAliasType("Transform", Union[List[Dict[str, str]], Dict[str, str]]) r"""Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.""" diff --git a/google/genai/_gaos/types/interactions/annotation.py b/google/genai/_gaos/types/interactions/annotation.py index 2fdf76da0..eeb5885b4 100644 --- a/google/genai/_gaos/types/interactions/annotation.py +++ b/google/genai/_gaos/types/interactions/annotation.py @@ -17,13 +17,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .filecitation import FileCitation, FileCitationParam from .placecitation import PlaceCitation, PlaceCitationParam from .urlcitation import URLCitation, URLCitationParam from .wordinfo import WordInfo, WordInfoParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/interactions/audiocontent.py b/google/genai/_gaos/types/interactions/audiocontent.py index 262073c13..7372325d5 100644 --- a/google/genai/_gaos/types/interactions/audiocontent.py +++ b/google/genai/_gaos/types/interactions/audiocontent.py @@ -59,13 +59,13 @@ class AudioContentParam(TypedDict): r"""The number of audio channels.""" data: NotRequired[Union[str, Base64FileInput]] r"""The audio content.""" + mime_type: NotRequired[AudioContentMimeType] + r"""The mime type of the audio.""" sample_rate: NotRequired[int] r"""The sample rate of the audio.""" type: Literal["audio"] uri: NotRequired[str] r"""The URI of the audio.""" - mime_type: NotRequired[AudioContentMimeType] - r"""The mime type of the audio.""" class AudioContent(BaseModel): @@ -77,6 +77,9 @@ class AudioContent(BaseModel): data: Optional[Base64EncodedString] = None r"""The audio content.""" + mime_type: Optional[AudioContentMimeType] = None + r"""The mime type of the audio.""" + sample_rate: Optional[int] = None r"""The sample rate of the audio.""" @@ -88,12 +91,9 @@ class AudioContent(BaseModel): uri: Optional[str] = None r"""The URI of the audio.""" - mime_type: Optional[AudioContentMimeType] = None - r"""The mime type of the audio.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["channels", "data", "sample_rate", "uri", "mime_type"]) + optional_fields = set(["channels", "data", "mime_type", "sample_rate", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py b/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py index 3eb9027db..26c4ba917 100644 --- a/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py +++ b/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .codeexecutioncallarguments import ( CodeExecutionCallArguments, CodeExecutionCallArgumentsParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/codeexecutioncallstep.py b/google/genai/_gaos/types/interactions/codeexecutioncallstep.py index 87a6bf647..5deb30279 100644 --- a/google/genai/_gaos/types/interactions/codeexecutioncallstep.py +++ b/google/genai/_gaos/types/interactions/codeexecutioncallstep.py @@ -17,12 +17,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .codeexecutioncallarguments import ( CodeExecutionCallArguments, CodeExecutionCallArgumentsParam, ) +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/codeexecutionresultstep.py b/google/genai/_gaos/types/interactions/codeexecutionresultstep.py index 7061225f7..4ebceccb0 100644 --- a/google/genai/_gaos/types/interactions/codeexecutionresultstep.py +++ b/google/genai/_gaos/types/interactions/codeexecutionresultstep.py @@ -17,7 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) from ...utils import validate_const import pydantic from pydantic import model_serializer diff --git a/google/genai/_gaos/types/interactions/codemenderagentconfig.py b/google/genai/_gaos/types/interactions/codemenderagentconfig.py index eb15b9a40..bf802440e 100644 --- a/google/genai/_gaos/types/interactions/codemenderagentconfig.py +++ b/google/genai/_gaos/types/interactions/codemenderagentconfig.py @@ -17,11 +17,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .findrequest import FindRequest, FindRequestParam from .fixrequest import FixRequest, FixRequestParam from .sessionconfig import SessionConfig, SessionConfigParam +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/content.py b/google/genai/_gaos/types/interactions/content.py index 8fd96d054..c71517faa 100644 --- a/google/genai/_gaos/types/interactions/content.py +++ b/google/genai/_gaos/types/interactions/content.py @@ -17,14 +17,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .audiocontent import AudioContent, AudioContentParam from .documentcontent import DocumentContent, DocumentContentParam from .imagecontent import ImageContent, ImageContentParam from .textcontent import TextContent, TextContentParam from .videocontent import VideoContent, VideoContentParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union @@ -55,20 +55,20 @@ class UnknownContent(BaseModel): _CONTENT_VARIANTS: dict[str, Any] = { - "text": TextContent, - "image": ImageContent, "audio": AudioContent, "document": DocumentContent, + "image": ImageContent, + "text": TextContent, "video": VideoContent, } Content = Annotated[ Union[ - TextContent, - ImageContent, AudioContent, DocumentContent, + ImageContent, + TextContent, VideoContent, UnknownContent, ], diff --git a/google/genai/_gaos/types/interactions/createagentinteraction.py b/google/genai/_gaos/types/interactions/createagentinteraction.py index f91c4cc43..12bc6c23a 100644 --- a/google/genai/_gaos/types/interactions/createagentinteraction.py +++ b/google/genai/_gaos/types/interactions/createagentinteraction.py @@ -17,7 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .agentoption import AgentOption from .antigravityagentconfig import AntigravityAgentConfig, AntigravityAgentConfigParam from .codemenderagentconfig import CodeMenderAgentConfig, CodeMenderAgentConfigParam @@ -34,23 +33,35 @@ from .servicetier import ServiceTier from .tool import Tool, ToolParam from .webhookconfig import WebhookConfig, WebhookConfigParam +from .. import BaseModel, UNSET_SENTINEL import pydantic from pydantic import Field, model_serializer from typing import Dict, List, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -CreateAgentInteractionResponseFormatParam = TypeAliasType( - "CreateAgentInteractionResponseFormatParam", - Union[List[ResponseFormatParam], ResponseFormatParam], +CreateAgentInteractionAgentConfigParam = TypeAliasType( + "CreateAgentInteractionAgentConfigParam", + Union[ + DynamicAgentConfigParam, + AntigravityAgentConfigParam, + DeepResearchAgentConfigParam, + CodeMenderAgentConfigParam, + ], ) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" +r"""Configuration parameters for the agent interaction.""" -CreateAgentInteractionResponseFormat = TypeAliasType( - "CreateAgentInteractionResponseFormat", Union[List[ResponseFormat], ResponseFormat] -) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" +CreateAgentInteractionAgentConfig = Annotated[ + Union[ + AntigravityAgentConfig, + CodeMenderAgentConfig, + DeepResearchAgentConfig, + DynamicAgentConfig, + ], + Field(discriminator="type"), +] +r"""Configuration parameters for the agent interaction.""" CreateAgentInteractionEnvironmentParam = TypeAliasType( @@ -65,28 +76,17 @@ r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" -CreateAgentInteractionAgentConfigParam = TypeAliasType( - "CreateAgentInteractionAgentConfigParam", - Union[ - DynamicAgentConfigParam, - AntigravityAgentConfigParam, - DeepResearchAgentConfigParam, - CodeMenderAgentConfigParam, - ], +CreateAgentInteractionResponseFormatParam = TypeAliasType( + "CreateAgentInteractionResponseFormatParam", + Union[ResponseFormatParam, List[ResponseFormatParam]], ) -r"""Configuration parameters for the agent interaction.""" +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" -CreateAgentInteractionAgentConfig = Annotated[ - Union[ - DynamicAgentConfig, - DeepResearchAgentConfig, - CodeMenderAgentConfig, - AntigravityAgentConfig, - ], - Field(discriminator="type"), -] -r"""Configuration parameters for the agent interaction.""" +CreateAgentInteractionResponseFormat = TypeAliasType( + "CreateAgentInteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]] +) +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" class CreateAgentInteractionParam(TypedDict): @@ -96,35 +96,35 @@ class CreateAgentInteractionParam(TypedDict): r"""The agent to interact with.""" input: InteractionsInputParam r"""The input for the interaction.""" - stream: NotRequired[bool] - r"""Input only. Whether the interaction will be streamed.""" - store: NotRequired[bool] - r"""Input only. Whether to store the response and request for later retrieval.""" + agent_config: NotRequired[CreateAgentInteractionAgentConfigParam] + r"""Configuration parameters for the agent interaction.""" background: NotRequired[bool] r"""Input only. Whether to run the model interaction in the background.""" - system_instruction: NotRequired[str] - r"""System instruction for the interaction.""" - tools: NotRequired[List[ToolParam]] - r"""A list of tool declarations the model may call during interaction.""" - response_modalities: NotRequired[List[ResponseModality]] - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - response_mime_type: NotRequired[str] - r"""The mime type of the response. This is required if response_format is set.""" + environment: NotRequired[CreateAgentInteractionEnvironmentParam] + r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + labels: NotRequired[Dict[str, str]] + r"""The labels with user-defined metadata for the request.""" previous_interaction_id: NotRequired[str] r"""The ID of the previous interaction, if any.""" - service_tier: NotRequired[ServiceTier] - webhook_config: NotRequired[WebhookConfigParam] - r"""Message for configuring webhook events for a request.""" response_format: NotRequired[CreateAgentInteractionResponseFormatParam] r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - environment: NotRequired[CreateAgentInteractionEnvironmentParam] - r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - agent_config: NotRequired[CreateAgentInteractionAgentConfigParam] - r"""Configuration parameters for the agent interaction.""" + response_mime_type: NotRequired[str] + r"""The mime type of the response. This is required if response_format is set.""" + response_modalities: NotRequired[List[ResponseModality]] + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" safety_settings: NotRequired[List[SafetySettingParam]] r"""Safety settings for the interaction.""" - labels: NotRequired[Dict[str, str]] - r"""The labels with user-defined metadata for the request.""" + service_tier: NotRequired[ServiceTier] + store: NotRequired[bool] + r"""Input only. Whether to store the response and request for later retrieval.""" + stream: NotRequired[bool] + r"""Input only. Whether the interaction will be streamed.""" + system_instruction: NotRequired[str] + r"""System instruction for the interaction.""" + tools: NotRequired[List[ToolParam]] + r"""A list of tool declarations the model may call during interaction.""" + webhook_config: NotRequired[WebhookConfigParam] + r"""Message for configuring webhook events for a request.""" class CreateAgentInteraction(BaseModel): @@ -136,79 +136,79 @@ class CreateAgentInteraction(BaseModel): input: InteractionsInput r"""The input for the interaction.""" - stream: Optional[bool] = None - r"""Input only. Whether the interaction will be streamed.""" - - store: Optional[bool] = None - r"""Input only. Whether to store the response and request for later retrieval.""" + agent_config: Optional[CreateAgentInteractionAgentConfig] = None + r"""Configuration parameters for the agent interaction.""" background: Optional[bool] = None r"""Input only. Whether to run the model interaction in the background.""" - system_instruction: Optional[str] = None - r"""System instruction for the interaction.""" + environment: Optional[CreateAgentInteractionEnvironment] = None + r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - tools: Optional[List[Tool]] = None - r"""A list of tool declarations the model may call during interaction.""" + labels: Optional[Dict[str, str]] = None + r"""The labels with user-defined metadata for the request.""" - response_modalities: Annotated[ - Optional[List[ResponseModality]], + previous_interaction_id: Optional[str] = None + r"""The ID of the previous interaction, if any.""" + + response_format: Optional[CreateAgentInteractionResponseFormat] = None + r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + response_mime_type: Annotated[ + Optional[str], pydantic.Field( deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = None - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + r"""The mime type of the response. This is required if response_format is set.""" - response_mime_type: Annotated[ - Optional[str], + response_modalities: Annotated[ + Optional[List[ResponseModality]], pydantic.Field( deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = None - r"""The mime type of the response. This is required if response_format is set.""" + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - previous_interaction_id: Optional[str] = None - r"""The ID of the previous interaction, if any.""" + safety_settings: Optional[List[SafetySetting]] = None + r"""Safety settings for the interaction.""" service_tier: Optional[ServiceTier] = None - webhook_config: Optional[WebhookConfig] = None - r"""Message for configuring webhook events for a request.""" - - response_format: Optional[CreateAgentInteractionResponseFormat] = None - r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + store: Optional[bool] = None + r"""Input only. Whether to store the response and request for later retrieval.""" - environment: Optional[CreateAgentInteractionEnvironment] = None - r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + stream: Optional[bool] = None + r"""Input only. Whether the interaction will be streamed.""" - agent_config: Optional[CreateAgentInteractionAgentConfig] = None - r"""Configuration parameters for the agent interaction.""" + system_instruction: Optional[str] = None + r"""System instruction for the interaction.""" - safety_settings: Optional[List[SafetySetting]] = None - r"""Safety settings for the interaction.""" + tools: Optional[List[Tool]] = None + r"""A list of tool declarations the model may call during interaction.""" - labels: Optional[Dict[str, str]] = None - r"""The labels with user-defined metadata for the request.""" + webhook_config: Optional[WebhookConfig] = None + r"""Message for configuring webhook events for a request.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "stream", - "store", + "agent_config", "background", - "system_instruction", - "tools", - "response_modalities", - "response_mime_type", + "environment", + "labels", "previous_interaction_id", - "service_tier", - "webhook_config", "response_format", - "environment", - "agent_config", + "response_mime_type", + "response_modalities", "safety_settings", - "labels", + "service_tier", + "store", + "stream", + "system_instruction", + "tools", + "webhook_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/createmodelinteraction.py b/google/genai/_gaos/types/interactions/createmodelinteraction.py index 7d1efd340..bfae64373 100644 --- a/google/genai/_gaos/types/interactions/createmodelinteraction.py +++ b/google/genai/_gaos/types/interactions/createmodelinteraction.py @@ -17,7 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .environment import Environment, EnvironmentParam from .generationconfig import GenerationConfig, GenerationConfigParam from .interactionsinput import InteractionsInput, InteractionsInputParam @@ -28,25 +27,13 @@ from .servicetier import ServiceTier from .tool import Tool, ToolParam from .webhookconfig import WebhookConfig, WebhookConfigParam +from .. import BaseModel, UNSET_SENTINEL import pydantic from pydantic import model_serializer from typing import Dict, List, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -CreateModelInteractionResponseFormatParam = TypeAliasType( - "CreateModelInteractionResponseFormatParam", - Union[List[ResponseFormatParam], ResponseFormatParam], -) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - - -CreateModelInteractionResponseFormat = TypeAliasType( - "CreateModelInteractionResponseFormat", Union[List[ResponseFormat], ResponseFormat] -) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - - CreateModelInteractionEnvironmentParam = TypeAliasType( "CreateModelInteractionEnvironmentParam", Union[EnvironmentParam, str] ) @@ -59,126 +46,139 @@ r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" +CreateModelInteractionResponseFormatParam = TypeAliasType( + "CreateModelInteractionResponseFormatParam", + Union[ResponseFormatParam, List[ResponseFormatParam]], +) +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + +CreateModelInteractionResponseFormat = TypeAliasType( + "CreateModelInteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]] +) +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + class CreateModelInteractionParam(TypedDict): r"""Parameters for creating model interactions""" - model: Model - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" input: InteractionsInputParam r"""The input for the interaction.""" - stream: NotRequired[bool] - r"""Input only. Whether the interaction will be streamed.""" - store: NotRequired[bool] - r"""Input only. Whether to store the response and request for later retrieval.""" + model: Model + r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" background: NotRequired[bool] r"""Input only. Whether to run the model interaction in the background.""" - system_instruction: NotRequired[str] - r"""System instruction for the interaction.""" - tools: NotRequired[List[ToolParam]] - r"""A list of tool declarations the model may call during interaction.""" - response_modalities: NotRequired[List[ResponseModality]] - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - response_mime_type: NotRequired[str] - r"""The mime type of the response. This is required if response_format is set.""" - previous_interaction_id: NotRequired[str] - r"""The ID of the previous interaction, if any.""" - service_tier: NotRequired[ServiceTier] - webhook_config: NotRequired[WebhookConfigParam] - r"""Message for configuring webhook events for a request.""" - response_format: NotRequired[CreateModelInteractionResponseFormatParam] - r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" environment: NotRequired[CreateModelInteractionEnvironmentParam] r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" generation_config: NotRequired[GenerationConfigParam] r"""Configuration parameters for model interactions.""" - safety_settings: NotRequired[List[SafetySettingParam]] - r"""Safety settings for the interaction.""" labels: NotRequired[Dict[str, str]] r"""The labels with user-defined metadata for the request.""" + previous_interaction_id: NotRequired[str] + r"""The ID of the previous interaction, if any.""" + response_format: NotRequired[CreateModelInteractionResponseFormatParam] + r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + response_mime_type: NotRequired[str] + r"""The mime type of the response. This is required if response_format is set.""" + response_modalities: NotRequired[List[ResponseModality]] + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + safety_settings: NotRequired[List[SafetySettingParam]] + r"""Safety settings for the interaction.""" + service_tier: NotRequired[ServiceTier] + store: NotRequired[bool] + r"""Input only. Whether to store the response and request for later retrieval.""" + stream: NotRequired[bool] + r"""Input only. Whether the interaction will be streamed.""" + system_instruction: NotRequired[str] + r"""System instruction for the interaction.""" + tools: NotRequired[List[ToolParam]] + r"""A list of tool declarations the model may call during interaction.""" + webhook_config: NotRequired[WebhookConfigParam] + r"""Message for configuring webhook events for a request.""" class CreateModelInteraction(BaseModel): r"""Parameters for creating model interactions""" - model: Model - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" - input: InteractionsInput r"""The input for the interaction.""" - stream: Optional[bool] = None - r"""Input only. Whether the interaction will be streamed.""" - - store: Optional[bool] = None - r"""Input only. Whether to store the response and request for later retrieval.""" + model: Model + r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" background: Optional[bool] = None r"""Input only. Whether to run the model interaction in the background.""" - system_instruction: Optional[str] = None - r"""System instruction for the interaction.""" + environment: Optional[CreateModelInteractionEnvironment] = None + r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - tools: Optional[List[Tool]] = None - r"""A list of tool declarations the model may call during interaction.""" + generation_config: Optional[GenerationConfig] = None + r"""Configuration parameters for model interactions.""" - response_modalities: Annotated[ - Optional[List[ResponseModality]], + labels: Optional[Dict[str, str]] = None + r"""The labels with user-defined metadata for the request.""" + + previous_interaction_id: Optional[str] = None + r"""The ID of the previous interaction, if any.""" + + response_format: Optional[CreateModelInteractionResponseFormat] = None + r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + response_mime_type: Annotated[ + Optional[str], pydantic.Field( deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = None - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + r"""The mime type of the response. This is required if response_format is set.""" - response_mime_type: Annotated[ - Optional[str], + response_modalities: Annotated[ + Optional[List[ResponseModality]], pydantic.Field( deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ), ] = None - r"""The mime type of the response. This is required if response_format is set.""" + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - previous_interaction_id: Optional[str] = None - r"""The ID of the previous interaction, if any.""" + safety_settings: Optional[List[SafetySetting]] = None + r"""Safety settings for the interaction.""" service_tier: Optional[ServiceTier] = None - webhook_config: Optional[WebhookConfig] = None - r"""Message for configuring webhook events for a request.""" - - response_format: Optional[CreateModelInteractionResponseFormat] = None - r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + store: Optional[bool] = None + r"""Input only. Whether to store the response and request for later retrieval.""" - environment: Optional[CreateModelInteractionEnvironment] = None - r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + stream: Optional[bool] = None + r"""Input only. Whether the interaction will be streamed.""" - generation_config: Optional[GenerationConfig] = None - r"""Configuration parameters for model interactions.""" + system_instruction: Optional[str] = None + r"""System instruction for the interaction.""" - safety_settings: Optional[List[SafetySetting]] = None - r"""Safety settings for the interaction.""" + tools: Optional[List[Tool]] = None + r"""A list of tool declarations the model may call during interaction.""" - labels: Optional[Dict[str, str]] = None - r"""The labels with user-defined metadata for the request.""" + webhook_config: Optional[WebhookConfig] = None + r"""Message for configuring webhook events for a request.""" @model_serializer(mode="wrap") def _serialize_model(self, handler): optional_fields = set( [ - "stream", - "store", "background", - "system_instruction", - "tools", - "response_modalities", - "response_mime_type", - "previous_interaction_id", - "service_tier", - "webhook_config", - "response_format", "environment", "generation_config", - "safety_settings", "labels", + "previous_interaction_id", + "response_format", + "response_mime_type", + "response_modalities", + "safety_settings", + "service_tier", + "store", + "stream", + "system_instruction", + "tools", + "webhook_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/deepresearchagentconfig.py b/google/genai/_gaos/types/interactions/deepresearchagentconfig.py index 9adfb537b..96419b9fc 100644 --- a/google/genai/_gaos/types/interactions/deepresearchagentconfig.py +++ b/google/genai/_gaos/types/interactions/deepresearchagentconfig.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .thinkingsummaries import ThinkingSummaries from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from ...utils import validate_const -from .thinkingsummaries import ThinkingSummaries import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/documentcontent.py b/google/genai/_gaos/types/interactions/documentcontent.py index b6bba257b..91b4fbef2 100644 --- a/google/genai/_gaos/types/interactions/documentcontent.py +++ b/google/genai/_gaos/types/interactions/documentcontent.py @@ -47,11 +47,11 @@ class DocumentContentParam(TypedDict): data: NotRequired[Union[str, Base64FileInput]] r"""The document content.""" + mime_type: NotRequired[DocumentContentMimeType] + r"""The mime type of the document.""" type: Literal["document"] uri: NotRequired[str] r"""The URI of the document.""" - mime_type: NotRequired[DocumentContentMimeType] - r"""The mime type of the document.""" class DocumentContent(BaseModel): @@ -60,6 +60,9 @@ class DocumentContent(BaseModel): data: Optional[Base64EncodedString] = None r"""The document content.""" + mime_type: Optional[DocumentContentMimeType] = None + r"""The mime type of the document.""" + type: Annotated[ Annotated[Literal["document"], AfterValidator(validate_const("document"))], pydantic.Field(alias="type"), @@ -68,12 +71,9 @@ class DocumentContent(BaseModel): uri: Optional[str] = None r"""The URI of the document.""" - mime_type: Optional[DocumentContentMimeType] = None - r"""The mime type of the document.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type"]) + optional_fields = set(["data", "mime_type", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/environment.py b/google/genai/_gaos/types/interactions/environment.py index 22588be0d..dd47adcd0 100644 --- a/google/genai/_gaos/types/interactions/environment.py +++ b/google/genai/_gaos/types/interactions/environment.py @@ -17,13 +17,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .environmentnetworkegressallowlist import ( EnvironmentNetworkEgressAllowlist, EnvironmentNetworkEgressAllowlistParam, ) from .source import Source, SourceParam +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/environmentnetworkegressallowlist.py b/google/genai/_gaos/types/interactions/environmentnetworkegressallowlist.py index bbab00de7..c41157a05 100644 --- a/google/genai/_gaos/types/interactions/environmentnetworkegressallowlist.py +++ b/google/genai/_gaos/types/interactions/environmentnetworkegressallowlist.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .allowlistentry import AllowlistEntry, AllowlistEntryParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypeAliasType, TypedDict diff --git a/google/genai/_gaos/types/interactions/errorevent.py b/google/genai/_gaos/types/interactions/errorevent.py index 4360b0e9f..48c468fd0 100644 --- a/google/genai/_gaos/types/interactions/errorevent.py +++ b/google/genai/_gaos/types/interactions/errorevent.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .error import Error, ErrorTypedDict from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .error import Error, ErrorTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/filesearchcallstep.py b/google/genai/_gaos/types/interactions/filesearchcallstep.py index aaf410d4a..fb481b99d 100644 --- a/google/genai/_gaos/types/interactions/filesearchcallstep.py +++ b/google/genai/_gaos/types/interactions/filesearchcallstep.py @@ -17,7 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) from ...utils import validate_const import pydantic from pydantic import model_serializer diff --git a/google/genai/_gaos/types/interactions/filesearchresultdelta.py b/google/genai/_gaos/types/interactions/filesearchresultdelta.py index 0a8507ee6..d92336aba 100644 --- a/google/genai/_gaos/types/interactions/filesearchresultdelta.py +++ b/google/genai/_gaos/types/interactions/filesearchresultdelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .filesearchresult import FileSearchResult, FileSearchResultTypedDict from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .filesearchresult import FileSearchResult, FileSearchResultTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/filesearchresultstep.py b/google/genai/_gaos/types/interactions/filesearchresultstep.py index 3ef747722..389d2f1b4 100644 --- a/google/genai/_gaos/types/interactions/filesearchresultstep.py +++ b/google/genai/_gaos/types/interactions/filesearchresultstep.py @@ -17,7 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) from ...utils import validate_const import pydantic from pydantic import model_serializer diff --git a/google/genai/_gaos/types/interactions/findrequest.py b/google/genai/_gaos/types/interactions/findrequest.py index a93d35a64..f98f067dc 100644 --- a/google/genai/_gaos/types/interactions/findrequest.py +++ b/google/genai/_gaos/types/interactions/findrequest.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from .filecontent import FileContent, FileContentParam +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/fixrequest.py b/google/genai/_gaos/types/interactions/fixrequest.py index c8616fbd5..6c1fdb5e3 100644 --- a/google/genai/_gaos/types/interactions/fixrequest.py +++ b/google/genai/_gaos/types/interactions/fixrequest.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .filecontent import FileContent, FileContentParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/functionresultdelta.py b/google/genai/_gaos/types/interactions/functionresultdelta.py index 335357fbc..9f881f1f6 100644 --- a/google/genai/_gaos/types/interactions/functionresultdelta.py +++ b/google/genai/_gaos/types/interactions/functionresultdelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .functionresultsubcontent import ( FunctionResultSubcontent, FunctionResultSubcontentParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/functionresultstep.py b/google/genai/_gaos/types/interactions/functionresultstep.py index 3599ee57e..94fd705a0 100644 --- a/google/genai/_gaos/types/interactions/functionresultstep.py +++ b/google/genai/_gaos/types/interactions/functionresultstep.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .functionresultsubcontent import ( FunctionResultSubcontent, FunctionResultSubcontentParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/functionresultsubcontent.py b/google/genai/_gaos/types/interactions/functionresultsubcontent.py index e202b9817..9f571555b 100644 --- a/google/genai/_gaos/types/interactions/functionresultsubcontent.py +++ b/google/genai/_gaos/types/interactions/functionresultsubcontent.py @@ -17,11 +17,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .imagecontent import ImageContent, ImageContentParam from .textcontent import TextContent, TextContentParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/interactions/generationconfig.py b/google/genai/_gaos/types/interactions/generationconfig.py index 55dc1885c..3500a67fc 100644 --- a/google/genai/_gaos/types/interactions/generationconfig.py +++ b/google/genai/_gaos/types/interactions/generationconfig.py @@ -17,7 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .imageconfig import ImageConfig, ImageConfigParam from .speakerconfig import SpeakerConfig, SpeakerConfigParam from .speechconfig import SpeechConfig, SpeechConfigParam @@ -27,22 +26,13 @@ from .toolchoicetype import ToolChoiceType from .transcriptionconfig import TranscriptionConfig, TranscriptionConfigParam from .videoconfig import VideoConfig, VideoConfigParam +from .. import BaseModel, UNSET_SENTINEL import pydantic from pydantic import model_serializer from typing import List, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -ToolChoiceParam = TypeAliasType( - "ToolChoiceParam", Union[ToolChoiceConfigParam, ToolChoiceType] -) -r"""The tool choice configuration.""" - - -ToolChoice = TypeAliasType("ToolChoice", Union[ToolChoiceConfig, ToolChoiceType]) -r"""The tool choice configuration.""" - - SpeechConfigUnionParam = TypeAliasType( "SpeechConfigUnionParam", Union[SpeakerConfigParam, List[SpeechConfigParam]] ) @@ -55,6 +45,16 @@ r"""Optional. Speech and multi-speaker configuration.""" +ToolChoiceParam = TypeAliasType( + "ToolChoiceParam", Union[ToolChoiceConfigParam, ToolChoiceType] +) +r"""The tool choice configuration.""" + + +ToolChoice = TypeAliasType("ToolChoice", Union[ToolChoiceConfig, ToolChoiceType]) +r"""The tool choice configuration.""" + + class GenerationConfigParam(TypedDict): r"""Configuration parameters for model interactions.""" @@ -64,6 +64,8 @@ class GenerationConfigParam(TypedDict): r"""The maximum number of tokens to include in the response.""" seed: NotRequired[int] r"""Seed used in decoding for reproducibility.""" + speech_config: NotRequired[SpeechConfigUnionParam] + r"""Optional. Speech and multi-speaker configuration.""" stop_sequences: NotRequired[List[str]] r"""A list of character sequences that will stop output interaction.""" thinking_level: NotRequired[ThinkingLevel] @@ -74,8 +76,6 @@ class GenerationConfigParam(TypedDict): r"""Configuration for speech recognition (transcription).""" video_config: NotRequired[VideoConfigParam] r"""Configuration options for video generation.""" - speech_config: NotRequired[SpeechConfigUnionParam] - r"""Optional. Speech and multi-speaker configuration.""" class GenerationConfig(BaseModel): @@ -95,6 +95,9 @@ class GenerationConfig(BaseModel): seed: Optional[int] = None r"""Seed used in decoding for reproducibility.""" + speech_config: Optional[SpeechConfigUnion] = None + r"""Optional. Speech and multi-speaker configuration.""" + stop_sequences: Optional[List[str]] = None r"""A list of character sequences that will stop output interaction.""" @@ -111,9 +114,6 @@ class GenerationConfig(BaseModel): video_config: Optional[VideoConfig] = None r"""Configuration options for video generation.""" - speech_config: Optional[SpeechConfigUnion] = None - r"""Optional. Speech and multi-speaker configuration.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -121,13 +121,13 @@ def serialize_model(self, handler): "image_config", "max_output_tokens", "seed", + "speech_config", "stop_sequences", "thinking_level", "thinking_summaries", "tool_choice", "transcription_config", "video_config", - "speech_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/googlemapscalldelta.py b/google/genai/_gaos/types/interactions/googlemapscalldelta.py index 56f5c3cf8..642091d75 100644 --- a/google/genai/_gaos/types/interactions/googlemapscalldelta.py +++ b/google/genai/_gaos/types/interactions/googlemapscalldelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .googlemapscallarguments import ( GoogleMapsCallArguments, GoogleMapsCallArgumentsParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlemapscallstep.py b/google/genai/_gaos/types/interactions/googlemapscallstep.py index b00c3fa8e..7d3bba2bf 100644 --- a/google/genai/_gaos/types/interactions/googlemapscallstep.py +++ b/google/genai/_gaos/types/interactions/googlemapscallstep.py @@ -17,12 +17,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .googlemapscallarguments import ( GoogleMapsCallArguments, GoogleMapsCallArgumentsParam, ) +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlemapsresult.py b/google/genai/_gaos/types/interactions/googlemapsresult.py index abd335336..ed6697f7b 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresult.py +++ b/google/genai/_gaos/types/interactions/googlemapsresult.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .googlemapsresultplaces import GoogleMapsResultPlaces, GoogleMapsResultPlacesParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/googlemapsresultdelta.py b/google/genai/_gaos/types/interactions/googlemapsresultdelta.py index b5b38f4d8..4005d9d10 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultdelta.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultdelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .googlemapsresult import GoogleMapsResult, GoogleMapsResultParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .googlemapsresult import GoogleMapsResult, GoogleMapsResultParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlemapsresultplaces.py b/google/genai/_gaos/types/interactions/googlemapsresultplaces.py index 431389abf..0cf9e220f 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultplaces.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultplaces.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .reviewsnippet import ReviewSnippet, ReviewSnippetParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/googlemapsresultstep.py b/google/genai/_gaos/types/interactions/googlemapsresultstep.py index 7029f5c8f..6468efd5c 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultstep.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultstep.py @@ -17,9 +17,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .googlemapsresult import GoogleMapsResult, GoogleMapsResultParam +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlesearchcalldelta.py b/google/genai/_gaos/types/interactions/googlesearchcalldelta.py index 816d20c8a..dcdb2006e 100644 --- a/google/genai/_gaos/types/interactions/googlesearchcalldelta.py +++ b/google/genai/_gaos/types/interactions/googlesearchcalldelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .googlesearchcallarguments import ( GoogleSearchCallArguments, GoogleSearchCallArgumentsParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlesearchcallstep.py b/google/genai/_gaos/types/interactions/googlesearchcallstep.py index 1eaee5b1b..7ed278b29 100644 --- a/google/genai/_gaos/types/interactions/googlesearchcallstep.py +++ b/google/genai/_gaos/types/interactions/googlesearchcallstep.py @@ -17,6 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .googlesearchcallarguments import ( + GoogleSearchCallArguments, + GoogleSearchCallArgumentsParam, +) from .. import ( Base64EncodedString, Base64FileInput, @@ -25,10 +29,6 @@ UnrecognizedStr, ) from ...utils import validate_const -from .googlesearchcallarguments import ( - GoogleSearchCallArguments, - GoogleSearchCallArgumentsParam, -) import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlesearchresultdelta.py b/google/genai/_gaos/types/interactions/googlesearchresultdelta.py index 1f88b3957..8cf66b052 100644 --- a/google/genai/_gaos/types/interactions/googlesearchresultdelta.py +++ b/google/genai/_gaos/types/interactions/googlesearchresultdelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .googlesearchresult import GoogleSearchResult, GoogleSearchResultParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .googlesearchresult import GoogleSearchResult, GoogleSearchResultParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/googlesearchresultstep.py b/google/genai/_gaos/types/interactions/googlesearchresultstep.py index 45bf0fab5..910bc4a11 100644 --- a/google/genai/_gaos/types/interactions/googlesearchresultstep.py +++ b/google/genai/_gaos/types/interactions/googlesearchresultstep.py @@ -17,9 +17,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .googlesearchresult import GoogleSearchResult, GoogleSearchResultParam +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/imagecontent.py b/google/genai/_gaos/types/interactions/imagecontent.py index 15aa7bea6..d0279c0cc 100644 --- a/google/genai/_gaos/types/interactions/imagecontent.py +++ b/google/genai/_gaos/types/interactions/imagecontent.py @@ -17,6 +17,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .mediaresolution import MediaResolution from .. import ( Base64EncodedString, Base64FileInput, @@ -25,7 +26,6 @@ UnrecognizedStr, ) from ...utils import validate_const -from .mediaresolution import MediaResolution import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -54,12 +54,12 @@ class ImageContentParam(TypedDict): data: NotRequired[Union[str, Base64FileInput]] r"""The image content.""" + mime_type: NotRequired[ImageContentMimeType] + r"""The mime type of the image.""" resolution: NotRequired[MediaResolution] type: Literal["image"] uri: NotRequired[str] r"""The URI of the image.""" - mime_type: NotRequired[ImageContentMimeType] - r"""The mime type of the image.""" class ImageContent(BaseModel): @@ -68,6 +68,9 @@ class ImageContent(BaseModel): data: Optional[Base64EncodedString] = None r"""The image content.""" + mime_type: Optional[ImageContentMimeType] = None + r"""The mime type of the image.""" + resolution: Optional[MediaResolution] = None type: Annotated[ @@ -78,12 +81,9 @@ class ImageContent(BaseModel): uri: Optional[str] = None r"""The URI of the image.""" - mime_type: Optional[ImageContentMimeType] = None - r"""The mime type of the image.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "resolution", "uri", "mime_type"]) + optional_fields = set(["data", "mime_type", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/imagedelta.py b/google/genai/_gaos/types/interactions/imagedelta.py index 4e3780ac9..51110cc27 100644 --- a/google/genai/_gaos/types/interactions/imagedelta.py +++ b/google/genai/_gaos/types/interactions/imagedelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .mediaresolution import MediaResolution from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from ...utils import validate_const -from .mediaresolution import MediaResolution import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/interaction.py b/google/genai/_gaos/types/interactions/interaction.py index fd87df6fb..281c75453 100644 --- a/google/genai/_gaos/types/interactions/interaction.py +++ b/google/genai/_gaos/types/interactions/interaction.py @@ -17,8 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ...utils.unions import parse_open_union from .agentoption import AgentOption from .antigravityagentconfig import AntigravityAgentConfig, AntigravityAgentConfigParam from .audiocontent import AudioContent, AudioContentParam @@ -44,6 +42,8 @@ from .videocontent import VideoContent, VideoContentParam from .webhookconfig import WebhookConfig, WebhookConfigParam from functools import partial +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from ...utils.unions import parse_open_union import pydantic from pydantic import ConfigDict, model_serializer from pydantic.functional_validators import BeforeValidator @@ -51,47 +51,6 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -InteractionStatus = Union[ - Literal[ - "in_progress", - "requires_action", - "completed", - "failed", - "cancelled", - "incomplete", - "budget_exceeded", - "queued", - ], - UnrecognizedStr, -] -r"""Required. Output only. The status of the interaction.""" - - -InteractionResponseFormatTypedDict = TypeAliasType( - "InteractionResponseFormatTypedDict", - Union[List[ResponseFormatParam], ResponseFormatParam], -) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - - -InteractionResponseFormat = TypeAliasType( - "InteractionResponseFormat", Union[List[ResponseFormat], ResponseFormat] -) -r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - - -InteractionEnvironmentTypedDict = TypeAliasType( - "InteractionEnvironmentTypedDict", Union[EnvironmentParam, str] -) -r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - - -InteractionEnvironment = TypeAliasType( - "InteractionEnvironment", Union[Environment, str] -) -r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - - InteractionAgentConfigTypedDict = TypeAliasType( "InteractionAgentConfigTypedDict", Union[ @@ -115,19 +74,19 @@ class UnknownInteractionAgentConfig(BaseModel): _INTERACTION_AGENT_CONFIG_VARIANTS: dict[str, Any] = { - "dynamic": DynamicAgentConfig, - "deep-research": DeepResearchAgentConfig, - "code-mender": CodeMenderAgentConfig, "antigravity": AntigravityAgentConfig, + "code-mender": CodeMenderAgentConfig, + "deep-research": DeepResearchAgentConfig, + "dynamic": DynamicAgentConfig, } InteractionAgentConfig = Annotated[ Union[ - DynamicAgentConfig, - DeepResearchAgentConfig, - CodeMenderAgentConfig, AntigravityAgentConfig, + CodeMenderAgentConfig, + DeepResearchAgentConfig, + DynamicAgentConfig, UnknownInteractionAgentConfig, ], BeforeValidator( @@ -144,73 +103,114 @@ class UnknownInteractionAgentConfig(BaseModel): r"""Configuration parameters for the agent interaction.""" +InteractionEnvironmentTypedDict = TypeAliasType( + "InteractionEnvironmentTypedDict", Union[EnvironmentParam, str] +) +r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + + +InteractionEnvironment = TypeAliasType( + "InteractionEnvironment", Union[Environment, str] +) +r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + + +InteractionResponseFormatTypedDict = TypeAliasType( + "InteractionResponseFormatTypedDict", + Union[ResponseFormatParam, List[ResponseFormatParam]], +) +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + +InteractionResponseFormat = TypeAliasType( + "InteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]] +) +r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + + +InteractionStatus = Union[ + Literal[ + "in_progress", + "requires_action", + "completed", + "failed", + "cancelled", + "incomplete", + "budget_exceeded", + "queued", + ], + UnrecognizedStr, +] +r"""Required. Output only. The status of the interaction.""" + + class InteractionTypedDict(TypedDict): r"""The Interaction resource.""" status: InteractionStatus r"""Required. Output only. The status of the interaction.""" - model: NotRequired[Model] - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" agent: NotRequired[AgentOption] r"""The agent to interact with.""" - id: NotRequired[str] - r"""Required. Output only. A unique identifier for the interaction completion.""" + agent_config: NotRequired[InteractionAgentConfigTypedDict] + r"""Configuration parameters for the agent interaction.""" created: NotRequired[str] r"""Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). """ - updated: NotRequired[str] - r"""Output only. The time at which the response was last updated in ISO 8601 format - (YYYY-MM-DDThh:mm:ssZ). - """ - system_instruction: NotRequired[str] - r"""System instruction for the interaction.""" - tools: NotRequired[List[ToolParam]] - r"""A list of tool declarations the model may call during interaction.""" - errors: NotRequired[List[ErrorTypedDict]] - r"""Output only. Diagnostic faults / platform errors recorded on the interaction.""" - usage: NotRequired[UsageTypedDict] - r"""Statistics on the interaction request's token usage.""" - response_modalities: NotRequired[List[ResponseModality]] - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - response_mime_type: NotRequired[str] - r"""The mime type of the response. This is required if response_format is set.""" - previous_interaction_id: NotRequired[str] - r"""The ID of the previous interaction, if any.""" + environment: NotRequired[InteractionEnvironmentTypedDict] + r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" environment_id: NotRequired[str] r"""Output only. The environment ID for the interaction. Only populated if environment config is set in the request. """ - service_tier: NotRequired[ServiceTier] - webhook_config: NotRequired[WebhookConfigParam] - r"""Message for configuring webhook events for a request.""" - steps: NotRequired[List[StepParam]] - r"""Output only. The steps that make up the interaction, when included in the response.""" - response_format: NotRequired[InteractionResponseFormatTypedDict] - r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - environment: NotRequired[InteractionEnvironmentTypedDict] - r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + errors: NotRequired[List[ErrorTypedDict]] + r"""Output only. Diagnostic faults / platform errors recorded on the interaction.""" generation_config: NotRequired[GenerationConfigParam] r"""Configuration parameters for model interactions.""" - agent_config: NotRequired[InteractionAgentConfigTypedDict] - r"""Configuration parameters for the agent interaction.""" - safety_settings: NotRequired[List[SafetySettingParam]] - r"""Safety settings for the interaction.""" - labels: NotRequired[Dict[str, str]] - r"""The labels with user-defined metadata for the request.""" + id: NotRequired[str] + r"""Required. Output only. A unique identifier for the interaction completion.""" input: NotRequired[InteractionsInputParam] r"""The input for the interaction.""" + labels: NotRequired[Dict[str, str]] + r"""The labels with user-defined metadata for the request.""" + model: NotRequired[Model] + r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" + output_audio: NotRequired[AudioContentParam] + r"""An audio content block.""" + output_image: NotRequired[ImageContentParam] + r"""An image content block.""" output_text: NotRequired[str] r"""Concatenated text from the last model output in response to the current request. Note: this is added by the SDK. """ - output_image: NotRequired[ImageContentParam] - r"""An image content block.""" - output_audio: NotRequired[AudioContentParam] - r"""An audio content block.""" output_video: NotRequired[VideoContentParam] r"""A video content block.""" + previous_interaction_id: NotRequired[str] + r"""The ID of the previous interaction, if any.""" + response_format: NotRequired[InteractionResponseFormatTypedDict] + r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + response_mime_type: NotRequired[str] + r"""The mime type of the response. This is required if response_format is set.""" + response_modalities: NotRequired[List[ResponseModality]] + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + safety_settings: NotRequired[List[SafetySettingParam]] + r"""Safety settings for the interaction.""" + service_tier: NotRequired[ServiceTier] + steps: NotRequired[List[StepParam]] + r"""Output only. The steps that make up the interaction, when included in the response.""" + system_instruction: NotRequired[str] + r"""System instruction for the interaction.""" + tools: NotRequired[List[ToolParam]] + r"""A list of tool declarations the model may call during interaction.""" + updated: NotRequired[str] + r"""Output only. The time at which the response was last updated in ISO 8601 format + (YYYY-MM-DDThh:mm:ssZ). + """ + usage: NotRequired[UsageTypedDict] + r"""Statistics on the interaction request's token usage.""" + webhook_config: NotRequired[WebhookConfigParam] + r"""Message for configuring webhook events for a request.""" class Interaction(BaseModel): @@ -219,136 +219,136 @@ class Interaction(BaseModel): status: InteractionStatus r"""Required. Output only. The status of the interaction.""" - model: Optional[Model] = None - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" - agent: Optional[AgentOption] = None r"""The agent to interact with.""" - id: Optional[str] = "" - r"""Required. Output only. A unique identifier for the interaction completion.""" + agent_config: Optional[InteractionAgentConfig] = None + r"""Configuration parameters for the agent interaction.""" created: Optional[str] = None r"""Output only. The time at which the response was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). """ - updated: Optional[str] = None - r"""Output only. The time at which the response was last updated in ISO 8601 format - (YYYY-MM-DDThh:mm:ssZ). - """ - - system_instruction: Optional[str] = None - r"""System instruction for the interaction.""" + environment: Optional[InteractionEnvironment] = None + r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - tools: Optional[List[Tool]] = None - r"""A list of tool declarations the model may call during interaction.""" + environment_id: Optional[str] = None + r"""Output only. The environment ID for the interaction. Only populated if environment + config is set in the request. + """ errors: Optional[List[Error]] = None r"""Output only. Diagnostic faults / platform errors recorded on the interaction.""" - usage: Optional[Usage] = None - r"""Statistics on the interaction request's token usage.""" + generation_config: Optional[GenerationConfig] = None + r"""Configuration parameters for model interactions.""" - response_modalities: Annotated[ - Optional[List[ResponseModality]], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + id: Optional[str] = "" + r"""Required. Output only. A unique identifier for the interaction completion.""" - response_mime_type: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""The mime type of the response. This is required if response_format is set.""" + input: Optional[InteractionsInput] = None + r"""The input for the interaction.""" - previous_interaction_id: Optional[str] = None - r"""The ID of the previous interaction, if any.""" + labels: Optional[Dict[str, str]] = None + r"""The labels with user-defined metadata for the request.""" - environment_id: Optional[str] = None - r"""Output only. The environment ID for the interaction. Only populated if environment - config is set in the request. - """ + model: Optional[Model] = None + r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" - service_tier: Optional[ServiceTier] = None + output_audio: Optional[AudioContent] = None + r"""An audio content block.""" - webhook_config: Optional[WebhookConfig] = None - r"""Message for configuring webhook events for a request.""" + output_image: Optional[ImageContent] = None + r"""An image content block.""" - steps: Optional[List[Step]] = None - r"""Output only. The steps that make up the interaction, when included in the response.""" + output_text: Optional[str] = None + r"""Concatenated text from the last model output in response to the current request. + + Note: this is added by the SDK. + """ + + output_video: Optional[VideoContent] = None + r"""A video content block.""" + + previous_interaction_id: Optional[str] = None + r"""The ID of the previous interaction, if any.""" response_format: Optional[InteractionResponseFormat] = None r"""Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" - environment: Optional[InteractionEnvironment] = None - r"""The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - - generation_config: Optional[GenerationConfig] = None - r"""Configuration parameters for model interactions.""" + response_mime_type: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""The mime type of the response. This is required if response_format is set.""" - agent_config: Optional[InteractionAgentConfig] = None - r"""Configuration parameters for the agent interaction.""" + response_modalities: Annotated[ + Optional[List[ResponseModality]], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""The requested modalities of the response (TEXT, IMAGE, AUDIO).""" safety_settings: Optional[List[SafetySetting]] = None r"""Safety settings for the interaction.""" - labels: Optional[Dict[str, str]] = None - r"""The labels with user-defined metadata for the request.""" + service_tier: Optional[ServiceTier] = None - input: Optional[InteractionsInput] = None - r"""The input for the interaction.""" + steps: Optional[List[Step]] = None + r"""Output only. The steps that make up the interaction, when included in the response.""" - output_text: Optional[str] = None - r"""Concatenated text from the last model output in response to the current request. + system_instruction: Optional[str] = None + r"""System instruction for the interaction.""" - Note: this is added by the SDK. - """ + tools: Optional[List[Tool]] = None + r"""A list of tool declarations the model may call during interaction.""" - output_image: Optional[ImageContent] = None - r"""An image content block.""" + updated: Optional[str] = None + r"""Output only. The time at which the response was last updated in ISO 8601 format + (YYYY-MM-DDThh:mm:ssZ). + """ - output_audio: Optional[AudioContent] = None - r"""An audio content block.""" + usage: Optional[Usage] = None + r"""Statistics on the interaction request's token usage.""" - output_video: Optional[VideoContent] = None - r"""A video content block.""" + webhook_config: Optional[WebhookConfig] = None + r"""Message for configuring webhook events for a request.""" @model_serializer(mode="wrap") def _serialize_model(self, handler): optional_fields = set( [ - "model", "agent", - "id", + "agent_config", "created", - "updated", - "system_instruction", - "tools", - "errors", - "usage", - "response_modalities", - "response_mime_type", - "previous_interaction_id", - "environment_id", - "service_tier", - "webhook_config", - "steps", - "response_format", "environment", + "environment_id", + "errors", "generation_config", - "agent_config", - "safety_settings", - "labels", + "id", "input", - "output_text", - "output_image", + "labels", + "model", "output_audio", + "output_image", + "output_text", "output_video", + "previous_interaction_id", + "response_format", + "response_mime_type", + "response_modalities", + "safety_settings", + "service_tier", + "steps", + "system_instruction", + "tools", + "updated", + "usage", + "webhook_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/interactioncompletedevent.py b/google/genai/_gaos/types/interactions/interactioncompletedevent.py index a7efc3fcd..d81bc2795 100644 --- a/google/genai/_gaos/types/interactions/interactioncompletedevent.py +++ b/google/genai/_gaos/types/interactions/interactioncompletedevent.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .interactionsseeventinteraction import ( InteractionSseEventInteraction, InteractionSseEventInteractionTypedDict, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -37,11 +37,11 @@ class InteractionCompletedEventTypedDict(TypedDict): full non-streaming Interaction responses. """ - event_type: Literal["interaction.completed"] event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["interaction.completed"] class InteractionCompletedEvent(BaseModel): @@ -52,6 +52,11 @@ class InteractionCompletedEvent(BaseModel): """ + event_id: Optional[str] = None + r"""The event_id token to be used to resume the interaction stream, from + this event. + """ + event_type: Annotated[ Annotated[ Literal["interaction.completed"], @@ -60,11 +65,6 @@ class InteractionCompletedEvent(BaseModel): pydantic.Field(alias="event_type"), ] = "interaction.completed" - event_id: Optional[str] = None - r"""The event_id token to be used to resume the interaction stream, from - this event. - """ - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["event_id"]) diff --git a/google/genai/_gaos/types/interactions/interactioncreatedevent.py b/google/genai/_gaos/types/interactions/interactioncreatedevent.py index 496035cd0..22f3618d0 100644 --- a/google/genai/_gaos/types/interactions/interactioncreatedevent.py +++ b/google/genai/_gaos/types/interactions/interactioncreatedevent.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .interactionsseeventinteraction import ( InteractionSseEventInteraction, InteractionSseEventInteractionTypedDict, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -37,11 +37,11 @@ class InteractionCreatedEventTypedDict(TypedDict): full non-streaming Interaction responses. """ - event_type: Literal["interaction.created"] event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["interaction.created"] class InteractionCreatedEvent(BaseModel): @@ -52,6 +52,11 @@ class InteractionCreatedEvent(BaseModel): """ + event_id: Optional[str] = None + r"""The event_id token to be used to resume the interaction stream, from + this event. + """ + event_type: Annotated[ Annotated[ Literal["interaction.created"], @@ -60,11 +65,6 @@ class InteractionCreatedEvent(BaseModel): pydantic.Field(alias="event_type"), ] = "interaction.created" - event_id: Optional[str] = None - r"""The event_id token to be used to resume the interaction stream, from - this event. - """ - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["event_id"]) diff --git a/google/genai/_gaos/types/interactions/interactionsinput.py b/google/genai/_gaos/types/interactions/interactionsinput.py index 6b294d9dd..675701215 100644 --- a/google/genai/_gaos/types/interactions/interactionsinput.py +++ b/google/genai/_gaos/types/interactions/interactionsinput.py @@ -25,12 +25,12 @@ InteractionsInputParam = TypeAliasType( "InteractionsInputParam", - Union[str, List[StepParam], List[ContentParam], ContentParam], + Union[ContentParam, List[StepParam], List[ContentParam], str], ) r"""The input for the interaction.""" InteractionsInput = TypeAliasType( - "InteractionsInput", Union[str, List[Step], List[Content], Content] + "InteractionsInput", Union[Content, List[Step], List[Content], str] ) r"""The input for the interaction.""" diff --git a/google/genai/_gaos/types/interactions/interactionsseevent.py b/google/genai/_gaos/types/interactions/interactionsseevent.py index 58ffffe77..4cecaadb2 100644 --- a/google/genai/_gaos/types/interactions/interactionsseevent.py +++ b/google/genai/_gaos/types/interactions/interactionsseevent.py @@ -17,8 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .errorevent import ErrorEvent, ErrorEventTypedDict from .interactioncompletedevent import ( InteractionCompletedEvent, @@ -36,6 +34,8 @@ from .stepstart import StepStart, StepStartTypedDict from .stepstop import StepStop, StepStopTypedDict from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union @@ -45,9 +45,9 @@ InteractionSSEEventTypedDict = TypeAliasType( "InteractionSSEEventTypedDict", Union[ - InteractionCreatedEventTypedDict, - InteractionCompletedEventTypedDict, ErrorEventTypedDict, + InteractionCompletedEventTypedDict, + InteractionCreatedEventTypedDict, InteractionStatusUpdateTypedDict, StepStartTypedDict, StepDeltaTypedDict, @@ -67,24 +67,24 @@ class UnknownInteractionSSEEvent(BaseModel): _INTERACTION_SSE_EVENT_VARIANTS: dict[str, Any] = { - "interaction.created": InteractionCreatedEvent, + "error": ErrorEvent, "interaction.completed": InteractionCompletedEvent, + "interaction.created": InteractionCreatedEvent, "interaction.status_update": InteractionStatusUpdate, - "error": ErrorEvent, - "step.start": StepStart, "step.delta": StepDelta, + "step.start": StepStart, "step.stop": StepStop, } InteractionSSEEvent = Annotated[ Union[ - InteractionCreatedEvent, + ErrorEvent, InteractionCompletedEvent, + InteractionCreatedEvent, InteractionStatusUpdate, - ErrorEvent, - StepStart, StepDelta, + StepStart, StepStop, UnknownInteractionSSEEvent, ], diff --git a/google/genai/_gaos/types/interactions/interactionsseeventinteraction.py b/google/genai/_gaos/types/interactions/interactionsseeventinteraction.py index 5754c6f8d..bd0f27694 100644 --- a/google/genai/_gaos/types/interactions/interactionsseeventinteraction.py +++ b/google/genai/_gaos/types/interactions/interactionsseeventinteraction.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from .servicetier import ServiceTier from .step import Step, StepParam from .usage import Usage, UsageTypedDict +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict @@ -51,21 +51,21 @@ class InteractionSseEventInteractionTypedDict(TypedDict): r"""Required. Output only. A unique identifier for the interaction completion.""" status: InteractionSseEventInteractionStatus r"""Required. Output only. The status of the interaction.""" - object: NotRequired[str] - r"""Output only. The resource type.""" - model: NotRequired[str] - r"""The model that will complete your prompt.""" agent: NotRequired[str] r"""The agent to interact with.""" created: NotRequired[str] r"""Output only. The time at which the response was created in ISO 8601 format.""" + model: NotRequired[str] + r"""The model that will complete your prompt.""" + object: NotRequired[str] + r"""Output only. The resource type.""" + service_tier: NotRequired[ServiceTier] + steps: NotRequired[List[StepParam]] + r"""Output only. The steps that make up the interaction, if included in this event.""" updated: NotRequired[str] r"""Output only. The time at which the response was last updated in ISO 8601 format.""" - service_tier: NotRequired[ServiceTier] usage: NotRequired[UsageTypedDict] r"""Statistics on the interaction request's token usage.""" - steps: NotRequired[List[StepParam]] - r"""Output only. The steps that make up the interaction, if included in this event.""" class InteractionSseEventInteraction(BaseModel): @@ -81,41 +81,41 @@ class InteractionSseEventInteraction(BaseModel): status: InteractionSseEventInteractionStatus r"""Required. Output only. The status of the interaction.""" - object: Optional[str] = None - r"""Output only. The resource type.""" - - model: Optional[str] = None - r"""The model that will complete your prompt.""" - agent: Optional[str] = None r"""The agent to interact with.""" created: Optional[str] = None r"""Output only. The time at which the response was created in ISO 8601 format.""" - updated: Optional[str] = None - r"""Output only. The time at which the response was last updated in ISO 8601 format.""" + model: Optional[str] = None + r"""The model that will complete your prompt.""" - service_tier: Optional[ServiceTier] = None + object: Optional[str] = None + r"""Output only. The resource type.""" - usage: Optional[Usage] = None - r"""Statistics on the interaction request's token usage.""" + service_tier: Optional[ServiceTier] = None steps: Optional[List[Step]] = None r"""Output only. The steps that make up the interaction, if included in this event.""" + updated: Optional[str] = None + r"""Output only. The time at which the response was last updated in ISO 8601 format.""" + + usage: Optional[Usage] = None + r"""Statistics on the interaction request's token usage.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "object", - "model", "agent", "created", - "updated", + "model", + "object", "service_tier", - "usage", "steps", + "updated", + "usage", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/interactionssestreamevent.py b/google/genai/_gaos/types/interactions/interactionssestreamevent.py index 208698c05..10d4b7557 100644 --- a/google/genai/_gaos/types/interactions/interactionssestreamevent.py +++ b/google/genai/_gaos/types/interactions/interactionssestreamevent.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel from .interactionsseevent import InteractionSSEEvent, InteractionSSEEventTypedDict +from .. import BaseModel from typing_extensions import TypedDict diff --git a/google/genai/_gaos/types/interactions/mcpserver.py b/google/genai/_gaos/types/interactions/mcpserver.py index b1f0c9722..446ca783d 100644 --- a/google/genai/_gaos/types/interactions/mcpserver.py +++ b/google/genai/_gaos/types/interactions/mcpserver.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .allowedtools import AllowedTools, AllowedToolsParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .allowedtools import AllowedTools, AllowedToolsParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py b/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py index 662f5da7e..c0104e685 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .functionresultsubcontent import ( FunctionResultSubcontent, FunctionResultSubcontentParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py b/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py index c1cf9a6ab..0a2c6b74a 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .functionresultsubcontent import ( FunctionResultSubcontent, FunctionResultSubcontentParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -40,14 +40,14 @@ class MCPServerToolResultStepResult(BaseModel): MCPServerToolResultStepResultUnionParam = TypeAliasType( "MCPServerToolResultStepResultUnionParam", - Union[MCPServerToolResultStepResultParam, str, List[FunctionResultSubcontentParam]], + Union[MCPServerToolResultStepResultParam, List[FunctionResultSubcontentParam], str], ) r"""Required. The output from the MCP server call. Can be simple text or rich content.""" MCPServerToolResultStepResultUnion = TypeAliasType( "MCPServerToolResultStepResultUnion", - Union[MCPServerToolResultStepResult, str, List[FunctionResultSubcontent]], + Union[MCPServerToolResultStepResult, List[FunctionResultSubcontent], str], ) r"""Required. The output from the MCP server call. Can be simple text or rich content.""" diff --git a/google/genai/_gaos/types/interactions/modalitytokens.py b/google/genai/_gaos/types/interactions/modalitytokens.py index 558e8de19..6552fd063 100644 --- a/google/genai/_gaos/types/interactions/modalitytokens.py +++ b/google/genai/_gaos/types/interactions/modalitytokens.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .responsemodality import ResponseModality +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/modeloutputstep.py b/google/genai/_gaos/types/interactions/modeloutputstep.py index 48efaed17..7ad6bd7d7 100644 --- a/google/genai/_gaos/types/interactions/modeloutputstep.py +++ b/google/genai/_gaos/types/interactions/modeloutputstep.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .content import Content, ContentParam from .status import Status, StatusParam +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/placecitation.py b/google/genai/_gaos/types/interactions/placecitation.py index 4d28b771b..b1e0ee72d 100644 --- a/google/genai/_gaos/types/interactions/placecitation.py +++ b/google/genai/_gaos/types/interactions/placecitation.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .reviewsnippet import ReviewSnippet, ReviewSnippetParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .reviewsnippet import ReviewSnippet, ReviewSnippetParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/ragretrievalconfig.py b/google/genai/_gaos/types/interactions/ragretrievalconfig.py index cbeb45e55..f83a21b27 100644 --- a/google/genai/_gaos/types/interactions/ragretrievalconfig.py +++ b/google/genai/_gaos/types/interactions/ragretrievalconfig.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .filter_ import Filter, FilterParam from .hybridsearch import HybridSearch, HybridSearchParam from .ranking import Ranking, RankingParam +from .. import BaseModel, UNSET_SENTINEL import pydantic from pydantic import model_serializer from typing import Optional diff --git a/google/genai/_gaos/types/interactions/ragstoreconfig.py b/google/genai/_gaos/types/interactions/ragstoreconfig.py index a7308a363..675800f7d 100644 --- a/google/genai/_gaos/types/interactions/ragstoreconfig.py +++ b/google/genai/_gaos/types/interactions/ragstoreconfig.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .ragresource import RagResource, RagResourceParam from .ragretrievalconfig import RagRetrievalConfig, RagRetrievalConfigParam +from .. import BaseModel, UNSET_SENTINEL import pydantic from pydantic import model_serializer from typing import List, Optional diff --git a/google/genai/_gaos/types/interactions/retrieval.py b/google/genai/_gaos/types/interactions/retrieval.py index 859ee4e20..b002540e7 100644 --- a/google/genai/_gaos/types/interactions/retrieval.py +++ b/google/genai/_gaos/types/interactions/retrieval.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ...utils import validate_const from .exaaisearchconfig import ExaAISearchConfig, ExaAISearchConfigParam from .parallelaisearchconfig import ParallelAISearchConfig, ParallelAISearchConfigParam from .ragstoreconfig import RagStoreConfig, RagStoreConfigParam from .vertexaisearchconfig import VertexAISearchConfig, VertexAISearchConfigParam +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/retrievalcalldelta.py b/google/genai/_gaos/types/interactions/retrievalcalldelta.py index bcff610a3..2f02b2b27 100644 --- a/google/genai/_gaos/types/interactions/retrievalcalldelta.py +++ b/google/genai/_gaos/types/interactions/retrievalcalldelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ...utils import validate_const from .retrievalcallarguments import ( RetrievalCallArguments, RetrievalCallArgumentsTypedDict, ) +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/safetysetting.py b/google/genai/_gaos/types/interactions/safetysetting.py index b85b61793..4341bfaf5 100644 --- a/google/genai/_gaos/types/interactions/safetysetting.py +++ b/google/genai/_gaos/types/interactions/safetysetting.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from .harmcategory import HarmCategory +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import Literal, Optional, Union from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/speakerconfig.py b/google/genai/_gaos/types/interactions/speakerconfig.py index afae1ae5d..a1202da73 100644 --- a/google/genai/_gaos/types/interactions/speakerconfig.py +++ b/google/genai/_gaos/types/interactions/speakerconfig.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .speechconfig import SpeechConfig, SpeechConfigParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/step.py b/google/genai/_gaos/types/interactions/step.py index d10aabbbb..567268155 100644 --- a/google/genai/_gaos/types/interactions/step.py +++ b/google/genai/_gaos/types/interactions/step.py @@ -17,8 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .codeexecutioncallstep import CodeExecutionCallStep, CodeExecutionCallStepParam from .codeexecutionresultstep import ( CodeExecutionResultStep, @@ -43,6 +41,8 @@ from .urlcontextresultstep import URLContextResultStep, URLContextResultStepParam from .userinputstep import UserInputStep, UserInputStepParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union @@ -53,22 +53,22 @@ "StepParam", Union[ UserInputStepParam, - FileSearchCallStepParam, ModelOutputStepParam, - ThoughtStepParam, + FileSearchCallStepParam, FileSearchResultStepParam, - CodeExecutionCallStepParam, - URLContextCallStepParam, - GoogleMapsCallStepParam, + ThoughtStepParam, FunctionCallStepParam, + GoogleMapsCallStepParam, GoogleMapsResultStepParam, - MCPServerToolCallStepParam, + CodeExecutionCallStepParam, + URLContextCallStepParam, GoogleSearchCallStepParam, - FunctionResultStepParam, - CodeExecutionResultStepParam, - URLContextResultStepParam, GoogleSearchResultStepParam, + MCPServerToolCallStepParam, MCPServerToolResultStepParam, + FunctionResultStepParam, + URLContextResultStepParam, + CodeExecutionResultStepParam, ], ) r"""A step in the interaction.""" @@ -85,45 +85,45 @@ class UnknownStep(BaseModel): _STEP_VARIANTS: dict[str, Any] = { - "user_input": UserInputStep, - "model_output": ModelOutputStep, - "thought": ThoughtStep, - "function_call": FunctionCallStep, "code_execution_call": CodeExecutionCallStep, - "url_context_call": URLContextCallStep, - "mcp_server_tool_call": MCPServerToolCallStep, - "google_search_call": GoogleSearchCallStep, + "code_execution_result": CodeExecutionResultStep, "file_search_call": FileSearchCallStep, - "google_maps_call": GoogleMapsCallStep, + "file_search_result": FileSearchResultStep, + "function_call": FunctionCallStep, "function_result": FunctionResultStep, - "code_execution_result": CodeExecutionResultStep, - "url_context_result": URLContextResultStep, + "google_maps_call": GoogleMapsCallStep, + "google_maps_result": GoogleMapsResultStep, + "google_search_call": GoogleSearchCallStep, "google_search_result": GoogleSearchResultStep, + "mcp_server_tool_call": MCPServerToolCallStep, "mcp_server_tool_result": MCPServerToolResultStep, - "file_search_result": FileSearchResultStep, - "google_maps_result": GoogleMapsResultStep, + "model_output": ModelOutputStep, + "thought": ThoughtStep, + "url_context_call": URLContextCallStep, + "url_context_result": URLContextResultStep, + "user_input": UserInputStep, } Step = Annotated[ Union[ - UserInputStep, - ModelOutputStep, - ThoughtStep, - FunctionCallStep, CodeExecutionCallStep, - URLContextCallStep, - MCPServerToolCallStep, - GoogleSearchCallStep, + CodeExecutionResultStep, FileSearchCallStep, - GoogleMapsCallStep, + FileSearchResultStep, + FunctionCallStep, FunctionResultStep, - CodeExecutionResultStep, - URLContextResultStep, + GoogleMapsCallStep, + GoogleMapsResultStep, + GoogleSearchCallStep, GoogleSearchResultStep, + MCPServerToolCallStep, MCPServerToolResultStep, - FileSearchResultStep, - GoogleMapsResultStep, + ModelOutputStep, + ThoughtStep, + URLContextCallStep, + URLContextResultStep, + UserInputStep, UnknownStep, ], BeforeValidator( diff --git a/google/genai/_gaos/types/interactions/stepdelta.py b/google/genai/_gaos/types/interactions/stepdelta.py index c62121d17..6f02ec654 100644 --- a/google/genai/_gaos/types/interactions/stepdelta.py +++ b/google/genai/_gaos/types/interactions/stepdelta.py @@ -17,10 +17,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .stepdeltadata import StepDeltaData, StepDeltaDataTypedDict from .stepdeltametadata import StepDeltaMetadata, StepDeltaMetadataTypedDict +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/stepdeltadata.py b/google/genai/_gaos/types/interactions/stepdeltadata.py index 35045362f..b387efaa4 100644 --- a/google/genai/_gaos/types/interactions/stepdeltadata.py +++ b/google/genai/_gaos/types/interactions/stepdeltadata.py @@ -17,8 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .argumentsdelta import ArgumentsDelta, ArgumentsDeltaTypedDict from .audiodelta import AudioDelta, AudioDeltaTypedDict from .codeexecutioncalldelta import ( @@ -59,6 +57,8 @@ from .urlcontextresultdelta import URLContextResultDelta, URLContextResultDeltaTypedDict from .videodelta import VideoDelta, VideoDeltaTypedDict from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/interactions/stepdeltametadata.py b/google/genai/_gaos/types/interactions/stepdeltametadata.py index 166d586b2..28977587a 100644 --- a/google/genai/_gaos/types/interactions/stepdeltametadata.py +++ b/google/genai/_gaos/types/interactions/stepdeltametadata.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .usage import Usage, UsageTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/stepstart.py b/google/genai/_gaos/types/interactions/stepstart.py index cc848ee54..fa45fb061 100644 --- a/google/genai/_gaos/types/interactions/stepstart.py +++ b/google/genai/_gaos/types/interactions/stepstart.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .step import Step, StepParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .step import Step, StepParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/stepstop.py b/google/genai/_gaos/types/interactions/stepstop.py index 26f2b4178..9e921c8a7 100644 --- a/google/genai/_gaos/types/interactions/stepstop.py +++ b/google/genai/_gaos/types/interactions/stepstop.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .usage import Usage, UsageTypedDict from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .usage import Usage, UsageTypedDict import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/textannotationdelta.py b/google/genai/_gaos/types/interactions/textannotationdelta.py index 68c5580a8..d4b556b86 100644 --- a/google/genai/_gaos/types/interactions/textannotationdelta.py +++ b/google/genai/_gaos/types/interactions/textannotationdelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .annotation import Annotation, AnnotationParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .annotation import Annotation, AnnotationParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/textcontent.py b/google/genai/_gaos/types/interactions/textcontent.py index 61a24c980..8a62ab0c0 100644 --- a/google/genai/_gaos/types/interactions/textcontent.py +++ b/google/genai/_gaos/types/interactions/textcontent.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .annotation import Annotation, AnnotationParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .annotation import Annotation, AnnotationParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/thoughtstep.py b/google/genai/_gaos/types/interactions/thoughtstep.py index d9b917a7b..741141a5d 100644 --- a/google/genai/_gaos/types/interactions/thoughtstep.py +++ b/google/genai/_gaos/types/interactions/thoughtstep.py @@ -17,9 +17,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .thoughtsummarycontent import ThoughtSummaryContent, ThoughtSummaryContentParam +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/thoughtsummarycontent.py b/google/genai/_gaos/types/interactions/thoughtsummarycontent.py index 4316e16e8..905eae237 100644 --- a/google/genai/_gaos/types/interactions/thoughtsummarycontent.py +++ b/google/genai/_gaos/types/interactions/thoughtsummarycontent.py @@ -17,11 +17,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .imagecontent import ImageContent, ImageContentParam from .textcontent import TextContent, TextContentParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/interactions/thoughtsummarydelta.py b/google/genai/_gaos/types/interactions/thoughtsummarydelta.py index be4491147..673d0cf74 100644 --- a/google/genai/_gaos/types/interactions/thoughtsummarydelta.py +++ b/google/genai/_gaos/types/interactions/thoughtsummarydelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .content import Content, ContentParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .content import Content, ContentParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/tool.py b/google/genai/_gaos/types/interactions/tool.py index 91ddfdc74..c0f6e981b 100644 --- a/google/genai/_gaos/types/interactions/tool.py +++ b/google/genai/_gaos/types/interactions/tool.py @@ -17,8 +17,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel -from ...utils.unions import parse_open_union from .codeexecution import CodeExecution, CodeExecutionParam from .computeruse import ComputerUse, ComputerUseParam from .filesearch import FileSearch, FileSearchParam @@ -29,6 +27,8 @@ from .retrieval import Retrieval, RetrievalParam from .urlcontext import URLContext, URLContextParam from functools import partial +from .. import BaseModel +from ...utils.unions import parse_open_union from pydantic import ConfigDict from pydantic.functional_validators import BeforeValidator from typing import Any, Literal, Union diff --git a/google/genai/_gaos/types/interactions/toolchoiceconfig.py b/google/genai/_gaos/types/interactions/toolchoiceconfig.py index d6ec51105..178b177f8 100644 --- a/google/genai/_gaos/types/interactions/toolchoiceconfig.py +++ b/google/genai/_gaos/types/interactions/toolchoiceconfig.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .allowedtools import AllowedTools, AllowedToolsParam +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py index 1e0877f17..2fdb6eb2a 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py +++ b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py @@ -17,12 +17,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .urlcontextcallarguments import ( URLContextCallArguments, URLContextCallArgumentsParam, ) +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/urlcontextcallstep.py b/google/genai/_gaos/types/interactions/urlcontextcallstep.py index cb849e6af..f8a3adbcd 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcallstep.py +++ b/google/genai/_gaos/types/interactions/urlcontextcallstep.py @@ -17,12 +17,17 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .urlcontextcallarguments import ( URLContextCallArguments, URLContextCallArgumentsParam, ) +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/urlcontextresultdelta.py b/google/genai/_gaos/types/interactions/urlcontextresultdelta.py index f4a9b1e7e..ac83e2cd4 100644 --- a/google/genai/_gaos/types/interactions/urlcontextresultdelta.py +++ b/google/genai/_gaos/types/interactions/urlcontextresultdelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .urlcontextresult import URLContextResult, URLContextResultParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .urlcontextresult import URLContextResult, URLContextResultParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/urlcontextresultstep.py b/google/genai/_gaos/types/interactions/urlcontextresultstep.py index 063fd2723..08d952ec0 100644 --- a/google/genai/_gaos/types/interactions/urlcontextresultstep.py +++ b/google/genai/_gaos/types/interactions/urlcontextresultstep.py @@ -17,9 +17,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL -from ...utils import validate_const from .urlcontextresult import URLContextResult, URLContextResultParam +from .. import ( + Base64EncodedString, + Base64FileInput, + BaseModel, + UNSET_SENTINEL, +) +from ...utils import validate_const import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/usage.py b/google/genai/_gaos/types/interactions/usage.py index ac1f50880..7d2ef3b4b 100644 --- a/google/genai/_gaos/types/interactions/usage.py +++ b/google/genai/_gaos/types/interactions/usage.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .groundingtoolcount import GroundingToolCount, GroundingToolCountTypedDict from .modalitytokens import ModalityTokens, ModalityTokensTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/interactions/userinputstep.py b/google/genai/_gaos/types/interactions/userinputstep.py index ea84c0d7d..e207227d0 100644 --- a/google/genai/_gaos/types/interactions/userinputstep.py +++ b/google/genai/_gaos/types/interactions/userinputstep.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .content import Content, ContentParam from .. import BaseModel, UNSET_SENTINEL from ...utils import validate_const -from .content import Content, ContentParam import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/interactions/videocontent.py b/google/genai/_gaos/types/interactions/videocontent.py index b92bb7675..5d5bfde8e 100644 --- a/google/genai/_gaos/types/interactions/videocontent.py +++ b/google/genai/_gaos/types/interactions/videocontent.py @@ -17,6 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .mediaprocessing import MediaProcessing, MediaProcessingParam +from .mediaresolution import MediaResolution from .. import ( Base64EncodedString, Base64FileInput, @@ -25,8 +27,6 @@ UnrecognizedStr, ) from ...utils import validate_const -from .mediaprocessing import MediaProcessing, MediaProcessingParam -from .mediaresolution import MediaResolution import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator @@ -34,6 +34,23 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +VideoContentMimeType = Union[ + Literal[ + "video/mp4", + "video/mpeg", + "video/mpg", + "video/mov", + "video/avi", + "video/x-flv", + "video/webm", + "video/wmv", + "video/3gpp", + ], + UnrecognizedStr, +] +r"""The mime type of the video.""" + + ProcessingEnum = Union[ Literal[ "static", @@ -53,36 +70,19 @@ r"""How the model processes this video for understanding.""" -VideoContentMimeType = Union[ - Literal[ - "video/mp4", - "video/mpeg", - "video/mpg", - "video/mov", - "video/avi", - "video/x-flv", - "video/webm", - "video/wmv", - "video/3gpp", - ], - UnrecognizedStr, -] -r"""The mime type of the video.""" - - class VideoContentParam(TypedDict): r"""A video content block.""" data: NotRequired[Union[str, Base64FileInput]] r"""The video content.""" + mime_type: NotRequired[VideoContentMimeType] + r"""The mime type of the video.""" processing: NotRequired[ProcessingParam] r"""How the model processes this video for understanding.""" resolution: NotRequired[MediaResolution] type: Literal["video"] uri: NotRequired[str] r"""The URI of the video.""" - mime_type: NotRequired[VideoContentMimeType] - r"""The mime type of the video.""" class VideoContent(BaseModel): @@ -91,6 +91,9 @@ class VideoContent(BaseModel): data: Optional[Base64EncodedString] = None r"""The video content.""" + mime_type: Optional[VideoContentMimeType] = None + r"""The mime type of the video.""" + processing: Optional[Processing] = None r"""How the model processes this video for understanding.""" @@ -104,12 +107,9 @@ class VideoContent(BaseModel): uri: Optional[str] = None r"""The URI of the video.""" - mime_type: Optional[VideoContentMimeType] = None - r"""The mime type of the video.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "processing", "resolution", "uri", "mime_type"]) + optional_fields = set(["data", "mime_type", "processing", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/videodelta.py b/google/genai/_gaos/types/interactions/videodelta.py index 9a943d5fc..19d727c94 100644 --- a/google/genai/_gaos/types/interactions/videodelta.py +++ b/google/genai/_gaos/types/interactions/videodelta.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .mediaresolution import MediaResolution from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from ...utils import validate_const -from .mediaresolution import MediaResolution import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator diff --git a/google/genai/_gaos/types/security.py b/google/genai/_gaos/types/security.py index b7492fe7a..dc1aef8e1 100644 --- a/google/genai/_gaos/types/security.py +++ b/google/genai/_gaos/types/security.py @@ -26,26 +26,15 @@ class SecurityTypedDict(TypedDict): - api_key: NotRequired[str] - r"""Gemini API key sent as x-goog-api-key.""" access_token: NotRequired[str] r"""OAuth access token sent as a bearer Authorization header.""" + api_key: NotRequired[str] + r"""Gemini API key sent as x-goog-api-key.""" default_headers: NotRequired[Dict[str, str]] r"""Additional default headers to apply before request-specific headers and auth.""" class Security(BaseModel): - api_key: Annotated[ - Optional[str], - pydantic.Field(alias="apiKey"), - FieldMetadata( - security=SecurityMetadata( - scheme=True, scheme_type="http", sub_type="custom", field_name="apiKey" - ) - ), - ] = None - r"""Gemini API key sent as x-goog-api-key.""" - access_token: Annotated[ Optional[str], pydantic.Field(alias="accessToken"), @@ -60,6 +49,17 @@ class Security(BaseModel): ] = None r"""OAuth access token sent as a bearer Authorization header.""" + api_key: Annotated[ + Optional[str], + pydantic.Field(alias="apiKey"), + FieldMetadata( + security=SecurityMetadata( + scheme=True, scheme_type="http", sub_type="custom", field_name="apiKey" + ) + ), + ] = None + r"""Gemini API key sent as x-goog-api-key.""" + default_headers: Annotated[ Optional[Dict[str, str]], pydantic.Field(alias="defaultHeaders"), @@ -76,7 +76,7 @@ class Security(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["apiKey", "accessToken", "defaultHeaders"]) + optional_fields = set(["accessToken", "apiKey", "defaultHeaders"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py b/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py index 7d3064aff..591d13ec9 100644 --- a/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py +++ b/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .triggerexecution import TriggerExecution, TriggerExecutionTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/triggers/listtriggersresponse.py b/google/genai/_gaos/types/triggers/listtriggersresponse.py index b433607e6..6db43fdbc 100644 --- a/google/genai/_gaos/types/triggers/listtriggersresponse.py +++ b/google/genai/_gaos/types/triggers/listtriggersresponse.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .trigger import Trigger, TriggerTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/triggers/trigger.py b/google/genai/_gaos/types/triggers/trigger.py index e2c915168..5c0b71cce 100644 --- a/google/genai/_gaos/types/triggers/trigger.py +++ b/google/genai/_gaos/types/triggers/trigger.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from datetime import datetime from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from ..interactions import interaction as interactions_interaction -from datetime import datetime from pydantic import model_serializer from typing import Literal, Optional, Union from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/triggers/triggercreateparams.py b/google/genai/_gaos/types/triggers/triggercreateparams.py index ef21726fb..0d1aa5c70 100644 --- a/google/genai/_gaos/types/triggers/triggercreateparams.py +++ b/google/genai/_gaos/types/triggers/triggercreateparams.py @@ -50,54 +50,54 @@ class TriggerCreateParamsParam(TypedDict): r"""Parameters for creating a trigger.""" + 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.""" time_zone: str r"""Required. Time zone in which the schedule should be interpreted.""" - interaction: InteractionParam - r"""Required. The interaction request template to be executed.""" display_name: NotRequired[str] r"""Optional. The display name of the trigger.""" environment_id: NotRequired[str] r"""Optional. The environment ID for the trigger execution.""" - max_consecutive_failures: NotRequired[int] - r"""Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR).""" execution_timeout_seconds: NotRequired[int] r"""Optional. The execution timeout for the triggered interaction.""" + max_consecutive_failures: NotRequired[int] + r"""Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR).""" class TriggerCreateParams(BaseModel): r"""Parameters for creating a trigger.""" + interaction: Interaction + 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.""" time_zone: str r"""Required. Time zone in which the schedule should be interpreted.""" - interaction: Interaction - r"""Required. The interaction request template to be executed.""" - display_name: Optional[str] = None r"""Optional. The display name of the trigger.""" environment_id: Optional[str] = None r"""Optional. The environment ID for the trigger execution.""" - max_consecutive_failures: Optional[int] = None - r"""Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR).""" - execution_timeout_seconds: Optional[int] = None r"""Optional. The execution timeout for the triggered interaction.""" + max_consecutive_failures: Optional[int] = None + r"""Optional. The maximum number of consecutive failures allowed before the trigger is automatically paused (status becomes ERROR).""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ "display_name", "environment_id", - "max_consecutive_failures", "execution_timeout_seconds", + "max_consecutive_failures", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/triggers/triggerexecution.py b/google/genai/_gaos/types/triggers/triggerexecution.py index f6f721651..e1d6b2bb3 100644 --- a/google/genai/_gaos/types/triggers/triggerexecution.py +++ b/google/genai/_gaos/types/triggers/triggerexecution.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from datetime import datetime +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import Literal, Optional, Union from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/webhooks/signingsecret.py b/google/genai/_gaos/types/webhooks/signingsecret.py index 9a751d3ec..1d8472e68 100644 --- a/google/genai/_gaos/types/webhooks/signingsecret.py +++ b/google/genai/_gaos/types/webhooks/signingsecret.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from datetime import datetime +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/webhooks/webhook.py b/google/genai/_gaos/types/webhooks/webhook.py index 8239a6383..acff9199c 100644 --- a/google/genai/_gaos/types/webhooks/webhook.py +++ b/google/genai/_gaos/types/webhooks/webhook.py @@ -17,9 +17,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from .signingsecret import SigningSecret, SigningSecretTypedDict from datetime import datetime +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/types/webhooks/webhooklistresponse.py b/google/genai/_gaos/types/webhooks/webhooklistresponse.py index 86d0cefca..06083a5ad 100644 --- a/google/genai/_gaos/types/webhooks/webhooklistresponse.py +++ b/google/genai/_gaos/types/webhooks/webhooklistresponse.py @@ -17,8 +17,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL from .webhook import Webhook, WebhookTypedDict +from .. import BaseModel, UNSET_SENTINEL from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict diff --git a/google/genai/_gaos/utils/security.py b/google/genai/_gaos/utils/security.py index 01c11f875..b4a1b1a6d 100644 --- a/google/genai/_gaos/utils/security.py +++ b/google/genai/_gaos/utils/security.py @@ -92,12 +92,12 @@ def get_security_from_env(security: Any, security_class: Any) -> Optional[BaseMo security_dict: Any = {} - if os.getenv("GOOGLE_GENAI_API_KEY"): - security_dict["api_key"] = os.getenv("GOOGLE_GENAI_API_KEY") - if os.getenv("GOOGLE_GENAI_ACCESS_TOKEN"): security_dict["access_token"] = os.getenv("GOOGLE_GENAI_ACCESS_TOKEN") + if os.getenv("GOOGLE_GENAI_API_KEY"): + security_dict["api_key"] = os.getenv("GOOGLE_GENAI_API_KEY") + if os.getenv("GOOGLE_GENAI_DEFAULT_HEADERS"): security_dict["default_headers"] = os.getenv("GOOGLE_GENAI_DEFAULT_HEADERS") diff --git a/google/genai/_gaos/utils/unmarshal_json_response.py b/google/genai/_gaos/utils/unmarshal_json_response.py index 9c133c36e..ab5d0dc24 100644 --- a/google/genai/_gaos/utils/unmarshal_json_response.py +++ b/google/genai/_gaos/utils/unmarshal_json_response.py @@ -57,7 +57,12 @@ def unmarshal_json_response( return unmarshal_json(body, typ) except Exception as e: if not validate: - return construct_unvalidated(json.loads(body), typ) + try: + decoded = json.loads(body) + except ValueError: + pass + else: + return construct_unvalidated(decoded, typ) raise errors.ResponseValidationError( "Response validation failed", http_res, diff --git a/google/genai/_gaos/webhooks.py b/google/genai/_gaos/webhooks.py index e5939301d..562377f60 100644 --- a/google/genai/_gaos/webhooks.py +++ b/google/genai/_gaos/webhooks.py @@ -16,9 +16,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +from .basesdk import AsyncBaseSDK, BaseSDK from . import errors, models, types, utils from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK from .types import OptionalNullable, UNSET, interactions, webhooks from .types.webhooks import ( pingwebhookrequest as webhooks_pingwebhookrequest, @@ -41,6 +41,162 @@ def with_raw_response(self): def with_streaming_response(self): return WebhooksWithStreamingResponse(self) + def list( + self, + *, + api_version: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ) -> webhooks.WebhookListResponse: + r"""Lists all Webhooks. + + :param api_version: Which version of the API to use. + :param page_size: Optional. The maximum number of webhooks to return. The service may return fewer than + this value. If unspecified, at most 50 webhooks will be returned. + The maximum value is 1000. + :param page_token: Optional. A page token, received from a previous `ListWebhooks` call. + Provide this to retrieve the subsequent page. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + base_url = None + url_variables = None + retries: OptionalNullable[utils.RetryConfig] = UNSET + server_url = None + http_headers = extra_headers + timeout_ms = self._coerce_timeout_ms(timeout) + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.ListWebhooksRequest( + api_version=api_version, + page_size=page_size, + page_token=page_token, + ) + + _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( + http_headers + ) + req = self._build_request( + method="GET", + path="/{api_version}/webhooks", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + extra_query_params=extra_query, + _globals=models.ListWebhooksGlobals( + api_version=self.sdk_configuration.globals.api_version, + ), + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "attempt-count-backoff", + utils.BackoffStrategy(500, 8000, 2, 30000), + True, + max_retries=4, + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "409", "429", "5XX"]) + + def _speakeasy_parse_response(http_res): + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GenAiDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GenAiDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "default", "application/json"): + return unmarshal_json_response( + webhooks.WebhookListResponse, http_res, validate=False + ) + + raise errors.GenAiDefaultError("Unexpected response received", http_res) + + _speakeasy_hook_ctx = HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="ListWebhooks", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, types.Security + ), + tags=None, + extensions=None, + response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), + ) + http_res = self.do_request( + hook_ctx=_speakeasy_hook_ctx, + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + stream=_speakeasy_response_mode == "streaming", + retry_config=retry_config, + ) + if _speakeasy_response_mode != "parsed": + if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): + http_res.read() + try: + _speakeasy_parse_response(http_res) + except Exception as parse_exc_: + response_helpers.raise_parse_error( + self.sdk_configuration.__dict__["_hooks"], + AfterParseErrorContext(_speakeasy_hook_ctx), + http_res, + parse_exc_, + ) + _speakeasy_response_cls = ( + response_helpers.StreamedAPIResponse + if _speakeasy_response_mode == "streaming" + else response_helpers.APIResponse + ) + return cast( + Any, + _speakeasy_response_cls( + raw=http_res, + parser=_speakeasy_parse_response, + mode="buffered", + client_ref=self, + hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), + hooks=self.sdk_configuration.__dict__.get("_hooks"), + ), + ) + try: + return _speakeasy_parse_response(http_res) + except Exception as parse_exc_: + response_helpers.raise_parse_error( + self.sdk_configuration.__dict__["_hooks"], + AfterParseErrorContext(_speakeasy_hook_ctx), + http_res, + parse_exc_, + ) + def create( self, *, @@ -219,24 +375,20 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def list( + def delete( self, + id: str, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> webhooks.WebhookListResponse: - r"""Lists all Webhooks. + ) -> interactions.Empty: + r"""Deletes a Webhook. + :param id: Required. The ID of the webhook to delete. + Format: `{webhook_id}` :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of webhooks to return. The service may return fewer than - this value. If unspecified, at most 50 webhooks will be returned. - The maximum value is 1000. - :param page_token: Optional. A page token, received from a previous `ListWebhooks` call. - Provide this to retrieve the subsequent page. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -255,18 +407,17 @@ def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListWebhooksRequest( + request = models.DeleteWebhookRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, + id=id, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="GET", - path="/{api_version}/webhooks", + method="DELETE", + path="/{api_version}/webhooks/{id}", base_url=base_url, url_variables=url_variables, request=request, @@ -277,7 +428,7 @@ def list( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListWebhooksGlobals( + _globals=models.DeleteWebhookGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -313,7 +464,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - webhooks.WebhookListResponse, http_res, validate=False + interactions.Empty, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -321,7 +472,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListWebhooks", + operation_id="DeleteWebhook", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -715,22 +866,31 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def delete( + def ping( self, id: str, *, api_version: Optional[str] = None, + body: Optional[ + Union[ + webhooks_pingwebhookrequest.PingWebhookRequest, + webhooks_pingwebhookrequest.PingWebhookRequestParam, + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a Webhook. + ) -> webhooks.WebhookPingResponse: + r"""Sends a ping event to a Webhook. - :param id: Required. The ID of the webhook to delete. + :param id: Required. The ID of the webhook to ping. Format: `{webhook_id}` :param api_version: Which version of the API to use. + :param body: The request body. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -747,17 +907,18 @@ def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteWebhookRequest( + request = models.PingWebhookRequest( api_version=api_version, id=id, + body=utils.get_pydantic_model(body, Optional[webhooks.PingWebhookRequest]), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request( - method="DELETE", - path="/{api_version}/webhooks/{id}", + method="POST", + path="/{api_version}/webhooks/{id}:ping", base_url=base_url, url_variables=url_variables, request=request, @@ -768,10 +929,18 @@ def delete( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteWebhookGlobals( + _globals=models.PingWebhookGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body if request is not None else None, + False, + True, + "json", + Optional[webhooks.PingWebhookRequest], + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -804,7 +973,7 @@ def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + webhooks.WebhookPingResponse, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -812,7 +981,7 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteWebhook", + operation_id="PingWebhook", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1036,36 +1205,87 @@ def _speakeasy_parse_response(http_res): parse_exc_, ) - def ping( - self, - id: str, - *, - api_version: Optional[str] = None, - body: Optional[ - Union[ - webhooks_pingwebhookrequest.PingWebhookRequest, - webhooks_pingwebhookrequest.PingWebhookRequestParam, - ] - ] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> webhooks.WebhookPingResponse: - r"""Sends a ping event to a Webhook. - :param id: Required. The ID of the webhook to ping. - Format: `{webhook_id}` - :param api_version: Which version of the API to use. - :param body: The request body. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET +class WebhooksWithRawResponse: + def __init__(self, sdk: Webhooks) -> None: + self._sdk = sdk + self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") + self.create = response_helpers.to_raw_response_wrapper( + sdk.create, "extra_headers" + ) + self.delete = response_helpers.to_raw_response_wrapper( + sdk.delete, "extra_headers" + ) + self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") + self.update = response_helpers.to_raw_response_wrapper( + sdk.update, "extra_headers" + ) + self.ping = response_helpers.to_raw_response_wrapper(sdk.ping, "extra_headers") + self.rotate_signing_secret = response_helpers.to_raw_response_wrapper( + sdk.rotate_signing_secret, "extra_headers" + ) + + +class WebhooksWithStreamingResponse: + def __init__(self, sdk: Webhooks) -> None: + self._sdk = sdk + self.list = response_helpers.to_streamed_response_wrapper( + sdk.list, "extra_headers" + ) + self.create = response_helpers.to_streamed_response_wrapper( + sdk.create, "extra_headers" + ) + self.delete = response_helpers.to_streamed_response_wrapper( + sdk.delete, "extra_headers" + ) + self.get = response_helpers.to_streamed_response_wrapper( + sdk.get, "extra_headers" + ) + self.update = response_helpers.to_streamed_response_wrapper( + sdk.update, "extra_headers" + ) + self.ping = response_helpers.to_streamed_response_wrapper( + sdk.ping, "extra_headers" + ) + self.rotate_signing_secret = response_helpers.to_streamed_response_wrapper( + sdk.rotate_signing_secret, "extra_headers" + ) + + +class AsyncWebhooks(AsyncBaseSDK): + @property + def with_raw_response(self): + return AsyncWebhooksWithRawResponse(self) + + @property + def with_streaming_response(self): + return AsyncWebhooksWithStreamingResponse(self) + + async def list( + self, + *, + api_version: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + extra_headers: Optional[Mapping[str, str]] = None, + extra_query: Optional[Mapping[str, Any]] = None, + timeout: Optional[Union[float, httpx.Timeout]] = None, + ) -> webhooks.WebhookListResponse: + r"""Lists all Webhooks. + + :param api_version: Which version of the API to use. + :param page_size: Optional. The maximum number of webhooks to return. The service may return fewer than + this value. If unspecified, at most 50 webhooks will be returned. + The maximum value is 1000. + :param page_token: Optional. A page token, received from a previous `ListWebhooks` call. + Provide this to retrieve the subsequent page. + :param extra_headers: Additional headers to set or replace on requests. + :param extra_query: Additional query parameters to append to requests. + :param timeout: Override the default request timeout configuration for this method in seconds + """ + base_url = None + url_variables = None + retries: OptionalNullable[utils.RetryConfig] = UNSET server_url = None http_headers = extra_headers timeout_ms = self._coerce_timeout_ms(timeout) @@ -1077,18 +1297,18 @@ def ping( else: base_url = self._get_url(base_url, url_variables) - request = models.PingWebhookRequest( + request = models.ListWebhooksRequest( api_version=api_version, - id=id, - body=utils.get_pydantic_model(body, Optional[webhooks.PingWebhookRequest]), + page_size=page_size, + page_token=page_token, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) - req = self._build_request( - method="POST", - path="/{api_version}/webhooks/{id}:ping", + req = self._build_request_async( + method="GET", + path="/{api_version}/webhooks", base_url=base_url, url_variables=url_variables, request=request, @@ -1099,18 +1319,10 @@ def ping( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.PingWebhookGlobals( + _globals=models.ListWebhooksGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body if request is not None else None, - False, - True, - "json", - Optional[webhooks.PingWebhookRequest], - extra_body=extra_body, - ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -1130,20 +1342,20 @@ def ping( if isinstance(retries, utils.RetryConfig): retry_config = (retries, ["408", "409", "429", "5XX"]) - def _speakeasy_parse_response(http_res): + async def _speakeasy_parse_response(http_res): if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) + http_res_text = await utils.stream_to_text_async(http_res) raise errors.GenAiDefaultError( "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) + http_res_text = await utils.stream_to_text_async(http_res) raise errors.GenAiDefaultError( "API error occurred", http_res, http_res_text ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - webhooks.WebhookPingResponse, http_res, validate=False + webhooks.WebhookListResponse, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -1151,16 +1363,16 @@ def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="PingWebhook", + operation_id="ListWebhooks", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security ), tags=None, extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), + response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), ) - http_res = self.do_request( + http_res = await self.do_request_async( hook_ctx=_speakeasy_hook_ctx, request=req, is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), @@ -1169,20 +1381,21 @@ def _speakeasy_parse_response(http_res): ) if _speakeasy_response_mode != "parsed": if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() + await http_res.aread() try: - _speakeasy_parse_response(http_res) + await _speakeasy_parse_response(http_res) except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], + await response_helpers.raise_parse_error_async( + self.sdk_configuration.__dict__.get("_async_hooks"), + self.sdk_configuration.__dict__.get("_hooks"), AfterParseErrorContext(_speakeasy_hook_ctx), http_res, parse_exc_, ) _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse + response_helpers.AsyncStreamedAPIResponse if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse + else response_helpers.AsyncAPIResponse ) return cast( Any, @@ -1193,74 +1406,20 @@ def _speakeasy_parse_response(http_res): client_ref=self, hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), hooks=self.sdk_configuration.__dict__.get("_hooks"), + async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), ), ) try: - return _speakeasy_parse_response(http_res) + return await _speakeasy_parse_response(http_res) except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], + await response_helpers.raise_parse_error_async( + self.sdk_configuration.__dict__.get("_async_hooks"), + self.sdk_configuration.__dict__.get("_hooks"), AfterParseErrorContext(_speakeasy_hook_ctx), http_res, parse_exc_, ) - -class WebhooksWithRawResponse: - def __init__(self, sdk: Webhooks) -> None: - self._sdk = sdk - self.create = response_helpers.to_raw_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") - self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") - self.update = response_helpers.to_raw_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.rotate_signing_secret = response_helpers.to_raw_response_wrapper( - sdk.rotate_signing_secret, "extra_headers" - ) - self.ping = response_helpers.to_raw_response_wrapper(sdk.ping, "extra_headers") - - -class WebhooksWithStreamingResponse: - def __init__(self, sdk: Webhooks) -> None: - self._sdk = sdk - self.create = response_helpers.to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.to_streamed_response_wrapper( - sdk.list, "extra_headers" - ) - self.get = response_helpers.to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.to_streamed_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.to_streamed_response_wrapper( - sdk.delete, "extra_headers" - ) - self.rotate_signing_secret = response_helpers.to_streamed_response_wrapper( - sdk.rotate_signing_secret, "extra_headers" - ) - self.ping = response_helpers.to_streamed_response_wrapper( - sdk.ping, "extra_headers" - ) - - -class AsyncWebhooks(AsyncBaseSDK): - @property - def with_raw_response(self): - return AsyncWebhooksWithRawResponse(self) - - @property - def with_streaming_response(self): - return AsyncWebhooksWithStreamingResponse(self) - async def create( self, *, @@ -1442,24 +1601,20 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def list( + async def delete( self, + id: str, *, api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> webhooks.WebhookListResponse: - r"""Lists all Webhooks. + ) -> interactions.Empty: + r"""Deletes a Webhook. + :param id: Required. The ID of the webhook to delete. + Format: `{webhook_id}` :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of webhooks to return. The service may return fewer than - this value. If unspecified, at most 50 webhooks will be returned. - The maximum value is 1000. - :param page_token: Optional. A page token, received from a previous `ListWebhooks` call. - Provide this to retrieve the subsequent page. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param timeout: Override the default request timeout configuration for this method in seconds @@ -1478,18 +1633,17 @@ async def list( else: base_url = self._get_url(base_url, url_variables) - request = models.ListWebhooksRequest( + request = models.DeleteWebhookRequest( api_version=api_version, - page_size=page_size, - page_token=page_token, + id=id, ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="GET", - path="/{api_version}/webhooks", + method="DELETE", + path="/{api_version}/webhooks/{id}", base_url=base_url, url_variables=url_variables, request=request, @@ -1500,7 +1654,7 @@ async def list( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.ListWebhooksGlobals( + _globals=models.DeleteWebhookGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, @@ -1536,7 +1690,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - webhooks.WebhookListResponse, http_res, validate=False + interactions.Empty, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -1544,7 +1698,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="ListWebhooks", + operation_id="DeleteWebhook", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -1947,22 +2101,31 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def delete( + async def ping( self, id: str, *, api_version: Optional[str] = None, + body: Optional[ + Union[ + webhooks_pingwebhookrequest.PingWebhookRequest, + webhooks_pingwebhookrequest.PingWebhookRequestParam, + ] + ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, + extra_body: Optional[Mapping[str, Any]] = None, timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a Webhook. + ) -> webhooks.WebhookPingResponse: + r"""Sends a ping event to a Webhook. - :param id: Required. The ID of the webhook to delete. + :param id: Required. The ID of the webhook to ping. Format: `{webhook_id}` :param api_version: Which version of the API to use. + :param body: The request body. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. + :param extra_body: Additional JSON object fields to merge into request bodies. :param timeout: Override the default request timeout configuration for this method in seconds """ base_url = None @@ -1979,17 +2142,18 @@ async def delete( else: base_url = self._get_url(base_url, url_variables) - request = models.DeleteWebhookRequest( + request = models.PingWebhookRequest( api_version=api_version, id=id, + body=utils.get_pydantic_model(body, Optional[webhooks.PingWebhookRequest]), ) _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( http_headers ) req = self._build_request_async( - method="DELETE", - path="/{api_version}/webhooks/{id}", + method="POST", + path="/{api_version}/webhooks/{id}:ping", base_url=base_url, url_variables=url_variables, request=request, @@ -2000,10 +2164,18 @@ async def delete( accept_header_value="application/json", http_headers=http_headers, extra_query_params=extra_query, - _globals=models.DeleteWebhookGlobals( + _globals=models.PingWebhookGlobals( api_version=self.sdk_configuration.globals.api_version, ), security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.body if request is not None else None, + False, + True, + "json", + Optional[webhooks.PingWebhookRequest], + extra_body=extra_body, + ), allow_empty_value=None, timeout_ms=timeout_ms, ) @@ -2036,7 +2208,7 @@ async def _speakeasy_parse_response(http_res): ) if utils.match_response(http_res, "default", "application/json"): return unmarshal_json_response( - interactions.Empty, http_res, validate=False + webhooks.WebhookPingResponse, http_res, validate=False ) raise errors.GenAiDefaultError("Unexpected response received", http_res) @@ -2044,7 +2216,7 @@ async def _speakeasy_parse_response(http_res): _speakeasy_hook_ctx = HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="DeleteWebhook", + operation_id="PingWebhook", oauth2_scopes=None, security_source=get_security_from_env( self.sdk_configuration.security, types.Security @@ -2274,187 +2446,18 @@ async def _speakeasy_parse_response(http_res): parse_exc_, ) - async def ping( - self, - id: str, - *, - api_version: Optional[str] = None, - body: Optional[ - Union[ - webhooks_pingwebhookrequest.PingWebhookRequest, - webhooks_pingwebhookrequest.PingWebhookRequestParam, - ] - ] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> webhooks.WebhookPingResponse: - r"""Sends a ping event to a Webhook. - - :param id: Required. The ID of the webhook to ping. - Format: `{webhook_id}` - :param api_version: Which version of the API to use. - :param body: The request body. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.PingWebhookRequest( - api_version=api_version, - id=id, - body=utils.get_pydantic_model(body, Optional[webhooks.PingWebhookRequest]), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="POST", - path="/{api_version}/webhooks/{id}:ping", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.PingWebhookGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body if request is not None else None, - False, - True, - "json", - Optional[webhooks.PingWebhookRequest], - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - webhooks.WebhookPingResponse, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="PingWebhook", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - class AsyncWebhooksWithRawResponse: def __init__(self, sdk: AsyncWebhooks) -> None: self._sdk = sdk + self.list = response_helpers.async_to_raw_response_wrapper( + sdk.list, "extra_headers" + ) self.create = response_helpers.async_to_raw_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.async_to_raw_response_wrapper( - sdk.list, "extra_headers" + self.delete = response_helpers.async_to_raw_response_wrapper( + sdk.delete, "extra_headers" ) self.get = response_helpers.async_to_raw_response_wrapper( sdk.get, "extra_headers" @@ -2462,25 +2465,25 @@ def __init__(self, sdk: AsyncWebhooks) -> None: self.update = response_helpers.async_to_raw_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.async_to_raw_response_wrapper( - sdk.delete, "extra_headers" + self.ping = response_helpers.async_to_raw_response_wrapper( + sdk.ping, "extra_headers" ) self.rotate_signing_secret = response_helpers.async_to_raw_response_wrapper( sdk.rotate_signing_secret, "extra_headers" ) - self.ping = response_helpers.async_to_raw_response_wrapper( - sdk.ping, "extra_headers" - ) class AsyncWebhooksWithStreamingResponse: def __init__(self, sdk: AsyncWebhooks) -> None: self._sdk = sdk + self.list = response_helpers.async_to_streamed_response_wrapper( + sdk.list, "extra_headers" + ) self.create = response_helpers.async_to_streamed_response_wrapper( sdk.create, "extra_headers" ) - self.list = response_helpers.async_to_streamed_response_wrapper( - sdk.list, "extra_headers" + self.delete = response_helpers.async_to_streamed_response_wrapper( + sdk.delete, "extra_headers" ) self.get = response_helpers.async_to_streamed_response_wrapper( sdk.get, "extra_headers" @@ -2488,14 +2491,11 @@ def __init__(self, sdk: AsyncWebhooks) -> None: self.update = response_helpers.async_to_streamed_response_wrapper( sdk.update, "extra_headers" ) - self.delete = response_helpers.async_to_streamed_response_wrapper( - sdk.delete, "extra_headers" + self.ping = response_helpers.async_to_streamed_response_wrapper( + sdk.ping, "extra_headers" ) self.rotate_signing_secret = ( response_helpers.async_to_streamed_response_wrapper( sdk.rotate_signing_secret, "extra_headers" ) ) - self.ping = response_helpers.async_to_streamed_response_wrapper( - sdk.ping, "extra_headers" - )