Skip to content

Commit

Permalink
ml4bio agent with memory callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
minump committed Nov 20, 2023
1 parent 4ac7d52 commit 7c2ee11
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ai_ta_backend/agents/ml4bio_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
load_agent_executor,
load_chat_planner)

from tools import get_tools
from utils import fancier_trim_intermediate_steps
from .tools import get_tools
from .utils import fancier_trim_intermediate_steps
from .memorycallbacks import get_memory_callback_handler


def get_user_info_string():
Expand All @@ -37,9 +38,11 @@ def run(self, input):
print(f"Result: {result}")
return result


def make_agent(self):
# TOOLS
tools = get_tools()
memory_handler = get_memory_callback_handler()

# PLANNER
planner = load_chat_planner(self.llm, system_prompt=hub.pull("kastanday/ml4bio-rnaseq-planner").format(user_info=get_user_info_string))
Expand All @@ -50,6 +53,6 @@ def make_agent(self):
executor = load_agent_executor(self.llm, tools, verbose=True, handle_parsing_errors=True)

# Create PlanAndExecute Agent
workflow_agent = PlanAndExecute(planner=planner, executor=executor, verbose=True)
workflow_agent = PlanAndExecute(planner=planner, executor=executor, verbose=True, callbacks=[memory_handler])

return workflow_agent

0 comments on commit 7c2ee11

Please sign in to comment.