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

Feat/talk2scholar hydra migration #96

Conversation

ansh-info
Copy link
Contributor

@ansh-info ansh-info commented Feb 8, 2025

For authors

Description

Migration from config.py to Hydra Configuration System with Enhanced Test Coverage

  1. Summary of Changes:

    • Migrated from static config.py and .env files to Hydra configuration system
    • Implemented YAML-based configurations for all components
    • Restructured configuration management in agents and tools
    • Added configuration support for frontend settings
    • Achieved 100% test coverage across all components
  2. Context and Motivation:

    • Improved configuration management and maintainability
    • Enhanced flexibility for different environments
    • Better separation of concerns between configuration and code
    • More robust configuration validation
    • Easier configuration updates without code changes

Implementation Details

  1. Created new configuration structure:
configs/
├── agents/
│   └── talk2scholars/
│       ├── main_agent/
│       │   └── default.yaml
│       └── s2_agent/
│           └── default.yaml
├── app/
│   └── frontend/
│       └── default.yaml
└── tools/
    ├── search/
    ├── single_paper_recommendation/
    └── multi_paper_recommendation/
  1. Component Updates:
    • Modified s2_agent.py for Hydra integration
    • Updated main_agent.py with new configuration system
    • Added tool-specific configurations
    • Implemented frontend configuration support

Test coverage includes:

  1. Unit Tests:

    • Configuration loading and validation
    • Main Agent supervisor routing
    • S2 Tools functionality (search, recommendations, display)
    • State management
    • Configuration structure
  2. Integration Tests:

    • End-to-end search workflow
    • Hydra configuration integration
    • Tool interactions

Changed Files

  1. Agents:
    • s2_agent.py
    • main_agent.py
  2. Tools:
    • search.py
    • single_paper_rec.py
    • multi_paper_rec.py
    • display_results.py
  3. Configuration:
    • Added multiple YAML files under configs/
    • Removed config.py
    • Updated .env handling
  4. Tests:
    • Updated test fixtures and mocks
    • Added configuration testing
    • Enhanced test coverage to 100%

Fixes # (issue) Mention the issue number.

Issue #61

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests you conducted to verify your changes. These may involve creating new test scripts or updating existing ones.

  • Added new test(s) in the tests folder
  • Added new function(s) to an existing test(s) (e.g.: tests/testX.py)
  • No new tests added (Please explain the rationale in this case)

Checklist

  • My code follows the style guidelines mentioned in the Code/DevOps guides
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. MkDocs)
  • My changes generate no new warnings
  • I have added or updated tests (in the tests folder) that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

For reviewers

Checklist pre-approval

  • Is there enough documentation?
  • If a new feature has been added, or a bug fixed, has a test been added to confirm good behavior?
  • Does the test(s) successfully test edge/corner cases?
  • Does the PR pass the tests? (if the repository has continuous integration)

Checklist post-approval

  • Does this PR merge develop into main? If so, please make sure to add a prefix (feat/fix/chore) and/or a suffix BREAKING CHANGE (if it's a major release) to your commit message.
  • Does this PR close an issue? If so, please make sure to descriptively close this issue when the PR is merged.

Checklist post-merge

  • When you approve of the PR, merge and close it (Read this article to know about different merge methods on GitHub)
  • Did this PR merge develop into main and is it suppose to run an automated release workflow (if applicable)? If so, please make sure to check under the "Actions" tab to see if the workflow has been initiated, and return later to verify that it has completed successfully.

Copy link
Member

@dmccloskey dmccloskey left a comment

Choose a reason for hiding this comment

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

The migration to Hydra for handling configs looks very good 👍. Now that we are using hydra for confis, I would recommend adding additional information to the logging messages. In particular, ensuring that the log message captures more meaningful information that can be used to better understand what configs/arguments the function was called.


def make_supervisor_node(llm: BaseChatModel) -> str:
def make_supervisor_node(llm: BaseChatModel, cfg) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

Can you add the docstrings and a type hint for cfg?

aiagents4pharma/talk2scholars/agents/main_agent.py Outdated Show resolved Hide resolved
@ansh-info ansh-info requested a review from dmccloskey February 9, 2025 13:21
aiagents4pharma/talk2scholars/agents/main_agent.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@ansh-info ansh-info requested a review from gurdeep330 February 9, 2025 17:56
Copy link
Member

@gurdeep330 gurdeep330 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the reviews!

Copy link
Member

@dmccloskey dmccloskey left a comment

Choose a reason for hiding this comment

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

nice work 💪

@dmccloskey dmccloskey merged commit 4861133 into VirtualPatientEngine:main Feb 9, 2025
3 of 6 checks passed
Copy link
Contributor

github-actions bot commented Feb 9, 2025

🎉 This PR is included in version 1.17.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants