Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add working memory for the agent prompt prefix and suffix hook #567

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/cat/looking_glass/agent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def execute_agent(self, working_memory):
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)
prompt_prefix = mad_hatter.execute_hook("agent_prompt_prefix", prompts.MAIN_PROMPT_PREFIX, working_memory)
prompt_suffix = mad_hatter.execute_hook("agent_prompt_suffix", prompts.MAIN_PROMPT_SUFFIX, working_memory)


# tools currently recalled in working memory
Expand Down
9 changes: 7 additions & 2 deletions core/cat/mad_hatter/core_plugin/hooks/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@hook(priority=0)
def agent_prompt_prefix(prefix, cat) -> str:
def agent_prompt_prefix(prefix, working_memory, cat) -> str:
"""Hook the main prompt prefix.

Allows to edit the prefix of the *Main Prompt* that the Cat feeds to the *Agent*.
Expand All @@ -24,6 +24,8 @@ def agent_prompt_prefix(prefix, cat) -> str:
cat : CheshireCat
Cheshire Cat instance.

working_memory : WorkingMemory

Returns
-------
prefix : str
Expand Down Expand Up @@ -53,6 +55,7 @@ def agent_prompt_instructions(instructions: str, cat) -> str:
cat : CheshireCat
Cheshire Cat instance.


Returns
-------
instructions : str
Expand All @@ -78,7 +81,7 @@ def agent_prompt_instructions(instructions: str, cat) -> str:


@hook(priority=0)
def agent_prompt_suffix(prompt_suffix: str, cat) -> str:
def agent_prompt_suffix(prompt_suffix: str, working_memory, cat) -> str:
"""Hook the main prompt suffix.

Allows to edit the suffix of the *Main Prompt* that the Cat feeds to the *Agent*.
Expand All @@ -91,6 +94,8 @@ def agent_prompt_suffix(prompt_suffix: str, cat) -> str:
cat : CheshireCat
Cheshire Cat instance.

working_memory : WorkingMemory

Returns
-------
suffix : str
Expand Down
Loading