Skip to content

feat: ✨ Pass ToolOutput to FunctionTool Callback #18756

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

upchunk
Copy link
Contributor

@upchunk upchunk commented May 16, 2025

Description

This enable people to edit ToolOutput on Callback, specially handling retring on error when return direct = True by adusting the is_error value. This also allows us to let the LLM to know the original tools output, the tool name of the failing tool and other helpful information so that the LLM can handle the failed tool even better

Fixes #
Cannot Retry when FunctionTool return an error or None when return_direct is set to True

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Breaking change

This change Might break the user functionality who create and use tool callbacks with Tool raw_output as the callback input

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran uv run make format; uv run make lint to appease the lint gods

upchunk added 3 commits May 16, 2025 14:22
This enable people to edit ToolOutput on Callback, specially handling retring on error when return direct = True by adusting the is_error value
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 16, 2025
@logan-markewich
Copy link
Collaborator

mypy is not happy 👀

llama_index/core/tools/function_tool.py:119: error: "Awaitable[Callable[[ToolOutput], ToolOutput | str | None]]" not callable [operator]

@upchunk
Copy link
Contributor Author

upchunk commented Jun 12, 2025

mypy is not happy 👀

llama_index/core/tools/function_tool.py:119: error: "Awaitable[Callable[[ToolOutput], ToolOutput | str | None]]" not callable [operator]

She is Happy now

@upchunk
Copy link
Contributor Author

upchunk commented Jun 12, 2025

Checks failed but Out of Scope
@logan-markewich

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants