Skip to content

Commit

Permalink
Change save and load encode to utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
joaorura authored Jan 11, 2025
1 parent f265cf5 commit 76730a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ragas/prompt/pydantic_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76730a9

Please sign in to comment.