docs
docs copied to clipboard
Add the new hook agent_fast_reply in process diagram
The new hook is called here:
def execute_agent(self, working_memory):
"""Instantiate the Agent with tools.
The method formats the main prompt and gather the allowed tools. It also instantiates a conversational Agent
from Langchain.
Returns
-------
agent_executor : AgentExecutor
Instance of the Agent provided with a set of tools.
"""
mad_hatter = self.cat.mad_hatter
# prepare input to be passed to the agent.
# Info will be extracted from working memory
agent_input = self.format_agent_input(working_memory)
agent_input = mad_hatter.execute_hook("before_agent_starts", agent_input)
# should we ran the default agent?
fast_reply = {}
fast_reply = mad_hatter.execute_hook("agent_fast_reply", fast_reply) <---------------------
if len(fast_reply.keys()) > 0:
return fast_reply
prompt_prefix = mad_hatter.execute_hook("agent_prompt_prefix", prompts.MAIN_PROMPT_PREFIX)
prompt_suffix = mad_hatter.execute_hook("agent_prompt_suffix", prompts.MAIN_PROMPT_SUFFIX)