conversational agent fix (#818)

harrison/image
Harrison Chase 1 year ago committed by GitHub
parent 94ae126747
commit 5d4b6e4d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,8 +75,8 @@ class ConversationalAgent(Agent):
return self.ai_prefix
def _extract_tool_and_input(self, llm_output: str) -> Optional[Tuple[str, str]]:
if f"{self.ai_prefix}: " in llm_output:
return self.ai_prefix, llm_output.split(f"{self.ai_prefix}: ")[-1]
if f"{self.ai_prefix}:" in llm_output:
return self.ai_prefix, llm_output.split(f"{self.ai_prefix}:")[-1].strip()
regex = r"Action: (.*?)\nAction Input: (.*)"
match = re.search(regex, llm_output)
if not match:

Loading…
Cancel
Save