You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, while exploring the implementation of asynchronous tools, I discovered challenges in certain scenarios where tools could either be exclusively implemented asynchronously or synchronously. As a result, I'd like to propose a solution that strengthens the connection between asynchronous and synchronous functions and reduces redundant implementation.
I've demonstrated through the async_tool_runner.py script how _arun can be made operational in various situations using _run. The central idea I wish to convey with this script is to enable synchronous execution through _run when it hasn't been implemented.
Here's my proposed method of implementation:
By default in langchain, the _run method refers to and executes _arun.
If _arun is not implemented, it references and executes the _run method.
An error is triggered if _arun and _run end up in a mutual reference state.
Through this implementation, developers can fulfill both scenarios by implementing either _arun or _run. Of course, implementing both would be ideal, but there might be circumstances where only one method can be implemented.
I'd love to hear your thoughts on this proposal. If you have additional ideas or feedback related to this, please share.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, langchain community members,
Recently, while exploring the implementation of asynchronous tools, I discovered challenges in certain scenarios where tools could either be exclusively implemented asynchronously or synchronously. As a result, I'd like to propose a solution that strengthens the connection between asynchronous and synchronous functions and reduces redundant implementation.
I've demonstrated through the async_tool_runner.py script how
_arun
can be made operational in various situations using_run
. The central idea I wish to convey with this script is to enable synchronous execution through_run
when it hasn't been implemented.Here's my proposed method of implementation:
_run
method refers to and executes_arun
._arun
is not implemented, it references and executes the_run
method._arun
and_run
end up in a mutual reference state.Through this implementation, developers can fulfill both scenarios by implementing either
_arun
or_run
. Of course, implementing both would be ideal, but there might be circumstances where only one method can be implemented.I'd love to hear your thoughts on this proposal. If you have additional ideas or feedback related to this, please share.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions