Closed
Conversation
Contributor
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed everything up to 404bd48 in 1 minute and 58 seconds. Click for details.
- Reviewed
750lines of code in7files - Skipped
1files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. instructor/function_calls.py:212
- Draft comment:
The recursive XSD schema generation logic is quite complex. Consider adding more inline comments to clarify the recursion and indentation handling for future maintainability. - Reason this comment was not posted:
Confidence changes required:80%<= threshold85%None
2. tests/llm/test_anthropic/test_xml.py:11
- Draft comment:
Comprehensive tests for XML mode look good; ensure these tests continue to cover edge cases (e.g. missing text blocks or malformed XML) in future updates. - Reason this comment was not posted:
Confidence changes required:50%<= threshold85%None
3. pyproject.toml:20
- Draft comment:
Typographical issue: The dependency declaration for xmlschema includes a space and parentheses ("xmlschema (>=4.1.0,<5.0.0)") which is inconsistent with the other entries. It would be clearer to use the format "xmlschema>=4.1.0,<5.0.0". - Reason this comment was not posted:
Marked as duplicate.
4. tests/llm/test_anthropic/test_xml.py:123
- Draft comment:
Typographical error: In the string 'Create a admin user for a model with a name and role.', the article should be 'an' instead of 'a'. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 85% This is a minor grammatical error in a test string. The test is focused on validating the XML response functionality and model behavior, not the grammatical correctness of the test input. The grammatical error doesn't affect the test's functionality or results. The comment is purely cosmetic and doesn't impact code quality or behavior. The grammatical error could be seen as unprofessional in code that ships to users. However, this is just a test string used internally. Since this is a test file and the grammatical error doesn't affect functionality or readability of the tests, fixing it would be purely cosmetic and not worth a PR comment. Delete the comment as it points out a minor grammatical issue in a test string that doesn't impact functionality or code quality.
5. tests/llm/test_anthropic/test_xml.py:95
- Draft comment:
Typographical issue: In the system message, the phrase 'Family members here is just asking for a list of names' should use 'are' instead of 'is' to properly agree with the plural noun 'Family members'. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 85% This is a purely grammatical suggestion that doesn't affect code functionality. The system message is just used for testing and the grammatical error doesn't impact the test's effectiveness or clarity. The rules specifically say not to make purely informative comments that don't require code changes. The grammatical error could potentially confuse other developers reading the code. Proper grammar in comments and strings can make code more professional. While proper grammar is good, this is a test file and the message is clear enough despite the minor grammatical error. The rules explicitly state not to make purely informative comments. Delete the comment as it's a purely informative grammatical suggestion that doesn't impact code functionality or clarity.
Workflow ID: wflow_rvap2MzFY68M1sLD
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Collaborator
|
this is amazing will take a look this weekend! |
Author
Thanks, @jxnl — looking forward to your feedback! |
Collaborator
|
OK, I tried some stuff locally. It looks like it needs a lot more prompting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds support for XML mode when making Anthropic (Claude) calls. Claude performs better with XML-tagged prompts, and this update allows developers to use their existing high-performing prompts with Instructor. It eliminates the need for custom retry logic, XML parsing, and other workaround solutions.
This is one proposed approach to achieving the above. I'd like to get feedback before adding more to this PR, such as documentation.
Important
Adds XML mode support for Anthropic calls, including XML schema generation and parsing, with tests and dependency updates.
ANTHROPIC_XMLmode tofrom_anthropic()inclient_anthropic.py.function_calls.pywithparse_anthropic_xml().handle_response_model()inprocess_response.pyto handleANTHROPIC_XMLmode.xml_schemaandxsd_schemaclass properties toOpenAISchemainfunction_calls.pyfor XML and XSD schema generation.extract_xml_from_codeblock()toutils.pyfor XML extraction from text.test_xml.pyto validate XML mode functionality, including async support and schema generation.xmlschematopyproject.tomldependencies for XML validation.This description was created by
for 404bd48. You can customize this summary. It will automatically update as commits are pushed.