Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): api update #121

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 42 additions & 4 deletions src/rizaio/resources/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/rizaio/types/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
9 changes: 9 additions & 0 deletions src/rizaio/types/tool_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions src/rizaio/types/tool_exec_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 12 additions & 2 deletions src/rizaio/types/tool_exec_response.py
Original file line number Diff line number Diff line change
@@ -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

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