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
fix(agent): Disable profile generator -> speed up agent setup #7121
base: master
Are you sure you want to change the base?
fix(agent): Disable profile generator -> speed up agent setup #7121
Conversation
Currently it's specified in an OpenAI-specific format, which might adversely affect performance with other providers.
…ace usages with `agent.state.*` This prevents potential state inconsistency between `agent` and `agent.state` when other values are assigned to `agent.ai_profile` and `agent.directives`
- Replace `generate_agent_for_task` by `create_agent` - Make `ai_profile` parameter on `create_agent` optional (use default `AIProfile` if not passed)
✅ Deploy Preview for auto-gpt-docs canceled.
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Description updated to latest commit (b0e02fa)
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Review
Code feedback:
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. CI Failure Feedback
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:
where Configuration options
See more information about the |
if not ai_profile: | ||
ai_profile = AIProfile() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: To avoid creating an unnecessary AIProfile
instance when ai_profile
is already provided, consider using a more efficient conditional assignment. [enhancement]
if not ai_profile: | |
ai_profile = AIProfile() | |
ai_profile = ai_profile or AIProfile() |
if not directives: | ||
directives = AIDirectives.from_file(app_config.prompt_settings_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Instead of using a simple conditional check for directives
, consider using a more Pythonic approach with or
to assign default values. [best practice]
if not directives: | |
directives = AIDirectives.from_file(app_config.prompt_settings_file) | |
directives = directives or AIDirectives.from_file(app_config.prompt_settings_file) |
@@ -156,7 +156,7 @@ def build_system_prompt( | |||
self.config.body_template.format( | |||
constraints=format_numbered_list( | |||
ai_directives.constraints | |||
+ self._generate_budget_constraint(ai_profile.api_budget) | |||
# + self._generate_budget_constraint(ai_profile.api_budget) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The commented-out code for generating budget constraints seems to be removed intentionally. If it's no longer needed, consider removing the commented line to clean up the code. [maintainability]
class SystemComponent(MessageProvider, CommandProvider): | ||
"""Component for system messages and commands.""" | ||
|
||
def __init__(self, config: Config, profile: AIProfile): | ||
def __init__(self, config: Config): | ||
self.legacy_config = config | ||
self.profile = profile | ||
|
||
def get_constraints(self) -> Iterator[str]: | ||
if self.profile.api_budget > 0.0: | ||
yield ( | ||
f"It takes money to let you run. " | ||
f"Your API budget is ${self.profile.api_budget:.3f}" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The SystemComponent
class has been simplified by removing the DirectiveProvider
role and associated methods. If the budget-related functionality is no longer needed, this change is appropriate. However, if budget constraints are still relevant, consider reintegrating or handling them differently. [possible issue]
class SystemComponent(MessageProvider, CommandProvider): | |
"""Component for system messages and commands.""" | |
def __init__(self, config: Config, profile: AIProfile): | |
def __init__(self, config: Config): | |
self.legacy_config = config | |
self.profile = profile | |
def get_constraints(self) -> Iterator[str]: | |
if self.profile.api_budget > 0.0: | |
yield ( | |
f"It takes money to let you run. " | |
f"Your API budget is ${self.profile.api_budget:.3f}" | |
) | |
class SystemComponent(MessageProvider, CommandProvider): | |
"""Component for system messages and commands.""" | |
def __init__(self, config: Config, profile: AIProfile): | |
self.legacy_config = config | |
self.profile = profile | |
def get_constraints(self) -> Iterator[str]: | |
if self.profile.api_budget > 0.0: | |
yield ( | |
f"It takes money to let you run. " | |
f"Your API budget is ${self.profile.api_budget:.3f}" | |
) |
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. Changelog updates: 2024-05-03Added
Changed
Fixed
|
PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here. PR Analysis
✨ Usage guide:Using static code analysis capabilities, the
Language that are currently supported: Python, Java, C++, JavaScript, TypeScript. |
…tor-on-agent-creation
CI Failure Feedback(Checks updated until commit a94d019)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:
where Configuration options
See more information about the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7121 +/- ##
==========================================
- Coverage 36.05% 35.43% -0.63%
==========================================
Files 19 18 -1
Lines 1273 1222 -51
Branches 182 181 -1
==========================================
- Hits 459 433 -26
+ Misses 786 761 -25
Partials 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
dee2ff8
to
eb6e386
Compare
…tor-on-agent-creation
eb6e386
to
4f30373
Compare
User description
AIProfile.api_budget
attributeagent.ai_profile
andagent.directives
attributesType
enhancement, bug_fix
Description
create_agent
to handle optional AIProfile, using defaults when not provided.profile_generator.py
for broader use.generate_agent_for_task
withcreate_agent
.SystemComponent
by removing unused directives related to AI profiles.AIProfile
to have default values and removed theapi_budget
attribute.api_budget
fromAIProfile
.Changes walkthrough
7 files
configurators.py
Refactor create_agent to Handle Optional AIProfile
autogpts/autogpt/autogpt/agent_factory/configurators.py
ai_profile
parameter optional increate_agent
function,defaulting to a new
AIProfile
instance if not provided.ai_profile
anddirectives
by creatingdefault instances within the function.
profile_generator.py
Simplify and Generalize Example Call in Profile Generator
autogpts/autogpt/autogpt/agent_factory/profile_generator.py
_example_call
to a more generalizedformat.
agent.py
Streamline Agent Initialization by Removing Specific Profiles
autogpts/autogpt/autogpt/agents/agent.py
ai_profile
anddirectives
from agent initialization, usingsystem-wide defaults instead.
agent_protocol_server.py
Optimize Agent Creation in Protocol Server
autogpts/autogpt/autogpt/app/agent_protocol_server.py
generate_agent_for_task
withcreate_agent
to streamline agentcreation.
main.py
Use Default AI Profiles in Main Application Flow
autogpts/autogpt/autogpt/app/main.py
setup.
profiles.
system.py
Simplify System Component by Removing Unused Directives
autogpts/autogpt/autogpt/commands/system.py
DirectiveProvider
implementation and related methods asai_profile
is no longer used here.ai_profile.py
Update AIProfile with Defaults and Remove Budget
autogpts/autogpt/autogpt/config/ai_profile.py
ai_name
andai_role
inAIProfile
.api_budget
attribute fromAIProfile
.1 files
one_shot.py
Disable Budget Constraint in System Prompt
autogpts/autogpt/autogpt/agents/prompt_strategies/one_shot.py
1 files
test_ai_profile.py
Update AIProfile Unit Tests for Budget Removal
autogpts/autogpt/tests/unit/test_ai_profile.py
api_budget
fromAIProfile
.