Skip to content

Conversation

@TomeHirata
Copy link
Collaborator

  • Introduced a new section in tools.md detailing the use of async tools with examples for acall and synchronous calls using allow_tool_async_sync_conversion.
  • Updated error message in Tool class to clarify how to handle async tool calls.
  • Enhanced test for async tool call in sync mode to match the updated error message.

- Introduced a new section in tools.md detailing the use of async tools with examples for `acall` and synchronous calls using `allow_tool_async_sync_conversion`.
- Updated error message in Tool class to clarify how to handle async tool calls.
- Enhanced test for async tool call in sync mode to match the updated error message.

Signed-off-by: TomuHirata <tomu.hirata@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the documentation and error handling for async tool usage in DSPy. The changes improve clarity around how to work with asynchronous tools and provide better guidance when errors occur.

Key Changes:

  • Added comprehensive documentation section explaining async tool usage with acall and sync mode conversion
  • Updated error message to provide clearer instructions for handling async tools, including specific configuration examples
  • Enhanced test coverage to verify the improved error message format

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
docs/docs/learn/programming/tools.md Adds new "Async Tools" section with examples demonstrating both acall usage and sync mode conversion with allow_tool_async_sync_conversion
dspy/adapters/types/tool.py Improves error message clarity by providing specific configuration examples using dspy.configure() and dspy.context()
tests/adapters/test_tool.py Updates test to validate the new error message format using regex pattern matching

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Added a new section on using async tools in synchronous contexts, including examples for temporary and global configuration of async-to-sync conversion.
- Updated the Yahoo Finance tutorial to reflect the new async tool capabilities and link to the async tools documentation.

Signed-off-by: TomuHirata <tomu.hirata@gmail.com>
- Included the `import asyncio` statement in the example for calling async tools from synchronous code to clarify usage.

Signed-off-by: TomuHirata <tomu.hirata@gmail.com>
Copy link
Collaborator

@chenmoneygithub chenmoneygithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TomeHirata TomeHirata merged commit e2b9ef8 into stanfordnlp:main Nov 13, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants