Tools cache and delegation improvements (#68)

* Fixing repeated tool usage treatment
* Improving agent delegation prompt
This commit is contained in:
João Moura
2024-01-06 11:46:34 -03:00
committed by GitHub
parent 7a22b03713
commit 234a2c72b0
4 changed files with 26 additions and 16 deletions

View File

@@ -5,15 +5,19 @@ class TaskRepeatedUsageException(OutputParserException):
"""Exception raised when a task is used twice in a roll."""
error: str = "TaskRepeatedUsageException"
message: str = "\nI just used the {tool} tool with input {tool_input}. So I already know the result of that.\n"
message: str = "I just used the {tool} tool with input {tool_input}. So I already know the result of that and don't need to use it now.\n"
def __init__(self, tool: str, tool_input: str):
def __init__(self, tool: str, tool_input: str, text: str):
self.text = text
self.tool = tool
self.tool_input = tool_input
self.message = self.message.format(tool=tool, tool_input=tool_input)
super().__init__(
error=self.error, observation=self.message, send_to_llm=True, llm_output=""
error=self.error,
observation=self.message,
send_to_llm=True,
llm_output=self.text,
)
def __str__(self):