Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
mistral: read tool calls from AIMessage #20554
mistral: read tool calls from AIMessage #20554
Changes from 4 commits
54fc53d
9246fb2
4027f02
fe907a1
f2e352c
d60aa46
e1fdeb2
33344e2
88d4733
f341f4c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should this be prioritized over additional_kwargs? The latter should be the source of truth if swapping providers etc
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.
I'm open to either. I actually implemented it that way first, but it introduces small issues with casting to/from Mistral dicts, since the additional_kwargs contain (1) information on order of tool calls (we lose that with the separation into valid and invalid tool call lists), and (2) JSON formatting, since we parse and then dumps the args. Our unit tests maintain that we can go back/forth so I wasn't sure if we wanted to lose that. These are small issues; if we think there's a compensating benefit to prioritizing .tool_calls then happy to change it.
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.
ah yeah if we have a provider that (1) formats tool_calls into additional_kwargs, and (2) does not use OpenAI-style formatting then this will break. updated this. see changes to unit tests.
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.
@efriis see above - is it OK to lose the behavior maintained in unit tests, in which applying
_convert_message_to_mistral_chat_message
and_convert_mistral_chat_message_to_message
returns the original message identically?