Skip to content

Commit

Permalink
Fix bugs running the core cli-app (Significant-Gravitas#4905)
Browse files Browse the repository at this point in the history
Co-authored-by: Luke <[email protected]>
  • Loading branch information
collijk and lc0rp authored Jul 8, 2023
1 parent 57315bd commit 8bce027
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
14 changes: 11 additions & 3 deletions autogpt/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,26 @@ The first app is a straight CLI application. I have not done anything yet to po
- [Entry Point](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_app/cli.py)
- [Client Application](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_app/main.py)

To run, you first need a settings file. Run
Auto-GPT must be installed in your python environment to run this application. To do so, run

```
pip install -e REPOSITORY_ROOT
```

where `REPOSITORY_ROOT` is the root of the Auto-GPT repository on your machine.

You'll then need a settings file. Run

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_app/cli.py make-settings
```

where `REPOSITORY_ROOT` is the root of the Auto-GPT repository on your machine. This will write a file called `default_agent_settings.yaml` with all the user-modifiable configuration keys to `~/auto-gpt/default_agent_settings.yml` and make the `auto-gpt` directory in your user directory if it doesn't exist). At a bare minimum, you'll need to set `openai.credentials.api_key` to your OpenAI API Key to run the model.
This will write a file called `default_agent_settings.yaml` with all the user-modifiable configuration keys to `~/auto-gpt/default_agent_settings.yml` and make the `auto-gpt` directory in your user directory if it doesn't exist). At a bare minimum, you'll need to set `openai.credentials.api_key` to your OpenAI API Key to run the model.

You can then run Auto-GPT with

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_app/cli.py make-settings
python REPOSITORY_ROOT/autogpt/core/runner/cli_app/cli.py run
```

to launch the interaction loop.
Expand Down
4 changes: 4 additions & 0 deletions autogpt/core/ability/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ class AbilityResult(BaseModel):
success: bool
message: str
new_knowledge: Knowledge = None

def summary(self) -> str:
kwargs = ", ".join(f"{k}={v}" for k, v in self.ability_args.items())
return f"{self.ability_name}({kwargs}): {self.message}"
9 changes: 1 addition & 8 deletions autogpt/core/agent/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
class AgentSystems(SystemConfiguration):
ability_registry: PluginLocation
memory: PluginLocation
embedding_model: PluginLocation
openai_provider: PluginLocation
planning: PluginLocation
workspace: PluginLocation
Expand Down Expand Up @@ -148,12 +147,6 @@ def from_workspace(
agent_settings,
logger,
)
agent_args["embedding_model"] = cls._get_system_instance(
"embedding_model",
agent_settings,
logger,
model_providers={"openai": agent_args["openai_provider"]},
)
agent_args["planning"] = cls._get_system_instance(
"planning",
agent_settings,
Expand Down Expand Up @@ -226,7 +219,7 @@ async def execute_next_ability(self, user_input: str, *args, **kwargs):
self._current_task = None
self._next_ability = None

return ability_response
return ability_response.dict()
else:
raise NotImplementedError

Expand Down
4 changes: 2 additions & 2 deletions autogpt/core/planning/strategies/next_ability.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def build_prompt(
)
template_kwargs["additional_info"] = to_numbered_list(
[memory.summary() for memory in task.context.memories]
+ [info.summary() for info in task.context.supplementary_info],
+ [info for info in task.context.supplementary_info],
no_items_response="There is no additional information available at this time.",
**template_kwargs,
)
template_kwargs["user_input"] = to_numbered_list(
[user_input.summary() for user_input in task.context.user_input],
[user_input for user_input in task.context.user_input],
no_items_response="There are no additional considerations at this time.",
**template_kwargs,
)
Expand Down
2 changes: 0 additions & 2 deletions autogpt/core/runner/cli_app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from autogpt.core.runner.client_lib.shared_click_commands import (
DEFAULT_SETTINGS_FILE,
make_settings,
status,
)
from autogpt.core.runner.client_lib.utils import coroutine, handle_exceptions

Expand All @@ -19,7 +18,6 @@ def autogpt():


autogpt.add_command(make_settings)
autogpt.add_command(status)


@autogpt.command()
Expand Down
4 changes: 3 additions & 1 deletion autogpt/core/runner/cli_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def parse_next_ability(current_task, next_ability: dict) -> str:


def parse_ability_result(ability_result) -> str:
parsed_response = f"Ability: {ability_result['ability_name']}\n"
parsed_response += f"Ability Arguments: {ability_result['ability_args']}\n"
parsed_response = f"Ability Result: {ability_result['success']}\n"
parsed_response += f"Message: {ability_result['message']}\n"
parsed_response += f"Data: {ability_result['data']}\n"
parsed_response += f"Data: {ability_result['new_knowledge']}\n"
return parsed_response
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spacy>=3.0.0,<4.0.0
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl
prompt_toolkit>=3.0.38
pydantic
inflection

# web server
fastapi
Expand Down

0 comments on commit 8bce027

Please sign in to comment.