-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Feat Support image URLs in tool outputs for Langchain::Assistant #894
base: main
Are you sure you want to change the base?
Conversation
@Eth3rnit3 Thank you for your PR. Your thoughts on the below... ? What if we modified this to: content, image_url = tool_instance.send(method_name, **tool_arguments)
# Rename the method parameter from output: to content:
submit_tool_output(tool_call_id: tool_call_id, content: content, image_url: image_url) Something else to think about is that we might want to support the base64 encoded image re-presentation in the future, something like:
|
Yes you're right @andreibondarev it's better this way, it's more implicit and avoids parsing what is output from the tool.
Here's the error message for OpenAPI, which doesn't support
|
6ff961b
to
ed045b5
Compare
content.to_s | ||
end | ||
|
||
def to_str |
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.
Do we need this method? Is it used anywhere?
to_s | ||
end | ||
|
||
def include?(other) |
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.
Is this one used?
Tool Response Standardization
Overview
This PR introduces a standardized way to handle tool responses in the Langchain library, making it easier to manage both content and image responses while maintaining backward compatibility.
Key Changes
1. New Classes and Modules
ToolResponse
ClassToolHelpers
Module2. Tool Updates
All tools have been updated to:
ToolHelpers
moduleToolResponse
objects instead of raw valuesExample from the Calculator tool:
3. Assistant Integration
The
Assistant
class now handles both new and legacy response formats:4. Test Coverage
ToolResponse
ToolResponse
usageFuture Improvements
In a future PR, we plan to:
ToolResponse
objects differentlyBreaking Changes
None. The assistant maintains backward compatibility by supporting both:
ToolResponse
objectsMigration Guide
To update your custom tools to use the new format:
ToolHelpers
module:tool_response
in your methods: