Skip to content

Commit d873494

Browse files
authored
Aysnc fix (#3472)
1 parent 2d8c50f commit d873494

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body:
2626
attributes:
2727
label: What version of camel are you using?
2828
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
29-
placeholder: E.g., 0.2.80
29+
placeholder: E.g., 0.2.81a0
3030
validations:
3131
required: true
3232

camel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from camel.logger import disable_logging, enable_logging, set_log_level
1616

17-
__version__ = '0.2.80'
17+
__version__ = '0.2.81a0'
1818

1919
__all__ = [
2020
'__version__',

camel/agents/chat_agent.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import atexit
1818
import base64
1919
import concurrent.futures
20+
import functools
2021
import hashlib
2122
import inspect
2223
import json
@@ -3914,8 +3915,11 @@ async def _aexecute_tool(
39143915

39153916
else:
39163917
# Fallback: synchronous call
3918+
# Use functools.partial to properly capture args
39173919
loop = asyncio.get_running_loop()
3918-
result = await loop.run_in_executor(None, lambda: tool(**args))
3920+
result = await loop.run_in_executor(
3921+
None, functools.partial(tool, **args)
3922+
)
39193923

39203924
except Exception as e:
39213925
# Capture the error message to prevent framework crash
@@ -4742,9 +4746,10 @@ async def _aexecute_tool_from_stream_data(
47424746

47434747
else:
47444748
# Fallback: synchronous call
4749+
# Use functools.partial to properly capture args
47454750
loop = asyncio.get_running_loop()
47464751
result = await loop.run_in_executor(
4747-
None, lambda: tool(**args)
4752+
None, functools.partial(tool, **args)
47484753
)
47494754

47504755
# Create the tool response message

camel/toolkits/function_tool.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
1414
import ast
1515
import asyncio
16+
import functools
1617
import inspect
1718
import logging
1819
import textwrap
@@ -506,9 +507,11 @@ async def async_call(self, *args: Any, **kwargs: Any) -> Any:
506507
return await self.func(*args, **kwargs)
507508
else:
508509
# Run sync function in executor to avoid blocking event loop
510+
# Use functools.partial to properly capture args/kwargs
509511
loop = asyncio.get_running_loop()
510512
return await loop.run_in_executor(
511-
_SYNC_TOOL_EXECUTOR, lambda: self.func(*args, **kwargs)
513+
_SYNC_TOOL_EXECUTOR,
514+
functools.partial(self.func, *args, **kwargs),
512515
)
513516

514517
@property

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = 'CAMEL'
2828
copyright = '2024, CAMEL-AI.org'
2929
author = 'CAMEL-AI.org'
30-
release = '0.2.80'
30+
release = '0.2.81a0'
3131

3232
html_favicon = (
3333
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "camel-ai"
7-
version = "0.2.80"
7+
version = "0.2.81a0"
88
description = "Communicative Agents for AI Society Study"
99
authors = [{ name = "CAMEL-AI.org" }]
1010
requires-python = ">=3.10,<3.15"

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)