-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: support passing images in Tool results #10410
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Pull Request Test Coverage Report for Build 21252856448Details
💛 - Coveralls |
|
@anakin87 if we do end up adding a new field like |
|
@sjrl It's ready for another review |
|
@anakin87 looking good! My only comment would be to add a release note. Thanks for adding all of the additional tests! |
…t-ai/haystack into support-imgs-tool-results
| "source": "docs", "handler": format_documents, "raw_result": False | ||
| } | ||
| ``` | ||
| - `source`: (Optional) Specifies the key to extract from the tool's output dictionary. If omitted, the entire result is passed to the handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Parens] Use parentheses judiciously.
| } | ||
| ``` | ||
| - `source`: (Optional) Specifies the key to extract from the tool's output dictionary. If omitted, the entire result is passed to the handler. | ||
| - `handler`: (Optional) A function that takes the output (or the extracted source value) and returns the final result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Parens] Use parentheses judiciously.
| ``` | ||
| - `source`: (Optional) Specifies the key to extract from the tool's output dictionary. If omitted, the entire result is passed to the handler. | ||
| - `handler`: (Optional) A function that takes the output (or the extracted source value) and returns the final result. | ||
| - `raw_result`: (Optional) If `True`, the result is returned "as is" without further string conversion, but applying the `handler` if provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Parens] Use parentheses judiciously.
| } | ||
| ``` | ||
| Each entry defines a `source` key and can optionally include a `handler`. The individual outputs are processed, | ||
| collected into a dictionary, and then converted into a single string (usually a JSON-like representation) for the LLM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Parens] Use parentheses judiciously.
| collected into a dictionary, and then converted into a single string (usually a JSON-like representation) for the LLM. | ||
|
|
||
| :::note | ||
| `raw_result` is not supported in the multiple output format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Contractions] Feel free to use 'isn't' instead of 'is not'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to ignore this comment :D
|
@sjrl should be ready. I am trying to re-trigger docs build to see the preview. About
I'll open another issue for this if you agree |
Yeah I think worth opening an issue |
sjrl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
Jinja2 extension issue: #10429 |
Related Issues
ToolCallResult#9432Proposed Changes:
ToolCallResult.resultto not only acceptsstrbut alsolist[TextContent|ImageContent]OpenAIResponsesChatGeneratorto handle this. (Haven't implemented inOpenAIChatGeneratorsince the Chat Completions API only acceptstrin Tool results).addexpandoutputs_to_resultinitialization parameteroutputs_to_stringparameter inTool, to allow returning the raw Tool result (instead of stringifying it) and optionally transforming itComponentToolandPipelineToolToolInvokerto support this featureoutputs_to_stringoutputs_to_stringincreate_tool_from_functionand@toolHow did you test it?
CI, added several tests
Notes for the reviewer
Opened this PR to get feedback. Something is still missing.
ToolCallResultin Jinja2 ChatMessage extension - not needed but in general we tried to keep feature parity between theChatMessagedataclass and the extension - I'll open another issue for thisChecklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.