-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
Fix tools for OpenAI messages #1194
Conversation
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 to me! Reviewed everything up to 586300c in 35 seconds
More details
- Looked at
25
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. instructor/multimodal.py:336
- Draft comment:
Ensure thatcontent
is expected to be a list when not a string. This change assumes thatNone
should be replaced with an empty list, which might not be the intended behavior in all contexts. - Reason this comment was not posted:
Confidence changes required:50%
The change fromcontent = message["content"]
tocontent = message["content"] or []
is intended to handle cases wherecontent
might beNone
. This is a good change to prevent iteration overNone
, which would cause an error. However, this change assumes thatcontent
should always be a list when it's not a string. This assumption should be verified in the context of the application.
2. instructor/multimodal.py:337
- Draft comment:
Good use ofother_kwargs
to preserve additional message attributes. This ensures that extra information is not lost during conversion. - Reason this comment was not posted:
Confidence changes required:0%
The addition ofother_kwargs
ensures that any additional keys in themessage
dictionary are preserved when creating the new message dictionary. This is important for maintaining any extra information that might be needed later. The change is correctly applied in both places whereconverted_messages.append
is called.
3. instructor/multimodal.py:337
- Draft comment:
Use a more descriptive variable name thanother_kwargs
to indicate what these additional keyword arguments represent. - Reason this comment was not posted:
Confidence changes required:50%
The code changes in the PR involve addingother_kwargs
to theconverted_messages
list. However, the variable nameother_kwargs
is not very descriptive. It would be better to use a more descriptive name that indicates what these additional keyword arguments represent.
4. instructor/multimodal.py:360
- Draft comment:
Use a more descriptive variable name thanother_kwargs
to indicate what these additional keyword arguments represent. This applies to line 363 as well. - Reason this comment was not posted:
Confidence changes required:50%
The code changes in the PR involve addingother_kwargs
to theconverted_messages
list. However, the variable nameother_kwargs
is not very descriptive. It would be better to use a more descriptive name that indicates what these additional keyword arguments represent.
Workflow ID: wflow_tDf49L9HzJKWK1HW
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
I'll review those failed tests today unless you know any of them to be expected failures. |
That fixes black, note that I added it to the dev requirements as well, if you don't want that it's all in one commit easy to revert. I looked and the failures now seem to be unrelated, running black on non-python files, connection errors in a tests that appear to reach out to the API direct but are failing long before the changes made here. |
Fixes two different issues with tool use and OpenAI
Important
Fixes handling of null contexts and preserves additional arguments in OpenAI messages in
convert_messages()
ininstructor/multimodal.py
.content
with an empty list inconvert_messages()
to handle empty contexts from OpenAI.convert_messages()
by including them in the message dictionary.convert_messages()
to ensure compatibility with OpenAI tool calls.This description was created by for 586300c. It will automatically update as commits are pushed.