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

Update one_shot.py #8098

Closed
wants to merge 1 commit into from
Closed

Conversation

cccmolo
Copy link

@cccmolo cccmolo commented Sep 19, 2024

No description provided.

Copy link

PR Reviewer Guide 🔍

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

Potential Bug
The summaryv2 method in AssistantThoughts class modifies the self.text attribute, which could lead to unexpected behavior if the method is called multiple times or if other parts of the code rely on the original value of self.text.

Code Smell
The model_classification property is renamed from llm_classification, but the implementation still returns a hardcoded value with a FIXME comment. This suggests that the dynamic switching mentioned in the comment has not been implemented yet.

Potential Performance Issue
The response_format_instruction method creates a deep copy of self.response_schema on every call. This could be inefficient if the method is called frequently with the same use_functions_api value.

@cccmolo
Copy link
Author

cccmolo commented Sep 19, 2024

This pull request includes several changes to the one_shot.py file in the autogpt/agents/prompt_strategies directory. The changes focus on enhancing the AssistantThoughts model, updating method names, and improving logging and schema handling.

Enhancements to AssistantThoughts model:

  • Added ellipses (...) to all Field definitions to enforce required fields. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL31-R53](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L31-R53))
  • Introduced a new method summaryv2 to provide a detailed task description for the assistant. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL31-R53](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L31-R53))

Method name updates:

  • Renamed llm_classification to model_classification for better clarity. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL97-R113](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L97-R113))

Logging improvements:

  • Changed log level from debug to info in the parse_response_content method to ensure important information is logged. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL259-R262](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L259-R262))

Schema handling improvements:

  • Updated the response schema handling to use OneShotAgentActionProposal.schema() instead of model_json_schema(). ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL97-R113](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L97-R113))
  • Replaced model_copy with copy for deep copying the response schema. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL185-R188](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L185-R188))
  • Simplified response parsing by using parse_obj instead of model_validate. ([autogpt/autogpt/agents/prompt_strategies/one_shot.pyL277-R280](https://github.com/Significant-Gravitas/AutoGPT/pull/8098/files#diff-8c61126a8cf1e5e161f76dc915c1d16282a92304ac3a15b0ec5c836197bfae36L277-R280))

Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit 23145ab
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66ebe8e6cfccf60008b6ee2b
😎 Deploy Preview https://deploy-preview-8098--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 41.17647% with 10 lines in your changes missing coverage. Please review.

Project coverage is 34.01%. Comparing base (0767b17) to head (23145ab).
Report is 236 commits behind head on master.

Files with missing lines Patch % Lines
...togpt/autogpt/agents/prompt_strategies/one_shot.py 41.17% 10 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (0767b17) and HEAD (23145ab). Click for more details.

HEAD has 16 uploads less than BASE
Flag BASE (0767b17) HEAD (23145ab)
macOS 6 2
agbenchmark 4 0
forge 4 0
Linux 3 1
Windows 3 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #8098       +/-   ##
===========================================
- Coverage   49.63%   34.01%   -15.62%     
===========================================
  Files         146       18      -128     
  Lines        8926     1273     -7653     
  Branches     1242      192     -1050     
===========================================
- Hits         4430      433     -3997     
+ Misses       4348      812     -3536     
+ Partials      148       28      -120     
Flag Coverage Δ
Linux 34.01% <41.17%> (-15.43%) ⬇️
Windows 33.86% <41.17%> (-15.88%) ⬇️
agbenchmark ?
autogpt-agent 34.01% <41.17%> (-0.09%) ⬇️
forge ?
macOS 34.01% <41.17%> (-14.89%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cccmolo
Copy link
Author

cccmolo commented Sep 19, 2024

This pull request includes several changes to the autogpt/autogpt/agents/prompt_strategies/one_shot.py file, focusing on improving code consistency and functionality. The most important changes include adding ellipses to Field definitions, introducing a new summaryv2 method, updating schema handling, and modifying logging levels.

Code Consistency and Functionality Improvements:

  • Updated Field definitions to include ellipses for consistency in AssistantThoughts class. (autogpt/autogpt/agents/prompt_strategies/one_shot.py)
  • Introduced a new summaryv2 method in the AssistantThoughts class to enhance task instructions. (autogpt/autogpt/agents/prompt_strategies/one_shot.py)

Schema Handling:

  • Changed response_schema initialization to use OneShotAgentActionProposal.schema() instead of model_json_schema(). (autogpt/autogpt/agents/prompt_strategies/one_shot.py)
  • Replaced model_copy with copy for deep copying the response schema. (autogpt/autogpt/agents/prompt_strategies/one_shot.py)
  • Updated response parsing to use parse_obj instead of model_validate. (autogpt/autogpt/agents/prompt_strategies/one_shot.py)

Logging:

  • Changed logging level from debug to info for LLM response content. (autogpt/autogpt/agents/prompt_strategies/one_shot.py)

@cccmolo cccmolo closed this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant