Skip to content

The agent engineering platform.

Get elements of ActionInput on newlines (#889)

Samantha Whitmore32b11101d3be
diff --git a/langchain/agents/mrkl/base.py b/langchain/agents/mrkl/base.py
index fb2acfb4a4..4477cb6d70 100644
--- a/langchain/agents/mrkl/base.py
+++ b/langchain/agents/mrkl/base.py
@@ -40,7 +40,7 @@ def get_action_and_input(llm_output: str) -> Tuple[str, str]:
if FINAL_ANSWER_ACTION in llm_output:
return "Final Answer", llm_output.split(FINAL_ANSWER_ACTION)[-1].strip()
regex = r"Action: (.*?)\nAction Input: (.*)"
- match = re.search(regex, llm_output)
+ match = re.search(regex, llm_output, re.DOTALL)
if not match:
raise ValueError(f"Could not parse LLM output: `{llm_output}`")
action = match.group(1).strip()