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.1.1"
".": "1.2.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 12
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-e8018130b37ed5edd723ea7d399d3db7d0b6e0d65962414da07ed981e960bcb3.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-32b8e3b9f33faf15b95ab7ece843b8d2b42af9f11b7afcccb244ef4600f72b2b.yml
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 1.2.0 (2025-02-21)

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

### Features

* **api:** api update ([#105](https://github.com/ArcadeAI/arcade-py/issues/105)) ([7ed533f](https://github.com/ArcadeAI/arcade-py/commit/7ed533fca689340285fe5b194efd5b0f233e3bd4))
* **api:** api update ([#108](https://github.com/ArcadeAI/arcade-py/issues/108)) ([ba6ddc9](https://github.com/ArcadeAI/arcade-py/commit/ba6ddc9d5d7d94fbf7764aff94b5fd8a6c28e7fa))
* **client:** allow passing `NotGiven` for body ([#109](https://github.com/ArcadeAI/arcade-py/issues/109)) ([920d114](https://github.com/ArcadeAI/arcade-py/commit/920d114c56a7d31ef0914b6bff37d4928240622a))


### Bug Fixes

* asyncify on non-asyncio runtimes ([#107](https://github.com/ArcadeAI/arcade-py/issues/107)) ([3252ac3](https://github.com/ArcadeAI/arcade-py/commit/3252ac3b2af698fd007f045e45097e858842b575))
* **client:** mark some request bodies as optional ([920d114](https://github.com/ArcadeAI/arcade-py/commit/920d114c56a7d31ef0914b6bff37d4928240622a))

## 1.1.1 (2025-02-13)

Full Changelog: [v1.1.0...v1.1.1](https://github.com/ArcadeAI/arcade-py/compare/v1.1.0...v1.1.1)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ try:
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
],
)
Expand Down Expand Up @@ -151,7 +151,7 @@ client.with_options(max_retries=5).chat.completions.create(
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
],
)
Expand Down Expand Up @@ -181,7 +181,7 @@ client.with_options(timeout=5.0).chat.completions.create(
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
],
)
Expand Down Expand Up @@ -228,7 +228,7 @@ client = Arcade()
response = client.chat.completions.with_raw_response.create(
messages=[{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}],
)
print(response.headers.get('X-My-Header'))
Expand All @@ -252,7 +252,7 @@ with client.chat.completions.with_streaming_response.create(
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
],
) as response:
Expand Down
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.1.1"
version = "1.2.0"
description = "The official Python library for the Arcade API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/arcadepy/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)
Expand Down
19 changes: 17 additions & 2 deletions src/arcadepy/_utils/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec

import anyio
import sniffio
import anyio.to_thread

T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec")


if sys.version_info >= (3, 9):
to_thread = asyncio.to_thread
_asyncio_to_thread = asyncio.to_thread
else:
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
# for Python 3.8 support
async def to_thread(
async def _asyncio_to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> Any:
"""Asynchronously run function *func* in a separate thread.
Expand All @@ -34,6 +38,17 @@ async def to_thread(
return await loop.run_in_executor(None, func_call)


async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
return await _asyncio_to_thread(func, *args, **kwargs)

return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
)


# inspired by `asyncer`, https://github.com/tiangolo/asyncer
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
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.1.1" # x-release-please-version
__version__ = "1.2.0" # x-release-please-version
14 changes: 12 additions & 2 deletions src/arcadepy/types/execute_tool_response.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional

from .._models import BaseModel
from .shared.authorization_response import AuthorizationResponse

__all__ = ["ExecuteToolResponse", "Output", "OutputError"]
__all__ = ["ExecuteToolResponse", "Output", "OutputError", "OutputLog"]


class OutputError(BaseModel):
Expand All @@ -20,11 +20,21 @@ class OutputError(BaseModel):
retry_after_ms: Optional[int] = None


class OutputLog(BaseModel):
level: str

message: str

subtype: Optional[str] = None


class Output(BaseModel):
authorization: Optional[AuthorizationResponse] = None

error: Optional[OutputError] = None

logs: Optional[List[OutputLog]] = None

value: Optional[object] = None


Expand Down
14 changes: 12 additions & 2 deletions src/arcadepy/types/tool_execution_attempt.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional

from .._models import BaseModel
from .shared.authorization_response import AuthorizationResponse

__all__ = ["ToolExecutionAttempt", "Output", "OutputError"]
__all__ = ["ToolExecutionAttempt", "Output", "OutputError", "OutputLog"]


class OutputError(BaseModel):
Expand All @@ -20,11 +20,21 @@ class OutputError(BaseModel):
retry_after_ms: Optional[int] = None


class OutputLog(BaseModel):
level: str

message: str

subtype: Optional[str] = None


class Output(BaseModel):
authorization: Optional[AuthorizationResponse] = None

error: Optional[OutputError] = None

logs: Optional[List[OutputLog]] = None

value: Optional[object] = None


Expand Down
8 changes: 4 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
]
),
Expand Down Expand Up @@ -752,7 +752,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
]
),
Expand Down Expand Up @@ -1526,7 +1526,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
]
),
Expand Down Expand Up @@ -1554,7 +1554,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
messages=[
{
"role": "user",
"content": "Hello, how can I use Arcade AI?",
"content": "Hello, how can I use Arcade?",
}
]
),
Expand Down