From 01573c1375d2912447e92e484ebebb3a0b5eb025 Mon Sep 17 00:00:00 2001 From: Alex Kondratev <56111142+soapun@users.noreply.github.com> Date: Mon, 24 Nov 2025 04:22:50 +0300 Subject: [PATCH] fix(core): `ensure_ascii=False` in `PydanticOutputParser` exception formatting (#34006) - **Description:** When formatting an error, `PydanticOutputParser` dumps json with default `ensure_ascii=True` - **Issue:** Fixes #34005 - **Dependencies:** None - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. **We will not consider a PR unless these three are passing in CI.** See [contribution guidelines](https://docs.langchain.com/oss/python/contributing) for more. Co-authored-by: Mason Daugherty --- libs/core/langchain_core/output_parsers/pydantic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/langchain_core/output_parsers/pydantic.py b/libs/core/langchain_core/output_parsers/pydantic.py index f9076a8158f..9cfc14526ab 100644 --- a/libs/core/langchain_core/output_parsers/pydantic.py +++ b/libs/core/langchain_core/output_parsers/pydantic.py @@ -37,7 +37,7 @@ class PydanticOutputParser(JsonOutputParser, Generic[TBaseModel]): def _parser_exception( self, e: Exception, json_object: dict ) -> OutputParserException: - json_string = json.dumps(json_object) + json_string = json.dumps(json_object, ensure_ascii=False) name = self.pydantic_object.__name__ msg = f"Failed to parse {name} from completion {json_string}. Got: {e}" return OutputParserException(msg, llm_output=json_string)