Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.3.0"
".": "1.3.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-633d84454335d704b205b7d730bcda184c858f96c36cf27b5ecf786a5bff7f42.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-3c7443a5e05ad4ade2ac36325d1def05cb3842bb53a180fc76feb565ea875cc7.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.3.1 (2025-03-11)

Full Changelog: [v1.3.0...v1.3.1](https://github.com/ArcadeAI/arcade-py/compare/v1.3.0...v1.3.1)

### Features

* **api:** api update ([#125](https://github.com/ArcadeAI/arcade-py/issues/125)) ([38ad010](https://github.com/ArcadeAI/arcade-py/commit/38ad01058bf4ffb679b5e9d7e0cad68960336a4d))

## 1.3.0 (2025-03-10)

Full Changelog: [v1.2.1...v1.3.0](https://github.com/ArcadeAI/arcade-py/compare/v1.2.1...v1.3.0)
Expand Down
3 changes: 1 addition & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ from arcadepy.types import (
UpdateWorkerRequest,
WorkerHealthResponse,
WorkerResponse,
WorkerToolsResponse,
)
```

Expand All @@ -114,4 +113,4 @@ Methods:
- <code title="delete /v1/workers/{id}">client.workers.<a href="./src/arcadepy/resources/workers.py">delete</a>(id) -> None</code>
- <code title="get /v1/workers/{id}">client.workers.<a href="./src/arcadepy/resources/workers.py">get</a>(id) -> <a href="./src/arcadepy/types/worker_response.py">WorkerResponse</a></code>
- <code title="get /v1/workers/{id}/health">client.workers.<a href="./src/arcadepy/resources/workers.py">health</a>(id) -> <a href="./src/arcadepy/types/worker_health_response.py">WorkerHealthResponse</a></code>
- <code title="get /v1/workers/{id}/tools">client.workers.<a href="./src/arcadepy/resources/workers.py">tools</a>(id) -> <a href="./src/arcadepy/types/worker_tools_response.py">WorkerToolsResponse</a></code>
- <code title="get /v1/workers/{id}/tools">client.workers.<a href="./src/arcadepy/resources/workers.py">tools</a>(id, \*\*<a href="src/arcadepy/types/worker_tools_params.py">params</a>) -> <a href="./src/arcadepy/types/tool_definition.py">SyncOffsetPage[ToolDefinition]</a></code>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "arcadepy"
version = "1.3.0"
version = "1.3.1"
description = "The official Python library for the Arcade API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/arcadepy/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "arcadepy"
__version__ = "1.3.0" # x-release-please-version
__version__ = "1.3.1" # x-release-please-version
56 changes: 45 additions & 11 deletions src/arcadepy/resources/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import httpx

from ..types import worker_list_params, worker_create_params, worker_update_params
from ..types import worker_list_params, worker_tools_params, worker_create_params, worker_update_params
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from .._utils import (
maybe_transform,
Expand All @@ -20,8 +20,8 @@
)
from ..pagination import SyncOffsetPage, AsyncOffsetPage
from .._base_client import AsyncPaginator, make_request_options
from ..types.tool_definition import ToolDefinition
from ..types.worker_response import WorkerResponse
from ..types.worker_tools_response import WorkerToolsResponse
from ..types.worker_health_response import WorkerHealthResponse

__all__ = ["WorkersResource", "AsyncWorkersResource"]
Expand Down Expand Up @@ -281,17 +281,23 @@ def tools(
self,
id: str,
*,
limit: int | NotGiven = NOT_GIVEN,
offset: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> WorkerToolsResponse:
) -> SyncOffsetPage[ToolDefinition]:
"""
Returns a page of tools

Args:
limit: Number of items to return (default: 25, max: 100)

offset: Offset from the start of the list (default: 0)

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -302,12 +308,23 @@ def tools(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._get(
return self._get_api_list(
f"/v1/workers/{id}/tools",
page=SyncOffsetPage[ToolDefinition],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"limit": limit,
"offset": offset,
},
worker_tools_params.WorkerToolsParams,
),
),
cast_to=WorkerToolsResponse,
model=ToolDefinition,
)


Expand Down Expand Up @@ -561,21 +578,27 @@ async def health(
cast_to=WorkerHealthResponse,
)

async def tools(
def tools(
self,
id: str,
*,
limit: int | NotGiven = NOT_GIVEN,
offset: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> WorkerToolsResponse:
) -> AsyncPaginator[ToolDefinition, AsyncOffsetPage[ToolDefinition]]:
"""
Returns a page of tools

Args:
limit: Number of items to return (default: 25, max: 100)

offset: Offset from the start of the list (default: 0)

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -586,12 +609,23 @@ async def tools(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._get(
return self._get_api_list(
f"/v1/workers/{id}/tools",
page=AsyncOffsetPage[ToolDefinition],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"limit": limit,
"offset": offset,
},
worker_tools_params.WorkerToolsParams,
),
),
cast_to=WorkerToolsResponse,
model=ToolDefinition,
)


Expand Down
2 changes: 1 addition & 1 deletion src/arcadepy/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
from .chat_message_param import ChatMessageParam as ChatMessageParam
from .worker_list_params import WorkerListParams as WorkerListParams
from .tool_execute_params import ToolExecuteParams as ToolExecuteParams
from .worker_tools_params import WorkerToolsParams as WorkerToolsParams
from .worker_create_params import WorkerCreateParams as WorkerCreateParams
from .worker_update_params import WorkerUpdateParams as WorkerUpdateParams
from .auth_authorize_params import AuthAuthorizeParams as AuthAuthorizeParams
from .execute_tool_response import ExecuteToolResponse as ExecuteToolResponse
from .tool_authorize_params import ToolAuthorizeParams as ToolAuthorizeParams
from .worker_tools_response import WorkerToolsResponse as WorkerToolsResponse
from .tool_execution_attempt import ToolExecutionAttempt as ToolExecutionAttempt
from .worker_health_response import WorkerHealthResponse as WorkerHealthResponse
15 changes: 15 additions & 0 deletions src/arcadepy/types/worker_tools_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

__all__ = ["WorkerToolsParams"]


class WorkerToolsParams(TypedDict, total=False):
limit: int
"""Number of items to return (default: 25, max: 100)"""

offset: int
"""Offset from the start of the list (default: 0)"""
20 changes: 0 additions & 20 deletions src/arcadepy/types/worker_tools_response.py

This file was deleted.

48 changes: 33 additions & 15 deletions tests/api_resources/test_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from arcadepy import Arcade, AsyncArcade
from tests.utils import assert_matches_type
from arcadepy.types import (
ToolDefinition,
WorkerResponse,
WorkerToolsResponse,
WorkerHealthResponse,
)
from arcadepy.pagination import SyncOffsetPage, AsyncOffsetPage
Expand Down Expand Up @@ -272,39 +272,48 @@ def test_path_params_health(self, client: Arcade) -> None:
@parametrize
def test_method_tools(self, client: Arcade) -> None:
worker = client.workers.tools(
"id",
id="id",
)
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(SyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
def test_method_tools_with_all_params(self, client: Arcade) -> None:
worker = client.workers.tools(
id="id",
limit=0,
offset=0,
)
assert_matches_type(SyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
def test_raw_response_tools(self, client: Arcade) -> None:
response = client.workers.with_raw_response.tools(
"id",
id="id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
worker = response.parse()
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(SyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
def test_streaming_response_tools(self, client: Arcade) -> None:
with client.workers.with_streaming_response.tools(
"id",
id="id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

worker = response.parse()
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(SyncOffsetPage[ToolDefinition], worker, path=["response"])

assert cast(Any, response.is_closed) is True

@parametrize
def test_path_params_tools(self, client: Arcade) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
client.workers.with_raw_response.tools(
"",
id="",
)


Expand Down Expand Up @@ -561,37 +570,46 @@ async def test_path_params_health(self, async_client: AsyncArcade) -> None:
@parametrize
async def test_method_tools(self, async_client: AsyncArcade) -> None:
worker = await async_client.workers.tools(
"id",
id="id",
)
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(AsyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
async def test_method_tools_with_all_params(self, async_client: AsyncArcade) -> None:
worker = await async_client.workers.tools(
id="id",
limit=0,
offset=0,
)
assert_matches_type(AsyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
async def test_raw_response_tools(self, async_client: AsyncArcade) -> None:
response = await async_client.workers.with_raw_response.tools(
"id",
id="id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
worker = await response.parse()
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(AsyncOffsetPage[ToolDefinition], worker, path=["response"])

@parametrize
async def test_streaming_response_tools(self, async_client: AsyncArcade) -> None:
async with async_client.workers.with_streaming_response.tools(
"id",
id="id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

worker = await response.parse()
assert_matches_type(WorkerToolsResponse, worker, path=["response"])
assert_matches_type(AsyncOffsetPage[ToolDefinition], worker, path=["response"])

assert cast(Any, response.is_closed) is True

@parametrize
async def test_path_params_tools(self, async_client: AsyncArcade) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
await async_client.workers.with_raw_response.tools(
"",
id="",
)