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

[MRG] refactor the displayed info, fix small UI issues #117

Merged
merged 3 commits into from
Jul 26, 2024
Merged

Conversation

HuaizhengZhang
Copy link
Contributor

@HuaizhengZhang HuaizhengZhang commented Jul 25, 2024

Before submitting this PR, please make sure you have:

  • confirmed all checks still pass OR confirm CI build passes.
  • verified that any code or assets from external sources are properly credited in comments and/or in
    the credit file.

PR Type

Enhancement


Description

  • Refactored the display format of suggestions in process_report function using [green] tags for better readability.
  • Updated the status message in AdviseAgent.suggest method to be more descriptive.
  • Refactored dataset information display in ask_data function using [green] tags.
  • Updated the prompt for dataset information in baseline function for clarity.
  • Modified advisor report generation in baseline function to include formatted user requirements.

Changes walkthrough 📝

Relevant files
Enhancement
advisor.py
Refactor suggestion display and update status message       

mle/agents/advisor.py

  • Refactored the display format of suggestions using [green] tags.
  • Updated status message in AdviseAgent.suggest method.
  • +16/-11 
    baseline.py
    Refactor dataset display and update prompts                           

    mle/workflow/baseline.py

  • Refactored dataset information display using [green] tags.
  • Updated prompt for dataset information.
  • Modified advisor report generation to include formatted user
    requirements.
  • +4/-4     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @HuaizhengZhang HuaizhengZhang self-assigned this Jul 25, 2024
    @dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 25, 2024
    @github-actions github-actions bot added the enhancement New feature or request label Jul 25, 2024
    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Code Consistency
    The use of [green] tags for formatting in process_report is inconsistent with the rest of the application's styling conventions. Consider aligning this with existing styles or ensure that all parts of the application support these tags.

    User Prompt Clarity
    The updated prompt in baseline function for dataset information may still be unclear to users. Consider specifying what types of dataset information are acceptable or expected.

    Copy link

    github-actions bot commented Jul 25, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add checks to ensure keys exist in the dictionary before accessing them

    Consider checking if the keys exist in the suggestions dictionary before accessing
    them to avoid potential None values being formatted into the string, which could
    lead to misleading or incomplete information being displayed.

    mle/agents/advisor.py [13-26]

    -[green]Dataset Summary:[/green] {suggestions.get('data_summary')}
    -[green]Suggestion Summary:[/green] {suggestions.get('suggestion')}
    -[green]Task:[/green] {suggestions.get('task')}
    -[green]Model:[/green] {suggestions.get('model_or_algorithm')}
    -[green]Training Strategy:[/green] {suggestions.get('training_method')}
    -[green]Evaluation Metric:[/green] {suggestions.get('evaluation_metric')}
    -[green]Training Device:[/green] {suggestions.get('device')}
    -[green]Serving Strategy:[/green] {suggestions.get('serving_method')}
    -[green]Reference:[/green] {suggestions.get('reference')}
    -[green]Dependency:[/green] {suggestions.get('frameworks')}
    +[green]Dataset Summary:[/green] {suggestions['data_summary'] if 'data_summary' in suggestions else 'N/A'}
    +[green]Suggestion Summary:[/green] {suggestions['suggestion'] if 'suggestion' in suggestions else 'N/A'}
    +[green]Task:[/green] {suggestions['task'] if 'task' in suggestions else 'N/A'}
    +[green]Model:[/green] {suggestions['model_or_algorithm'] if 'model_or_algorithm' in suggestions else 'N/A'}
    +[green]Training Strategy:[/green] {suggestions['training_method'] if 'training_method' in suggestions else 'N/A'}
    +[green]Evaluation Metric:[/green] {suggestions['evaluation_metric'] if 'evaluation_metric' in suggestions else 'N/A'}
    +[green]Training Device:[/green] {suggestions['device'] if 'device' in suggestions else 'N/A'}
    +[green]Serving Strategy:[/green] {suggestions['serving_method'] if 'serving_method' in suggestions else 'N/A'}
    +[green]Reference:[/green] {suggestions['reference'] if 'reference' in suggestions else 'N/A'}
    +[green]Dependency:[/green] {suggestions['frameworks'] if 'frameworks' in suggestions else 'N/A'}
     
    Suggestion importance[1-10]: 9

    Why: This suggestion improves the robustness of the code by preventing potential issues with missing keys in the dictionary, which could lead to misleading or incomplete information being displayed.

    9
    Maintainability
    Refactor the code to use a loop for generating formatted strings

    To enhance the readability and maintainability of the code, consider using a loop to
    generate the formatted strings for each key in the suggestions dictionary instead of
    manually writing each line.

    mle/agents/advisor.py [13-26]

    -[green]Dataset Summary:[/green] {suggestions.get('data_summary')}
    -[green]Suggestion Summary:[/green] {suggestions.get('suggestion')}
    -[green]Task:[/green] {suggestions.get('task')}
    -[green]Model:[/green] {suggestions.get('model_or_algorithm')}
    -[green]Training Strategy:[/green] {suggestions.get('training_method')}
    -[green]Evaluation Metric:[/green] {suggestions.get('evaluation_metric')}
    -[green]Training Device:[/green] {suggestions.get('device')}
    -[green]Serving Strategy:[/green] {suggestions.get('serving_method')}
    -[green]Reference:[/green] {suggestions.get('reference')}
    -[green]Dependency:[/green] {suggestions.get('frameworks')}
    +output = []
    +keys = ['data_summary', 'suggestion', 'task', 'model_or_algorithm', 'training_method', 'evaluation_metric', 'device', 'serving_method', 'reference', 'frameworks']
    +for key in keys:
    +    output.append(f"[green]{key.replace('_', ' ').title()}:[/green] {suggestions.get(key, 'N/A')}")
    +return '\n'.join(output)
     
    Suggestion importance[1-10]: 7

    Why: This suggestion enhances the readability and maintainability of the code by reducing repetition and making it easier to update the list of keys in the future.

    7

    @HuaizhengZhang HuaizhengZhang changed the title [WIP] refactor the displayed info, fix small UI issues [MRG] refactor the displayed info, fix small UI issues Jul 26, 2024
    @dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 26, 2024
    @HuaizhengZhang HuaizhengZhang merged commit 0de51f4 into main Jul 26, 2024
    3 checks passed
    @huangyz0918 huangyz0918 deleted the hz/test2 branch July 26, 2024 01:59
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request lgtm This PR has been approved by a maintainer Review effort [1-5]: 2 size:M This PR changes 30-99 lines, ignoring generated files.
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants