Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llama-index-core/llama_index/core/graph_stores/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def persist(
if not fs.exists(dirpath):
fs.makedirs(dirpath)

with fs.open(persist_path, "w") as f:
with fs.open(persist_path, "w", encoding="utf-8") as f:
json.dump(self._data.to_dict(), f)

def get_schema(self, refresh: bool = False) -> str:
Expand All @@ -172,7 +172,7 @@ def from_persist_path(
return cls()

logger.debug(f"Loading {__name__} from {persist_path}.")
with fs.open(persist_path, "rb") as f:
with fs.open(persist_path, "r", encoding="utf-8") as f:
data_dict = json.load(f)
data = SimpleGraphStoreData.from_dict(data_dict)
return cls(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def persist(
"""Persist the graph store to a file."""
if fs is None:
fs = fsspec.filesystem("file")
with fs.open(persist_path, "w") as f:
with fs.open(persist_path, "w", encoding="utf-8") as f:
f.write(self.graph.model_dump_json())

@classmethod
Expand All @@ -180,7 +180,7 @@ def from_persist_path(
if fs is None:
fs = fsspec.filesystem("file")

with fs.open(persist_path, "r") as f:
with fs.open(persist_path, "r", encoding="utf-8") as f:
data = json.loads(f.read())

return cls.from_dict(data)
Expand Down