Skip to content

Commit

Permalink
Removing Query Filter for now (#145)
Browse files Browse the repository at this point in the history
* Removing Query Filter for bad performance

* removing unnecesary tests
  • Loading branch information
Jgmedina95 authored Jun 27, 2024
1 parent f91db15 commit 30dae87
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 440 deletions.
28 changes: 18 additions & 10 deletions mdagent/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..tools import get_tools, make_all_tools
from ..utils import PathRegistry, SetCheckpoint, _make_llm
from .memory import MemoryManager
from .query_filter import make_prompt
from .prompt import openaifxn_prompt, structured_prompt

load_dotenv()

Expand Down Expand Up @@ -102,9 +102,10 @@ def _initialize_tools_and_agent(self, user_input=None):

def run(self, user_input, callbacks=None):
run_memory = self.memory.run_id_mem if self.use_memory else None
self.prompt = make_prompt(
user_input, self.agent_type, model="gpt-3.5-turbo", run_memory=run_memory
)
if self.agent_type == "Structured":
self.prompt = structured_prompt.format(input=user_input, context=run_memory)
elif self.agent_type == "OpenAIFunctionsAgent":
self.prompt = openaifxn_prompt.format(input=user_input, context=run_memory)
self.agent = self._initialize_tools_and_agent(user_input)
model_output = self.agent.run(self.prompt, callbacks=callbacks)
if self.use_memory:
Expand All @@ -113,13 +114,20 @@ def run(self, user_input, callbacks=None):
return model_output, self.run_id

def iter(self, user_input, include_run_info=True):
run_memory = self.memory.run_id_mem if self.use_memory else None

if self.agent is None:
self.prompt = make_prompt(
user_input, self.agent_type, model="gpt-3.5-turbo"
)
self.agent = self._initialize_tools_and_agent(user_input)
for step in self.agent.iter(self.prompt, include_run_info=include_run_info):
yield step
if self.agent_type == "Structured":
self.prompt = structured_prompt.format(
input=user_input, context=run_memory
)
elif self.agent_type == "OpenAIFunctionsAgent":
self.prompt = openaifxn_prompt.format(
input=user_input, context=run_memory
)
self.agent = self._initialize_tools_and_agent(user_input)
for step in self.agent.iter(self.prompt, include_run_info=include_run_info):
yield step

def force_clear_mem(self, all=False) -> str:
if all:
Expand Down
341 changes: 0 additions & 341 deletions mdagent/agent/query_filter.py

This file was deleted.

Loading

0 comments on commit 30dae87

Please sign in to comment.