Applied lint
Browse files- lightrag/lightrag.py +10 -2
lightrag/lightrag.py
CHANGED
@@ -862,8 +862,16 @@ class LightRAG:
|
|
862 |
for chunk_data in custom_kg.get("chunks", {}):
|
863 |
chunk_content = chunk_data["content"].strip()
|
864 |
source_id = chunk_data["source_id"]
|
865 |
-
tokens = len(
|
866 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
867 |
chunk_id = compute_mdhash_id(chunk_content, prefix="chunk-")
|
868 |
|
869 |
chunk_entry = {
|
|
|
862 |
for chunk_data in custom_kg.get("chunks", {}):
|
863 |
chunk_content = chunk_data["content"].strip()
|
864 |
source_id = chunk_data["source_id"]
|
865 |
+
tokens = len(
|
866 |
+
encode_string_by_tiktoken(
|
867 |
+
chunk_content, model_name=self.tiktoken_model_name
|
868 |
+
)
|
869 |
+
)
|
870 |
+
chunk_order_index = (
|
871 |
+
0
|
872 |
+
if "chunk_order_index" not in chunk_data.keys()
|
873 |
+
else chunk_data["chunk_order_index"]
|
874 |
+
)
|
875 |
chunk_id = compute_mdhash_id(chunk_content, prefix="chunk-")
|
876 |
|
877 |
chunk_entry = {
|