Skip to content

The agent engineering platform.

fix: invalid escape sequence error in regex pattern (#3902)

tomer5559acf80fd697c
diff --git a/langchain/output_parsers/pydantic.py b/langchain/output_parsers/pydantic.py
index e1e5e716a5..4b0fa53d54 100644
--- a/langchain/output_parsers/pydantic.py
+++ b/langchain/output_parsers/pydantic.py
@@ -17,7 +17,7 @@ class PydanticOutputParser(BaseOutputParser[T]):
try:
# Greedy search for 1st json candidate.
match = re.search(
- "\{.*\}", text.strip(), re.MULTILINE | re.IGNORECASE | re.DOTALL
+ r"\{.*\}", text.strip(), re.MULTILINE | re.IGNORECASE | re.DOTALL
)
json_str = ""
if match: