Skip to content

Conversation

@BorisQuanLi
Copy link

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.

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.
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