-
-
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: clean up cohere templating #1030
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 c4ccc42 in 10 seconds
More details
- Looked at
230
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. instructor/patch.py:96
- Draft comment:
The return type in the docstring is incorrect. It should bedict[str, Any]
instead oflist[dict[str, Any]]
. - Reason this comment was not posted:
Comment was on unchanged code.
2. instructor/patch.py:110
- Draft comment:
Assertion error messages should be more descriptive. Consider providing more context in the error message to help with debugging. - Reason this comment was not posted:
Confidence changes required:80%
The assertion error messages in thehandle_templating
function should be more descriptive.
Workflow ID: wflow_KECPvk0OQBJZn4E3
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Deploying instructor with Cloudflare Pages
|
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! Incremental review on 9629f48 in 9 seconds
More details
- Looked at
444
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. instructor/templating.py:15
- Draft comment:
Consider moving the import statement forvertexai.generative_models
to the top of the file to avoid repeated imports and improve performance. - Reason this comment was not posted:
Confidence changes required:50%
The import statement forvertexai.generative_models
is inside a function, which can lead to performance issues if the function is called frequently. It's better to move the import to the top of the file.
2. instructor/templating.py:56
- Draft comment:
Ifhandle_templating
is part of the library's public API, ensure the documentation is updated to reflect the changes made to this function. - Reason this comment was not posted:
Confidence changes required:80%
The functionhandle_templating
ininstructor/templating.py
has been updated, but there is no corresponding update in the documentation. Since this is a library code change, the documentation should be updated accordingly.
3. tests/test_formatting.py:1
- Draft comment:
Ensure that the documentation is updated to reflect the changes made tohandle_templating
if it's part of the public API. - Reason this comment was not posted:
Confidence changes required:80%
The functionhandle_templating
ininstructor/templating.py
has been updated, but there is no corresponding update in the documentation. Since this is a library code change, the documentation should be updated accordingly.
Workflow ID: wflow_QHjPdv0hUUBG83Zy
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
❌ Changes requested. Incremental review on d2a5c7c in 17 seconds
More details
- Looked at
9
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. instructor/templating.py:1
- Draft comment:
Avoid using# type: ignore[all]
. Instead, address specific type issues to ensure type safety. - Reason this comment was not posted:
Confidence changes required:80%
The use of# type: ignore[all]
suppresses all type checking for this file, which can hide potential type-related issues. It's better to address specific type errors rather than ignoring all of them.
Workflow ID: wflow_azrUW2ProRxOjWzd
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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! Incremental review on 4093d2b in 10 seconds
More details
- Looked at
10
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_Cn1hCsnExyxb9YNU
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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! Incremental review on 8a65396 in 35 seconds
More details
- Looked at
84
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. instructor/templating.py:8
- Draft comment:
Usingdict
instead ofDict
is not compatible with Python versions below 3.9. Consider usingDict
for backward compatibility. - Reason this comment was not posted:
Confidence changes required:80%
The change from usingDict
todict
is not backward compatible with Python versions below 3.9. This could cause issues if the codebase needs to support older versions.
2. instructor/templating.py:13
- Draft comment:
Usingdict
instead ofDict
is not compatible with Python versions below 3.9. Consider usingDict
for backward compatibility. (Also applicable on lines 13, 59, and 60) - Reason this comment was not posted:
Confidence changes required:80%
The same issue with usingdict
instead ofDict
appears in multiple places in the file. It's important to address all occurrences for consistency and compatibility.
3. instructor/templating.py:94
- Draft comment:
handle_templating
should return a consistent type. Consider returningnew_kwargs
instead ofNone
to avoid unexpected errors. - Reason this comment was not posted:
Comment looked like it was already resolved.
4. tests/test_formatting.py:135
- Draft comment:
The test expects aValueError
, buthandle_templating
no longer raises this error. Update the test to reflect the new behavior ofhandle_templating
. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment claims thathandle_templating
no longer raises aValueError
, but there is no evidence in the provided diff or context to support this claim. The test is designed to catch aValueError
, and the change in the diff is only a stylistic one. Without evidence thathandle_templating
has changed its behavior, the comment seems speculative.
I might be missing information about changes tohandle_templating
that are not visible in this diff. The comment could be based on changes in another part of the codebase.
Given the rules, I should only consider the changes visible in this diff. Without evidence in the diff thathandle_templating
has changed, the comment should be considered speculative and removed.
Remove the comment as it is speculative and not supported by evidence in the diff.
5. tests/test_formatting.py:132
- Draft comment:
Thehandle_templating
function no longer raises aValueError
for unknown formats, but this test still expects it. Update the test to reflect the new behavior. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_4PHs3uHnNUM5PLE3
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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! Incremental review on e8f716e in 13 seconds
More details
- Looked at
19
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. tests/test_formatting.py:124
- Draft comment:
Consider re-adding a test to ensurehandle_templating
raises an error for unknown formats. This ensures robustness against unexpected input. - Reason this comment was not posted:
Confidence changes required:80%
The testtest_handle_templating_raises_error_for_unknown_format
has been removed, but the functionality to raise an error for unknown formats should still be tested to ensure robustness.
2. tests/test_formatting.py:124
- Draft comment:
Assertions should include an error message for clarity. Please add an error message to the assertion intest_handle_templating_raises_error_for_unknown_format
. - Reason this comment was not posted:
Confidence changes required:80%
The test functiontest_handle_templating_raises_error_for_unknown_format
has an assertion without an error message, which violates the rule that assertions should always have an error message.
Workflow ID: wflow_sosxoYgJVd54lQOR
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Refactor Cohere templating by integrating it into
handle_templating
intemplating.py
, simplifying code, and updating tests.handle_cohere_templating
frompatch.py
and integrate logic intohandle_templating
intemplating.py
.from_cohere
inclient_cohere.py
by removingnew_create_async
.handle_templating
intemplating.py
now processeskwargs
for Cohere, OpenAI, Anthropic, VertexAI, and Gemini formats.kwargs
containsmessage
,messages
, orcontents
inhandle_templating
.test_formatting.py
to usehandle_templating
fromtemplating.py
and cover various message formats.client_cohere.py
.This description was created by for e8f716e. It will automatically update as commits are pushed.