Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: React Worker calls sync _process_actions inside async _arun_step_stream #12801

Closed
rc19 opened this issue Apr 12, 2024 · 1 comment
Closed
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@rc19
Copy link
Contributor

rc19 commented Apr 12, 2024

Bug Description

The React Worker calls sync _process_actions inside async _arun_step_stream

reasoning_steps, is_done = self._process_actions(

even when there is the async counterpart _aprocess_actions. This causes errors downstream as the tools are called sync instead of being async.

Version

0.10.28

Steps to Reproduce

reasoning_steps, is_done = self._process_actions(

Relevant Logs/Tracbacks

No response

@rc19 rc19 added bug Something isn't working triage Issue needs to be triaged/prioritized labels Apr 12, 2024
Copy link

dosubot bot commented Apr 12, 2024

To address the issue of calling a synchronous function within an asynchronous context in the React Worker, you should switch from using _process_actions to its asynchronous counterpart _aprocess_actions. This change is necessary to maintain the asynchronous execution flow and avoid errors related to mixing synchronous and asynchronous calls.

Here's the specific change you need to make in your code:

Replace:

reasoning_steps, is_done = self._process_actions(
    task, tools=tools, output=full_response, is_streaming=True
)

With:

reasoning_steps, is_done = await self._aprocess_actions(
    task, tools=tools, output=full_response, is_streaming=True
)

By making this change, you ensure that the execution remains within the asynchronous context, leveraging the await keyword for the _aprocess_actions method. This method is designed for asynchronous operation, aligning with the asynchronous workflow requirements and preventing the issues you've encountered.

If you have any more questions or need further assistance, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

1 participant