|
11 | 11 | from ..core.api_error import ApiError
|
12 | 12 | from ..types.status_response import StatusResponse
|
13 | 13 | from ..core.jsonable_encoder import jsonable_encoder
|
| 14 | +from ..types.tools_list_response import ToolsListResponse |
14 | 15 | from ..core.client_wrapper import AsyncClientWrapper
|
15 | 16 |
|
16 | 17 | # this is used as the default value for optional parameters
|
@@ -146,6 +147,48 @@ def status(self, job_id: str, *, request_options: typing.Optional[RequestOptions
|
146 | 147 | raise ApiError(status_code=_response.status_code, body=_response.text)
|
147 | 148 | raise ApiError(status_code=_response.status_code, body=_response_json)
|
148 | 149 |
|
| 150 | + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsListResponse: |
| 151 | + """ |
| 152 | + Get the list of available tools to execute code. |
| 153 | +
|
| 154 | + Parameters |
| 155 | + ---------- |
| 156 | + request_options : typing.Optional[RequestOptions] |
| 157 | + Request-specific configuration. |
| 158 | +
|
| 159 | + Returns |
| 160 | + ------- |
| 161 | + ToolsListResponse |
| 162 | + Successful Response |
| 163 | +
|
| 164 | + Examples |
| 165 | + -------- |
| 166 | + from axiomatic import Axiomatic |
| 167 | +
|
| 168 | + client = Axiomatic( |
| 169 | + api_key="YOUR_API_KEY", |
| 170 | + ) |
| 171 | + client.tools.list() |
| 172 | + """ |
| 173 | + _response = self._client_wrapper.httpx_client.request( |
| 174 | + "jobs/list/tools", |
| 175 | + method="GET", |
| 176 | + request_options=request_options, |
| 177 | + ) |
| 178 | + try: |
| 179 | + if 200 <= _response.status_code < 300: |
| 180 | + return typing.cast( |
| 181 | + ToolsListResponse, |
| 182 | + parse_obj_as( |
| 183 | + type_=ToolsListResponse, # type: ignore |
| 184 | + object_=_response.json(), |
| 185 | + ), |
| 186 | + ) |
| 187 | + _response_json = _response.json() |
| 188 | + except JSONDecodeError: |
| 189 | + raise ApiError(status_code=_response.status_code, body=_response.text) |
| 190 | + raise ApiError(status_code=_response.status_code, body=_response_json) |
| 191 | + |
149 | 192 |
|
150 | 193 | class AsyncToolsClient:
|
151 | 194 | def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
@@ -291,3 +334,53 @@ async def main() -> None:
|
291 | 334 | except JSONDecodeError:
|
292 | 335 | raise ApiError(status_code=_response.status_code, body=_response.text)
|
293 | 336 | raise ApiError(status_code=_response.status_code, body=_response_json)
|
| 337 | + |
| 338 | + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ToolsListResponse: |
| 339 | + """ |
| 340 | + Get the list of available tools to execute code. |
| 341 | +
|
| 342 | + Parameters |
| 343 | + ---------- |
| 344 | + request_options : typing.Optional[RequestOptions] |
| 345 | + Request-specific configuration. |
| 346 | +
|
| 347 | + Returns |
| 348 | + ------- |
| 349 | + ToolsListResponse |
| 350 | + Successful Response |
| 351 | +
|
| 352 | + Examples |
| 353 | + -------- |
| 354 | + import asyncio |
| 355 | +
|
| 356 | + from axiomatic import AsyncAxiomatic |
| 357 | +
|
| 358 | + client = AsyncAxiomatic( |
| 359 | + api_key="YOUR_API_KEY", |
| 360 | + ) |
| 361 | +
|
| 362 | +
|
| 363 | + async def main() -> None: |
| 364 | + await client.tools.list() |
| 365 | +
|
| 366 | +
|
| 367 | + asyncio.run(main()) |
| 368 | + """ |
| 369 | + _response = await self._client_wrapper.httpx_client.request( |
| 370 | + "jobs/list/tools", |
| 371 | + method="GET", |
| 372 | + request_options=request_options, |
| 373 | + ) |
| 374 | + try: |
| 375 | + if 200 <= _response.status_code < 300: |
| 376 | + return typing.cast( |
| 377 | + ToolsListResponse, |
| 378 | + parse_obj_as( |
| 379 | + type_=ToolsListResponse, # type: ignore |
| 380 | + object_=_response.json(), |
| 381 | + ), |
| 382 | + ) |
| 383 | + _response_json = _response.json() |
| 384 | + except JSONDecodeError: |
| 385 | + raise ApiError(status_code=_response.status_code, body=_response.text) |
| 386 | + raise ApiError(status_code=_response.status_code, body=_response_json) |
0 commit comments