You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, great project. I am very excited with it.
Question is:
How do I correctly tell parser.py to make a next AgentAction or AgentFinish if there is no matches.
This happens everytime my tool cannot find anything in product_catalog to answer the question
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
if self.verbose:
print("TEXT")
print(text)
print("-------")
if f"{self.ai_prefix}:" in text:
return AgentFinish(
{"output": text.split(f"{self.ai_prefix}:")[-1].strip()}, text
)
regex = r"Action: (.*?)[\n]*Action Input: (.*)"
match = re.search(regex, text)
if not match:
## TODO - this is not entirely reliable, sometimes results in an error.
return AgentFinish(
{
"output": "I apologize, I was unable to find the answer to your question. Is there anything else I can help with?"
},
text,
)
# raise OutputParserException(f"Could not parse LLM output: `{text}`")
action = match.group(1)
action_input = match.group(2)
return AgentAction(action.strip(), action_input.strip(" ").strip('"'), text)
currently this part just outputs "I apologize...." as final answer.
The text was updated successfully, but these errors were encountered:
Bebezumni
changed the title
Chain, after using tools, when no matches found, outputs 'Sorry'
agent after using tools, when no matches found, outputs 'Sorry'
Dec 16, 2023
As I found out this part outputs error, if agent on previous stage generated an answer without correct formatting like below:
Thought: Do i need to you a tool? No
Action:Some action
Here is my fix, not sure if everything is correct but all the systems started to work as expected
Changed this:
if not match:
## TODO - this is not entirely reliable, sometimes results in an error.
return AgentFinish(
{
"output": "I apologize, I was unable to find the answer to your question. Is there anything else I can help with?"
},
text,
)
# raise OutputParserException(f"Could not parse LLM output: `{text}`")
On this:
if not match:
return AgentAction('Thought: Do I need to use a tool? No', f"{self.ai_prefix}:", text)
Hello, great project. I am very excited with it.
Question is:
How do I correctly tell parser.py to make a next AgentAction or AgentFinish if there is no matches.
This happens everytime my tool cannot find anything in product_catalog to answer the question
currently this part just outputs "I apologize...." as final answer.
The text was updated successfully, but these errors were encountered: