Commit 1d83504
committed
feat(async): integrate nest-asyncio for running async tools in event loops
- Added nest-asyncio as a dependency to allow calling async tools from within a running event loop.
- Updated the Tool class to apply nest-asyncio when the event loop is already running.
- Enhanced syncify utility to raise an ImportError if nest-asyncio is not installed when needed.
- Added a new test case to verify async tool calls from a running event loop.
This change improves compatibility with environments like Jupyter notebooks where event loops are already active.
Signed-off-by: TomuHirata <tomu.hirata@gmail.com>1 parent fe03ead commit 1d83504
File tree
5 files changed
+46
-10
lines changed- dspy
- adapters/types
- utils
- tests/adapters
5 files changed
+46
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
171 | 182 | | |
172 | 183 | | |
173 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
| |||
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
545 | | - | |
546 | | - | |
547 | 555 | | |
548 | 556 | | |
549 | 557 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments