LarFii
commited on
Commit
·
b40f83e
1
Parent(s):
146956b
update utils.py
Browse files- lightrag/utils.py +2 -2
lightrag/utils.py
CHANGED
@@ -94,11 +94,11 @@ def wrap_embedding_func_with_attrs(**kwargs):
|
|
94 |
def load_json(file_name):
|
95 |
if not os.path.exists(file_name):
|
96 |
return None
|
97 |
-
with open(file_name) as f:
|
98 |
return json.load(f)
|
99 |
|
100 |
def write_json(json_obj, file_name):
|
101 |
-
with open(file_name, "w") as f:
|
102 |
json.dump(json_obj, f, indent=2, ensure_ascii=False)
|
103 |
|
104 |
def encode_string_by_tiktoken(content: str, model_name: str = "gpt-4o"):
|
|
|
94 |
def load_json(file_name):
|
95 |
if not os.path.exists(file_name):
|
96 |
return None
|
97 |
+
with open(file_name, encoding="utf-8") as f:
|
98 |
return json.load(f)
|
99 |
|
100 |
def write_json(json_obj, file_name):
|
101 |
+
with open(file_name, "w", encoding="utf-8") as f:
|
102 |
json.dump(json_obj, f, indent=2, ensure_ascii=False)
|
103 |
|
104 |
def encode_string_by_tiktoken(content: str, model_name: str = "gpt-4o"):
|