add post_instruction hook

This commit is contained in:
BillSchumacher
2023-04-16 00:01:23 -05:00
parent 00225e01b3
commit 397627d1b9

View File

@@ -58,7 +58,10 @@ class AgentManager(metaclass=Singleton):
self.agents[key] = (task, messages, model)
return key, plugins_reply
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:
"""Send a message to an agent and return its response
@@ -98,7 +101,10 @@ class AgentManager(metaclass=Singleton):
if plugins_reply and plugins_reply != "":
messages.append({"role": "assistant", "content": plugins_reply})
return 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]]:
"""Return a list of all agents