Skip to content

Commit 0f1c7ed

Browse files
feat(api): api update (#73)
1 parent 499b981 commit 0f1c7ed

40 files changed

+924
-404
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-4a9af27c5fe900e731350e1d8b72743021977c7863dd41764803a996298dc5b5.yml
1+
configured_endpoints: 12
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-d58cc9da58058f299ad7d32005d843f2216fc02ae21dc44b8038b94382ec7e2f.yml

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ client = Arcade(
3131
api_key=os.environ.get("ARCADE_API_KEY"), # This is the default and can be omitted
3232
)
3333

34-
response = client.tools.execute(
34+
execute_tool_response = client.tools.execute(
3535
tool_name="Google.ListEmails",
3636
inputs={"n_emails": 10},
3737
user_id="user@example.com",
3838
)
39-
print(response.invocation_id)
39+
print(execute_tool_response.id)
4040
```
4141

4242
While you can provide an `api_key` keyword argument,
@@ -59,12 +59,12 @@ client = AsyncArcade(
5959

6060

6161
async def main() -> None:
62-
response = await client.tools.execute(
62+
execute_tool_response = await client.tools.execute(
6363
tool_name="Google.ListEmails",
6464
inputs={"n_emails": 10},
6565
user_id="user@example.com",
6666
)
67-
print(response.invocation_id)
67+
print(execute_tool_response.id)
6868

6969

7070
asyncio.run(main())

api.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Shared Types
22

33
```python
4-
from arcadepy.types import AuthorizationResponse, Error, ToolDefinition
4+
from arcadepy.types import AuthorizationResponse, Error
55
```
66

77
# Auth
@@ -51,23 +51,34 @@ Types:
5151
from arcadepy.types import (
5252
AuthorizeToolRequest,
5353
ExecuteToolRequest,
54-
Inputs,
55-
Output,
56-
Parameter,
57-
Requirements,
58-
Response,
54+
ExecuteToolResponse,
5955
ResponseOutput,
60-
ToolkitDefinition,
61-
ValueSchema,
56+
ToolExecution,
57+
ToolExecutionAttempt,
58+
ToolListResponse,
59+
ToolGetResponse,
6260
)
6361
```
6462

6563
Methods:
6664

67-
- <code title="get /v1/tools/list">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">list</a>(\*\*<a href="src/arcadepy/types/tool_list_params.py">params</a>) -> <a href="./src/arcadepy/types/shared/tool_definition.py">SyncOffsetPage[ToolDefinition]</a></code>
65+
- <code title="get /v1/tools/list">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">list</a>(\*\*<a href="src/arcadepy/types/tool_list_params.py">params</a>) -> <a href="./src/arcadepy/types/tool_list_response.py">SyncOffsetPage[ToolListResponse]</a></code>
6866
- <code title="post /v1/tools/authorize">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">authorize</a>(\*\*<a href="src/arcadepy/types/tool_authorize_params.py">params</a>) -> <a href="./src/arcadepy/types/shared/authorization_response.py">AuthorizationResponse</a></code>
69-
- <code title="post /v1/tools/execute">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">execute</a>(\*\*<a href="src/arcadepy/types/tool_execute_params.py">params</a>) -> <a href="./src/arcadepy/types/response.py">Response</a></code>
70-
- <code title="get /v1/tools/definition">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">get</a>(\*\*<a href="src/arcadepy/types/tool_get_params.py">params</a>) -> <a href="./src/arcadepy/types/shared/tool_definition.py">ToolDefinition</a></code>
67+
- <code title="post /v1/tools/execute">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">execute</a>(\*\*<a href="src/arcadepy/types/tool_execute_params.py">params</a>) -> <a href="./src/arcadepy/types/execute_tool_response.py">ExecuteToolResponse</a></code>
68+
- <code title="get /v1/tools/definition">client.tools.<a href="./src/arcadepy/resources/tools/tools.py">get</a>() -> <a href="./src/arcadepy/types/tool_get_response.py">ToolGetResponse</a></code>
69+
70+
## Scheduled
71+
72+
Types:
73+
74+
```python
75+
from arcadepy.types.tools import ScheduledListResponse, ScheduledDetailsResponse
76+
```
77+
78+
Methods:
79+
80+
- <code title="get /v1/tools/scheduled">client.tools.scheduled.<a href="./src/arcadepy/resources/tools/scheduled.py">list</a>() -> <a href="./src/arcadepy/types/tools/scheduled_list_response.py">ScheduledListResponse</a></code>
81+
- <code title="get /v1/tools/scheduled/{id}">client.tools.scheduled.<a href="./src/arcadepy/resources/tools/scheduled.py">details</a>(id) -> <a href="./src/arcadepy/types/tools/scheduled_details_response.py">ScheduledDetailsResponse</a></code>
7182

7283
## Formatted
7384

src/arcadepy/resources/auth.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def start(
118118
def status(
119119
self,
120120
*,
121-
authorization_id: str,
122-
scopes: str | NotGiven = NOT_GIVEN,
121+
id: str,
123122
wait: int | NotGiven = NOT_GIVEN,
124123
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125124
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -135,9 +134,7 @@ def status(
135134
completed or the timeout is reached.
136135
137136
Args:
138-
authorization_id: Authorization ID
139-
140-
scopes: Scopes
137+
id: Authorization ID
141138
142139
wait: Timeout in seconds (max 59)
143140
@@ -158,8 +155,7 @@ def status(
158155
timeout=timeout,
159156
query=maybe_transform(
160157
{
161-
"authorization_id": authorization_id,
162-
"scopes": scopes,
158+
"id": id,
163159
"wait": wait,
164160
},
165161
auth_status_params.AuthStatusParams,
@@ -296,8 +292,7 @@ async def start(
296292
async def status(
297293
self,
298294
*,
299-
authorization_id: str,
300-
scopes: str | NotGiven = NOT_GIVEN,
295+
id: str,
301296
wait: int | NotGiven = NOT_GIVEN,
302297
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
303298
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -313,9 +308,7 @@ async def status(
313308
completed or the timeout is reached.
314309
315310
Args:
316-
authorization_id: Authorization ID
317-
318-
scopes: Scopes
311+
id: Authorization ID
319312
320313
wait: Timeout in seconds (max 59)
321314
@@ -336,8 +329,7 @@ async def status(
336329
timeout=timeout,
337330
query=await async_maybe_transform(
338331
{
339-
"authorization_id": authorization_id,
340-
"scopes": scopes,
332+
"id": id,
341333
"wait": wait,
342334
},
343335
auth_status_params.AuthStatusParams,

src/arcadepy/resources/chat/completions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
from typing import Dict, List, Iterable
6-
from typing_extensions import Literal
76

87
import httpx
98

@@ -60,7 +59,7 @@ def create(
6059
n: int | NotGiven = NOT_GIVEN,
6160
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
6261
presence_penalty: float | NotGiven = NOT_GIVEN,
63-
response_format: Literal["json_object", "text"] | NotGiven = NOT_GIVEN,
62+
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
6463
seed: int | NotGiven = NOT_GIVEN,
6564
stop: List[str] | NotGiven = NOT_GIVEN,
6665
stream: bool | NotGiven = NOT_GIVEN,
@@ -176,7 +175,7 @@ async def create(
176175
n: int | NotGiven = NOT_GIVEN,
177176
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
178177
presence_penalty: float | NotGiven = NOT_GIVEN,
179-
response_format: Literal["json_object", "text"] | NotGiven = NOT_GIVEN,
178+
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
180179
seed: int | NotGiven = NOT_GIVEN,
181180
stop: List[str] | NotGiven = NOT_GIVEN,
182181
stream: bool | NotGiven = NOT_GIVEN,

src/arcadepy/resources/tools/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@
1616
FormattedResourceWithStreamingResponse,
1717
AsyncFormattedResourceWithStreamingResponse,
1818
)
19+
from .scheduled import (
20+
ScheduledResource,
21+
AsyncScheduledResource,
22+
ScheduledResourceWithRawResponse,
23+
AsyncScheduledResourceWithRawResponse,
24+
ScheduledResourceWithStreamingResponse,
25+
AsyncScheduledResourceWithStreamingResponse,
26+
)
1927

2028
__all__ = [
29+
"ScheduledResource",
30+
"AsyncScheduledResource",
31+
"ScheduledResourceWithRawResponse",
32+
"AsyncScheduledResourceWithRawResponse",
33+
"ScheduledResourceWithStreamingResponse",
34+
"AsyncScheduledResourceWithStreamingResponse",
2135
"FormattedResource",
2236
"AsyncFormattedResource",
2337
"FormattedResourceWithRawResponse",

src/arcadepy/resources/tools/formatted.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def list(
5959
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6060
) -> SyncOffsetPage[object]:
6161
"""
62-
Returns a page of tools, optionally filtered by toolkit, formatted for a
63-
specific provider
62+
Returns a page of tools from the engine configuration, optionally filtered by
63+
toolkit, formatted for a specific provider
6464
6565
Args:
6666
format: Provider format
@@ -103,7 +103,6 @@ def list(
103103
def get(
104104
self,
105105
*,
106-
tool_id: str,
107106
format: str | NotGiven = NOT_GIVEN,
108107
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
109108
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -116,8 +115,6 @@ def get(
116115
Returns the formatted tool specification for a specific tool, given a provider
117116
118117
Args:
119-
tool_id: Tool ID
120-
121118
format: Provider format
122119
123120
extra_headers: Send extra headers
@@ -135,13 +132,7 @@ def get(
135132
extra_query=extra_query,
136133
extra_body=extra_body,
137134
timeout=timeout,
138-
query=maybe_transform(
139-
{
140-
"tool_id": tool_id,
141-
"format": format,
142-
},
143-
formatted_get_params.FormattedGetParams,
144-
),
135+
query=maybe_transform({"format": format}, formatted_get_params.FormattedGetParams),
145136
),
146137
cast_to=object,
147138
)
@@ -182,8 +173,8 @@ def list(
182173
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
183174
) -> AsyncPaginator[object, AsyncOffsetPage[object]]:
184175
"""
185-
Returns a page of tools, optionally filtered by toolkit, formatted for a
186-
specific provider
176+
Returns a page of tools from the engine configuration, optionally filtered by
177+
toolkit, formatted for a specific provider
187178
188179
Args:
189180
format: Provider format
@@ -226,7 +217,6 @@ def list(
226217
async def get(
227218
self,
228219
*,
229-
tool_id: str,
230220
format: str | NotGiven = NOT_GIVEN,
231221
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
232222
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -239,8 +229,6 @@ async def get(
239229
Returns the formatted tool specification for a specific tool, given a provider
240230
241231
Args:
242-
tool_id: Tool ID
243-
244232
format: Provider format
245233
246234
extra_headers: Send extra headers
@@ -258,13 +246,7 @@ async def get(
258246
extra_query=extra_query,
259247
extra_body=extra_body,
260248
timeout=timeout,
261-
query=await async_maybe_transform(
262-
{
263-
"tool_id": tool_id,
264-
"format": format,
265-
},
266-
formatted_get_params.FormattedGetParams,
267-
),
249+
query=await async_maybe_transform({"format": format}, formatted_get_params.FormattedGetParams),
268250
),
269251
cast_to=object,
270252
)

0 commit comments

Comments
 (0)