From 76730a90da8721fba36efc3b4f7ba1d7018d19df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Messias=20Lima=20Pereira?= Date: Sat, 11 Jan 2025 18:01:46 -0300 Subject: [PATCH] Change save and load encode to utf-8 --- src/ragas/prompt/pydantic_prompt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ragas/prompt/pydantic_prompt.py b/src/ragas/prompt/pydantic_prompt.py index fb1408533..6443d5347 100644 --- a/src/ragas/prompt/pydantic_prompt.py +++ b/src/ragas/prompt/pydantic_prompt.py @@ -328,13 +328,13 @@ def save(self, file_path: str): } if os.path.exists(file_path): raise FileExistsError(f"The file '{file_path}' already exists.") - with open(file_path, "w") as f: + with open(file_path, "w", encoding="utf-8") as f: json.dump(data, f, indent=2, ensure_ascii=False) print(f"Prompt saved to {file_path}") @classmethod def load(cls, file_path: str) -> "PydanticPrompt[InputModel, OutputModel]": - with open(file_path, "r") as f: + with open(file_path, "r", encoding="utf-8") as f: data = json.load(f) # You might want to add version compatibility checks here