-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 nested pydantic model issue #1905
Conversation
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #1905 - Fix Nested Pydantic Model IssueOverviewThis pull request addresses the handling of nested Pydantic models and improves the conversion utilities' error handling and support for complex data structures. Overall, the changes are commendable, enhancing the system's resilience. Key Code Improvements1. converter.py
2. internal_instructor.py
3. pydantic_schema_parser.py
Historical ContextRecent changes in these files suggested a conscious effort to enhance error handling and type management. Analyzing related PRs that focused on handling Pydantic models may provide insights into the evolution of practices within this codebase. For instance, observing past discussions about error handling could enrich your understanding of current approaches. Testing and CoverageWhile the addition of considerate test coverage substantially improves confidence, consider integrating parameterized tests for broader scenarios. Example: @pytest.mark.parametrize("model_config", [
(SimpleModel, {"name": "Test", "age": 30}),
]) General Recommendations
Security Implications
ConclusionThe enhancements proposed in this PR significantly bolster the Pydantic model handling capabilities and strengthen test coverage, assuring greater reliability. However, attention to logging, error handling uniformity, and some architectural decisions remains essential before merging this pull request. Thus, I recommend merging after the outlined adjustments are addressed. |
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.
works for me. just those type issues locally potentially!
@@ -25,7 +25,7 @@ class OutputConverter(BaseModel, ABC): | |||
llm: Any = Field(description="The language model to be used to convert the text.") | |||
model: Any = Field(description="The model to be used to convert the text.") | |||
instructions: str = Field(description="Conversion instructions to the LLM.") | |||
max_attempts: Optional[int] = Field( | |||
max_attempts: int = Field( |
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.
nice fix !
* Fix nested pydantic model issue * fix failing tests * add in vcr * cleanup * drop prints * Fix vcr issues * added new recordings * trying to fix vcr * add in fix from lorenze.
* Fix nested pydantic model issue * fix failing tests * add in vcr * cleanup * drop prints * Fix vcr issues * added new recordings * trying to fix vcr * add in fix from lorenze.
Explanation and proof that PR works: https://www.loom.com/share/5a338203b1c24030b702dd5fc18b84f7?sid=f70da264-f042-485a-81c1-8f42d60562ca
closes #911 - 99% of the credit goes to @inchoate! I need to add a few more tests and fix a few upstream issues.