|
1 | 1 | # TODO: Remove when Python 3.9 support is dropped |
2 | 2 | from __future__ import annotations |
3 | 3 |
|
4 | | -import asyncio |
5 | 4 | import base64 |
6 | 5 | import json |
7 | 6 | from collections.abc import Sequence |
8 | 7 | from enum import Enum |
9 | | -from functools import partial |
10 | 8 | from typing import Annotated, Any, cast |
11 | 9 | from urllib.parse import quote |
12 | 10 |
|
@@ -256,36 +254,6 @@ def call(self, *args: Any, **kwargs: Any) -> JsonDict: |
256 | 254 |
|
257 | 255 | return self.execute(kwargs if kwargs else None) |
258 | 256 |
|
259 | | - async def acall(self, *args: Any, **kwargs: Any) -> JsonDict: |
260 | | - """Async version of call method |
261 | | -
|
262 | | - Args: |
263 | | - *args: If a single argument is provided, it's treated as the full arguments dict/string |
264 | | - **kwargs: Keyword arguments to pass to the tool |
265 | | -
|
266 | | - Returns: |
267 | | - API response as dict |
268 | | -
|
269 | | - Raises: |
270 | | - StackOneAPIError: If the API request fails |
271 | | - ValueError: If the arguments are invalid |
272 | | - """ |
273 | | - # For now, we'll use asyncio to run the sync version |
274 | | - # In the future, this should use aiohttp for true async |
275 | | - |
276 | | - # Create a partial function with the arguments |
277 | | - if args and kwargs: |
278 | | - raise ValueError("Cannot provide both positional and keyword arguments") |
279 | | - |
280 | | - if args: |
281 | | - if len(args) > 1: |
282 | | - raise ValueError("Only one positional argument is allowed") |
283 | | - func = partial(self.execute, args[0]) |
284 | | - else: |
285 | | - func = partial(self.execute, kwargs if kwargs else None) |
286 | | - |
287 | | - return await asyncio.get_event_loop().run_in_executor(None, func) |
288 | | - |
289 | 257 | def to_openai_function(self) -> JsonDict: |
290 | 258 | """Convert this tool to OpenAI's function format |
291 | 259 |
|
|
0 commit comments