Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Merge branch 'master' of https://github.com/BillSchumacher/Auto-GPT into plugin-support

BillSchumacherc544cebbe61a
diff --cc README.md
index bf05ac4b68,21f3ccf26f..2fdf65a8cb
--- a/README.md
+++ b/README.md
@@@ -254,19 -268,19 +268,43 @@@ export GOOGLE_API_KEY="YOUR_GOOGLE_API_
export CUSTOM_SEARCH_ENGINE_ID="YOUR_CUSTOM_SEARCH_ENGINE_ID"
```
+## Plugins
+
+See https://github.com/Torantulino/Auto-GPT-Plugin-Template for the template of the plugins.
+
+⚠️💀 WARNING 💀⚠️: Review the code of any plugin you use, this allows for any Python to be executed and do malicious things. Like stealing your API keys.
+
+Drop the repo's zipfile in the plugins folder.
+
+![Download Zip](https://raw.githubusercontent.com/BillSchumacher/Auto-GPT/master/plugin.png)
+
+If you add the plugins class name to the whitelist in the config.py you will not be prompted otherwise you'll be warned before loading the plugin.
+
- ## Redis Setup
++## Plugins
++
++See https://github.com/Torantulino/Auto-GPT-Plugin-Template for the template of the plugins.
++
++⚠️💀 WARNING 💀⚠️: Review the code of any plugin you use, this allows for any Python to be executed and do malicious things. Like stealing your API keys.
++
++Drop the repo's zipfile in the plugins folder.
++
++![Download Zip](https://raw.githubusercontent.com/BillSchumacher/Auto-GPT/master/plugin.png)
++
++If you add the plugins class name to the whitelist in the config.py you will not be prompted otherwise you'll be warned before loading the plugin.
++
+ ## Setting Your Cache Type
+
+ By default, Auto-GPT is going to use LocalCache instead of redis or Pinecone.
+
+ To switch to either, change the `MEMORY_BACKEND` env variable to the value that you want:
+
+ * `local` (default) uses a local JSON cache file
+ * `pinecone` uses the Pinecone.io account you configured in your ENV settings
+ * `redis` will use the redis cache that you configured
+ * `milvus` will use the milvus cache that you configured
+ * `weaviate` will use the weaviate cache that you configured
+
+ ### Redis Setup
> _**CAUTION**_ \
This is not intended to be publicly accessible and lacks security measures. Therefore, avoid exposing Redis to the internet without a password or at all
1. Install docker desktop
diff --cc autogpt/agent/agent_manager.py
index 85b61b7181,e4bfb12611..7b72f678aa
--- a/autogpt/agent/agent_manager.py
+++ b/autogpt/agent/agent_manager.py
@@@ -1,7 -1,8 +1,8 @@@
"""Agent manager for managing GPT agents"""
- from typing import List, Tuple, Union
+ from __future__ import annotations
+
from autogpt.llm_utils import create_chat_completion
-from autogpt.config.config import Singleton
+from autogpt.config.config import Singleton, Config
class AgentManager(metaclass=Singleton):
@@@ -59,12 -46,9 +60,12 @@@
self.agents[key] = (task, messages, model)
+ for plugin in self.cfg.plugins:
+ agent_reply = plugin.post_instruction(agent_reply)
+
return key, agent_reply
- def message_agent(self, key: Union[str, int], message: str) -> str:
+ def message_agent(self, key: str | int, message: str) -> str:
"""Send a message to an agent and return its response
Args:
@@@ -91,24 -69,12 +92,24 @@@
messages=messages,
)
- # Update full message history
messages.append({"role": "assistant", "content": agent_reply})
+ plugins_reply = agent_reply
+ for i, plugin in enumerate(self.cfg.plugins):
+ plugin_result = plugin.on_instruction(messages)
+ if plugin_result:
+ sep = '' if not i else '\n'
+ plugins_reply = f"{plugins_reply}{sep}{plugin_result}"
+ # Update full message history
+ if plugins_reply and plugins_reply != "":
+ messages.append({"role": "assistant", "content": plugins_reply})
+
+ for plugin in self.cfg.plugins:
+ agent_reply = plugin.post_instruction(agent_reply)
+
return agent_reply
- def list_agents(self) -> List[Tuple[Union[str, int], str]]:
+ def list_agents(self) -> list[tuple[str | int, str]]:
"""Return a list of all agents
Returns:
@@@ -118,7 -84,7 +119,7 @@@
# Return a list of agent keys and their tasks
return [(key, task) for key, (task, _, _) in self.agents.items()]
-- def delete_agent(self, key: Union[str, int]) -> bool:
++ def delete_agent(self, key: str | int) -> bool:
"""Delete an agent from the agent manager
Args:
diff --cc autogpt/config/ai_config.py
index c3159b994d,86171357ba..d18c75ba7d
--- a/autogpt/config/ai_config.py
+++ b/autogpt/config/ai_config.py
@@@ -2,13 -2,12 +2,15 @@@
"""
A module that contains the AIConfig class object that contains the configuration
"""
+ from __future__ import annotations
+
import os
+from pathlib import Path
- from typing import List, Optional
+ from typing import Type
import yaml
+from autogpt.prompts.generator import PromptGenerator
+
class AIConfig:
"""
diff --cc autogpt/prompts/prompt.py
index 24501cea83,18a5736c19..91279da7b5
--- a/autogpt/prompts/prompt.py
+++ b/autogpt/prompts/prompt.py
@@@ -81,9 -85,18 +81,18 @@@ def build_default_prompt_generator() -
("Send Tweet", "send_tweet", {"text": "<text>"}),
]
+ # Only add the audio to text command if the model is specified
+ if cfg.huggingface_audio_to_text_model:
+ commands.append(
+ (
+ "Convert Audio to text",
+ "read_audio_from_file",
+ {"file": "<file>"}
+ ),
+ )
+
# Only add shell command to the prompt if the AI is allowed to execute it
- if cfg.execute_local_commands:
+ if CFG.execute_local_commands:
commands.append(
(
"Execute Shell Command, non-interactive commands only",
@@@ -163,6 -177,10 +172,6 @@@ Continue (y/n): ""
if not config.ai_name:
config = prompt_user()
- config.save()
+ config.save(CFG.ai_settings_file)
- # Get rid of this global:
- global ai_name
- ai_name = config.ai_name
-
- return config.construct_full_prompt()
+ return config