mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-02 17:54:23 +00:00
conversational agent fix (#818)
This commit is contained in:
parent
94ae126747
commit
5d4b6e4d4e
@ -75,8 +75,8 @@ class ConversationalAgent(Agent):
|
|||||||
return self.ai_prefix
|
return self.ai_prefix
|
||||||
|
|
||||||
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]
|
return self.ai_prefix, llm_output.split(f"{self.ai_prefix}:")[-1].strip()
|
||||||
regex = r"Action: (.*?)\nAction Input: (.*)"
|
regex = r"Action: (.*?)\nAction Input: (.*)"
|
||||||
match = re.search(regex, llm_output)
|
match = re.search(regex, llm_output)
|
||||||
if not match:
|
if not match:
|
||||||
|
Loading…
Reference in New Issue
Block a user