From ab91686ad4842919bccdc152312412281e49281c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:12:24 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- src/rizaio/resources/tools.py | 46 +++++++++++++++++++++++--- src/rizaio/types/tool.py | 15 +++++++++ src/rizaio/types/tool_create_params.py | 9 +++++ src/rizaio/types/tool_exec_params.py | 8 +++++ src/rizaio/types/tool_exec_response.py | 14 ++++++-- 6 files changed, 87 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4233cb0..bd7cda9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/riza%2Friza-api-32ef22a311a9e34999c31107dc130386b25a8a3931abc1829e8f18d04f092596.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/riza%2Friza-api-907d0af9f0bae60664d75eb1df4afebdde7c7690d8373520101c4ec324e866c8.yml diff --git a/src/rizaio/resources/tools.py b/src/rizaio/resources/tools.py index f6baeed..e6e5ca3 100644 --- a/src/rizaio/resources/tools.py +++ b/src/rizaio/resources/tools.py @@ -64,10 +64,21 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Tool: - """ - Create a tool in your project. + """Create a tool in your project. Args: + code: The code of the tool. + + You must define a function named "execute" that takes in a + single argument and returns a JSON-serializable value. The argument will be the + "input" passed when executing the tool, and will match the input schema. + + language: The language of the tool's code. + + name: The name of the tool. + + description: A description of the tool. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -182,6 +193,14 @@ def exec( input schema. Args: + env: Set of key-value pairs to add to the tool's execution environment. + + http: Configuration for HTTP requests and authentication. + + revision_id: The Tool revision ID to execute. This optional parmeter is used to pin + executions to specific versions of the Tool. If not provided, the latest + (current) version of the Tool will be executed. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -278,10 +297,21 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Tool: - """ - Create a tool in your project. + """Create a tool in your project. Args: + code: The code of the tool. + + You must define a function named "execute" that takes in a + single argument and returns a JSON-serializable value. The argument will be the + "input" passed when executing the tool, and will match the input schema. + + language: The language of the tool's code. + + name: The name of the tool. + + description: A description of the tool. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -396,6 +426,14 @@ async def exec( input schema. Args: + env: Set of key-value pairs to add to the tool's execution environment. + + http: Configuration for HTTP requests and authentication. + + revision_id: The Tool revision ID to execute. This optional parmeter is used to pin + executions to specific versions of the Tool. If not provided, the latest + (current) version of the Tool will be executed. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/rizaio/types/tool.py b/src/rizaio/types/tool.py index 65d586f..a7efd19 100644 --- a/src/rizaio/types/tool.py +++ b/src/rizaio/types/tool.py @@ -9,15 +9,30 @@ class Tool(BaseModel): id: str + """The ID of the tool.""" code: str + """The code of the tool. + + You must define a function named "execute" that takes in a single argument and + returns a JSON-serializable value. The argument will be the "input" passed when + executing the tool, and will match the input schema. + """ description: str + """A description of the tool.""" input_schema: object language: Literal["python", "javascript", "typescript"] + """The language of the tool's code.""" name: str + """The name of the tool.""" revision_id: str + """The ID of the tool's current revision. + + This is used to pin executions to specific versions of the Tool, even if the + Tool is updated later. + """ diff --git a/src/rizaio/types/tool_create_params.py b/src/rizaio/types/tool_create_params.py index e086846..5835741 100644 --- a/src/rizaio/types/tool_create_params.py +++ b/src/rizaio/types/tool_create_params.py @@ -9,11 +9,20 @@ class ToolCreateParams(TypedDict, total=False): code: Required[str] + """The code of the tool. + + You must define a function named "execute" that takes in a single argument and + returns a JSON-serializable value. The argument will be the "input" passed when + executing the tool, and will match the input schema. + """ language: Required[Literal["python", "javascript", "typescript"]] + """The language of the tool's code.""" name: Required[str] + """The name of the tool.""" description: str + """A description of the tool.""" input_schema: object diff --git a/src/rizaio/types/tool_exec_params.py b/src/rizaio/types/tool_exec_params.py index b499457..a04e6ec 100644 --- a/src/rizaio/types/tool_exec_params.py +++ b/src/rizaio/types/tool_exec_params.py @@ -19,12 +19,20 @@ class ToolExecParams(TypedDict, total=False): env: Iterable[Env] + """Set of key-value pairs to add to the tool's execution environment.""" http: Optional[HTTP] + """Configuration for HTTP requests and authentication.""" input: object revision_id: str + """The Tool revision ID to execute. + + This optional parmeter is used to pin executions to specific versions of the + Tool. If not provided, the latest (current) version of the Tool will be + executed. + """ class Env(TypedDict, total=False): diff --git a/src/rizaio/types/tool_exec_response.py b/src/rizaio/types/tool_exec_response.py index 9a70b43..4614497 100644 --- a/src/rizaio/types/tool_exec_response.py +++ b/src/rizaio/types/tool_exec_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing_extensions import Literal from .._models import BaseModel @@ -17,5 +17,15 @@ class Execution(BaseModel): class ToolExecResponse(BaseModel): execution: Execution + """The execution details of the Tool.""" - output: Optional[object] = None + output: object + + output_status: Literal["error", "json_serialization_error", "valid"] + """The status of the output. + + "valid" means your Tool executed successfully and returned a valid + JSON-serializable object, or void. "json_serialization_error" means your Tool + executed successfully, but returned a nonserializable object. "error" means your + Tool failed to execute. + """