|
|
@ -78,7 +78,7 @@ class ConversationalAgent(Agent):
|
|
|
|
def _extract_tool_and_input(self, llm_output: str) -> Optional[Tuple[str, str]]:
|
|
|
|
def _extract_tool_and_input(self, llm_output: str) -> Optional[Tuple[str, str]]:
|
|
|
|
if f"{self.ai_prefix}:" in llm_output:
|
|
|
|
if f"{self.ai_prefix}:" in llm_output:
|
|
|
|
return self.ai_prefix, llm_output.split(f"{self.ai_prefix}:")[-1].strip()
|
|
|
|
return self.ai_prefix, llm_output.split(f"{self.ai_prefix}:")[-1].strip()
|
|
|
|
regex = r"Action: (.*?)\nAction Input: (.*)"
|
|
|
|
regex = r"Action: (.*?)[\n]*Action Input: (.*)"
|
|
|
|
match = re.search(regex, llm_output)
|
|
|
|
match = re.search(regex, llm_output)
|
|
|
|
if not match:
|
|
|
|
if not match:
|
|
|
|
raise ValueError(f"Could not parse LLM output: `{llm_output}`")
|
|
|
|
raise ValueError(f"Could not parse LLM output: `{llm_output}`")
|
|
|
|