allow optional newline in the action responses of JSON Agent parser (#17186)

Based on my experiments, the newline isn't always there, so we can make
the regex slightly more robust by allowing an optional newline after the
bacticks
pull/17190/head
Tomaz Bratanic 4 months ago committed by GitHub
parent 9fa07076da
commit 302989a2b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -42,7 +42,7 @@ class ReActJsonSingleInputOutputParser(AgentOutputParser):
"""
pattern = re.compile(r"^.*?`{3}(?:json)?\n(.*?)`{3}.*?$", re.DOTALL)
pattern = re.compile(r"^.*?`{3}(?:json)?\n?(.*?)`{3}.*?$", re.DOTALL)
"""Regex pattern to parse the output."""
def get_format_instructions(self) -> str:

Loading…
Cancel
Save