Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dspy/adapters/types/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ def _run_async_in_sync(self, coroutine):
try:
loop = asyncio.get_running_loop()
except RuntimeError:
return asyncio.run(coroutine)
# Run the coroutine outside of "except" block to avoid propagation
loop = None

if loop is None:
return asyncio.run(coroutine)
return loop.run_until_complete(coroutine)

@with_callbacks
Expand Down