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

fix(parallel): enhance error handling in get_types_array and add test case #423

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

jxnl
Copy link
Owner

@jxnl jxnl commented Feb 9, 2024

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

Summary:

This PR enhances error handling in get_types_array function and adds a corresponding test case.

Key points:

  • Updated get_types_array function in instructor/dsl/parallel.py to raise TypeError for non-iterable models.
  • Added new test case test_sync_parallel_tools__error in tests/openai/test_parallel.py.

Generated with ❤️ by ellipsis.dev

@ellipsis-dev ellipsis-dev bot changed the title ... fix(parallel): enhance error handling in get_types_array and add test case Feb 9, 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!


Something look wrong? You can customize Ellipsis by editing the ellipsis.yaml for this repository.

Generated with ❤️ by ellipsis.dev

def test_sync_parallel_tools__error(client):
client = instructor.patch(client, mode=instructor.Mode.PARALLEL_TOOLS)

with pytest.raises(TypeError):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukevs We should definitely be switching back to regular tools mode if we can detect that it's not an iterable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need it still for the Boy | Girl case too right (to get the name disambiguation)

@jxnl jxnl merged commit f41b8e4 into main Feb 9, 2024
13 checks passed
@jxnl jxnl deleted the parallel-catch-noniterable branch February 9, 2024 22:59
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.

2 participants