MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

fix aask() got an unexpected keyword argument 'images'

Open jainkunal opened this issue 1 year ago • 4 comments

User description

This fixes the error when running software_company with is_human flag True for ProjectManager.

The issue is that BaseLLM.aask takes in more keyword arguments than handled by HumanProvider.aask and that results in the following error.

aask() got an unexpected keyword argument 'images'

Tested the code after the fix.


PR Type

Bug fix


Description

  • Added support for flexible keyword arguments in the aask method of HumanProvider class. This prevents errors when unexpected keyword arguments are passed, enhancing the method's robustness.

Changes walkthrough 📝

Relevant files
Bug fix
human_provider.py
Add flexible keyword argument handling to `aask` method   

metagpt/provider/human_provider.py

  • Added **kwargs to the aask method to handle additional unexpected
    keyword arguments.
  • +1/-0     

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

    jainkunal avatar May 11 '24 13:05 jainkunal

    PR Description updated to latest commit (https://github.com/geekan/MetaGPT/commit/d4bd66898327b818eb80eb12a7bba25305304e79)

    qodo-code-review[bot] avatar May 11 '24 13:05 qodo-code-review[bot]

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    1, because the change is minimal and straightforward, involving only the addition of **kwargs to handle additional unexpected keyword arguments in a method.

    🧪 Relevant tests

    No

    ⚡ Possible issues

    No

    🔒 Security concerns

    No

    qodo-code-review[bot] avatar May 11 '24 13:05 qodo-code-review[bot]

    PR Code Suggestions ✨

    CategorySuggestions                                                                                                                                                       
    Possible issue
    Ensure that arbitrary keyword arguments are properly handled or passed through.

    **The addition of **kwargs in the function signature of aask allows for arbitrary keyword
    arguments, which might lead to unexpected behavior if not handled properly. If the
    intention is to pass these additional keyword arguments to the ask method, explicitly pass
    **kwargs to it. If not, consider removing kwargs or handling it explicitly to avoid
    potential bugs.

    metagpt/provider/human_provider.py [36]

    -**kwargs
    +return self.ask(msg, timeout=self.get_timeout(timeout), **kwargs)
     
    

    qodo-code-review[bot] avatar May 11 '24 13:05 qodo-code-review[bot]

    Codecov Report

    All modified and coverable lines are covered by tests :white_check_mark:

    Project coverage is 70.20%. Comparing base (f201b2f) to head (d4bd668).

    :exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

    Additional details and impacted files
    @@            Coverage Diff             @@
    ##             main    #1264      +/-   ##
    ==========================================
    - Coverage   70.22%   70.20%   -0.03%     
    ==========================================
      Files         316      316              
      Lines       18860    18860              
    ==========================================
    - Hits        13245    13240       -5     
    - Misses       5615     5620       +5     
    

    :umbrella: View full report in Codecov by Sentry.
    :loudspeaker: Have feedback on the report? Share it here.

    codecov-commenter avatar May 11 '24 13:05 codecov-commenter

    LGTM

    iorisa avatar May 16 '24 04:05 iorisa