feat(core): Implement Pydantic data models and fix tests#44
Open
BorisQuanLi wants to merge 4 commits intoDeepCritical:devfrom
Open
feat(core): Implement Pydantic data models and fix tests#44BorisQuanLi wants to merge 4 commits intoDeepCritical:devfrom
BorisQuanLi wants to merge 4 commits intoDeepCritical:devfrom
Conversation
This commit introduces new source and test files (`src/core/schemas.py` and `tests/core/test_schema.py`) to establish core data contracts (e.g., ResearchGoal, AnalysisStep, FinancialAnalysisResult). This is the necessary starting step for the "pure Pydantic implementation for multi-agent systems," which enhances predictability and strengthens the system's commercial reliability. Corresponding unit tests are included to verify input and output validation across all new schemas.
Patches the `pydantic_ai.Agent` constructor in the unit tests for `InputParserAgent`, `LongWriterAgent`, `ProofreaderAgent`, and `WriterAgent`. These tests were failing in environments without configured API keys because the `Agent` class constructor requires a real model configuration. By mocking the `Agent` class during initialization, the tests can now run successfully without making external calls, improving test suite robustness and reliability in CI/CD environments.
Mocks the creation of all agents instantiated within `IterativeResearchFlow` and `DeepResearchFlow` during unit and integration tests. These tests were failing in environments without API keys because the research flow classes were initializing agents that require credentials. This change ensures that all agent dependencies are properly mocked, allowing the flow logic to be tested in isolation.
This commit addresses two final unit test failures: 1. In `tests/unit/agent_factory/test_judges_factory.py`, the tests for `get_model` are fixed by correctly mocking the `settings` object to reflect the provider selection priority logic. 2. In `tests/unit/test_app_smoke.py`, the Gradio app smoke test is fixed by patching `gradio.LoginButton`. This prevents the component from making a call to the HuggingFace Hub on initialization, which was causing an invalid token error in the test environment.
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 pull request introduces foundational Pydantic data models for the application's core schemas. It also includes several fixes to the unit test suite to improve reliability and resolve configuration issues.