Skip to content
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

refactor(OpenAISchema): improve from_response readability and update tests #543

Merged
merged 3 commits into from
Mar 29, 2024

Conversation

jxnl
Copy link
Collaborator

@jxnl jxnl commented Mar 29, 2024

Ellipsis 🚀 This PR description was created by Ellipsis for commit c288535.

Summary:

This PR refactors the from_response method in OpenAISchema for better readability, updates the modes list in test_openai/util.py, and modifies a test in test_function_calls.py.

Key points:

  • Refactored from_response method in OpenAISchema class in instructor/function_calls.py to use separate helper methods for parsing different modes.
  • Added instructor.Mode.TOOLS to modes list in tests/llm/test_openai/util.py.
  • Updated test_incomplete_output_exception_raise test in tests/test_function_calls.py to not be async.

Generated with ❤️ by ellipsis.dev

@jxnl jxnl requested a review from shanktt March 29, 2024 03:35
Copy link

cloudflare-workers-and-pages bot commented Mar 29, 2024

Deploying instructor with  Cloudflare Pages  Cloudflare Pages

Latest commit: c288535
Status:🚫  Build failed.

View logs

@jxnl jxnl marked this pull request as ready for review March 29, 2024 03:36
@ellipsis-dev ellipsis-dev bot changed the title ... refactor(OpenAISchema): improve from_response readability and update tests Mar 29, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 the entire pull request up to c288535
  • Looked at 205 lines of code in 3 files
  • Took 1 minute and 48 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 3 additional comments because they didn't meet confidence threshold of 85%.
1. instructor/function_calls.py:94:
  • Assessed confidence : 50%
  • Comment:
    The function 'from_response' has been refactored to separate the logic for different modes into their own methods. Please ensure that these new methods ('parse_anthropic_tools', 'parse_anthropic_json', 'parse_functions', 'parse_tools', 'parse_json') are covered by tests.
  • Reasoning:
    The function 'from_response' has been refactored to separate the logic for different modes into their own methods. This is a good practice as it improves readability and maintainability of the code. However, I need to check if these new methods are covered by tests.
2. tests/test_function_calls.py:120:
  • Assessed confidence : 50%
  • Comment:
    The test 'test_incomplete_output_exception_raise' has been changed from an async test to a sync test. Please ensure that this change does not affect any other tests, especially if there are other async tests in the codebase.
  • Reasoning:
    The test 'test_incomplete_output_exception_raise' has been changed from an async test to a sync test. This change seems fine as the function it's testing ('from_response') is not an async function. However, I need to check if there are any other async tests in the codebase that might be affected by this change.
3. instructor/function_calls.py:11:
  • Assessed confidence : 100%
  • Grade: 80%
  • Comment:
    The import statement for 'Mode' from 'instructor.mode' is duplicated. Please remove the duplicate import.

  • Reasoning:
    The import statement for 'Mode' from 'instructor.mode' is duplicated. This is a violation of the DRY principle and should be fixed.

Workflow ID: wflow_1L0Oj3tGLjm9JbzU


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@jxnl jxnl merged commit b06eb4f into main Mar 29, 2024
5 of 12 checks passed
@jxnl jxnl deleted the organize-function-calls branch March 29, 2024 12:14
PrathamSoni pushed a commit to EndexAI/instructor that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant