forked from Significant-Gravitas/AutoGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix execute_command coming from plugins (Significant-Gravitas#4729)
Signed-off-by: Merwane Hamadi <[email protected]>
- Loading branch information
1 parent
dc1b484
commit 096d27f
Showing
3 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from autogpt.agent import Agent | ||
from autogpt.app import execute_command | ||
|
||
|
||
def check_plan(): | ||
return "hi" | ||
|
||
|
||
def test_execute_command_plugin(agent: Agent): | ||
"""Test that executing a command that came from a plugin works as expected""" | ||
agent.ai_config.prompt_generator.add_command( | ||
"check_plan", | ||
"Read the plan.md with the next goals to achieve", | ||
{}, | ||
check_plan, | ||
) | ||
command_name = "check_plan" | ||
arguments = {} | ||
command_result = execute_command( | ||
command_name=command_name, | ||
arguments=arguments, | ||
agent=agent, | ||
) | ||
assert command_result == "hi" |