diff --git a/libs/langchain/langchain/callbacks/file.py b/libs/langchain/langchain/callbacks/file.py index 3265fa0060..d5dff48900 100644 --- a/libs/langchain/langchain/callbacks/file.py +++ b/libs/langchain/langchain/callbacks/file.py @@ -13,7 +13,7 @@ class FileCallbackHandler(BaseCallbackHandler): self, filename: str, mode: str = "a", color: Optional[str] = None ) -> None: """Initialize callback handler.""" - self.file = cast(TextIO, open(filename, mode)) + self.file = cast(TextIO, open(filename, mode, encoding="utf-8")) self.color = color def __del__(self) -> None: