🐛 Fix pre_instruction

pull/2531/head
Taylor Beeston 2023-04-17 12:40:46 -07:00
parent 239aa3aa02
commit dea5000a01
No known key found for this signature in database
GPG Key ID: 5627A4571915CEE9
1 changed files with 6 additions and 3 deletions

View File

@ -1,9 +1,12 @@
"""Agent manager for managing GPT agents"""
from __future__ import annotations
from typing import List
from autogpt.config.config import Config, Singleton
from autogpt.llm_utils import create_chat_completion
from plugin_template import Message
class AgentManager(metaclass=Singleton):
"""Agent manager for managing GPT agents"""
@ -27,7 +30,7 @@ class AgentManager(metaclass=Singleton):
Returns:
The key of the new agent
"""
messages = [
messages: List[Message] = [
{"role": "user", "content": prompt},
]
for plugin in self.cfg.plugins:
@ -36,7 +39,7 @@ class AgentManager(metaclass=Singleton):
plugin_messages = plugin.pre_instruction(messages)
if plugin_messages:
for plugin_message in plugin_messages:
messages.append({"role": "system", "content": plugin_message})
messages.append(plugin_message)
# Start GPT instance
agent_reply = create_chat_completion(
@ -92,7 +95,7 @@ class AgentManager(metaclass=Singleton):
plugin_messages = plugin.pre_instruction(messages)
if plugin_messages:
for plugin_message in plugin_messages:
messages.append({"role": "system", "content": plugin_message})
messages.append(plugin_message)
# Start GPT instance
agent_reply = create_chat_completion(