YanSte commited on
Commit
735a2ca
·
1 Parent(s): 3755a9b

fixed str enum

Browse files
Files changed (2) hide show
  1. lightrag/base.py +2 -2
  2. lightrag/lightrag.py +4 -4
lightrag/base.py CHANGED
@@ -1,7 +1,7 @@
1
  from __future__ import annotations
2
 
3
  from abc import ABC, abstractmethod
4
- from enum import StrEnum
5
  import os
6
  from dotenv import load_dotenv
7
  from dataclasses import dataclass, field
@@ -205,7 +205,7 @@ class BaseGraphStorage(StorageNameSpace, ABC):
205
  """Retrieve a subgraph of the knowledge graph starting from a given node."""
206
 
207
 
208
- class DocStatus(StrEnum):
209
  """Document processing status"""
210
 
211
  PENDING = "pending"
 
1
  from __future__ import annotations
2
 
3
  from abc import ABC, abstractmethod
4
+ from enum import Enum
5
  import os
6
  from dotenv import load_dotenv
7
  from dataclasses import dataclass, field
 
205
  """Retrieve a subgraph of the knowledge graph starting from a given node."""
206
 
207
 
208
+ class DocStatus(str, Enum):
209
  """Document processing status"""
210
 
211
  PENDING = "pending"
lightrag/lightrag.py CHANGED
@@ -674,7 +674,7 @@ class LightRAG:
674
  "content": content,
675
  "content_summary": self._get_content_summary(content),
676
  "content_length": len(content),
677
- "status": DocStatus.PENDING.value,
678
  "created_at": datetime.now().isoformat(),
679
  "updated_at": datetime.now().isoformat(),
680
  }
@@ -745,7 +745,7 @@ class LightRAG:
745
  await self.doc_status.upsert(
746
  {
747
  doc_status_id: {
748
- "status": DocStatus.PROCESSING.value,
749
  "updated_at": datetime.now().isoformat(),
750
  "content": status_doc.content,
751
  "content_summary": status_doc.content_summary,
@@ -782,7 +782,7 @@ class LightRAG:
782
  await self.doc_status.upsert(
783
  {
784
  doc_status_id: {
785
- "status": DocStatus.PROCESSED.value,
786
  "chunks_count": len(chunks),
787
  "content": status_doc.content,
788
  "content_summary": status_doc.content_summary,
@@ -799,7 +799,7 @@ class LightRAG:
799
  await self.doc_status.upsert(
800
  {
801
  doc_status_id: {
802
- "status": DocStatus.FAILED.value,
803
  "error": str(e),
804
  "content": status_doc.content,
805
  "content_summary": status_doc.content_summary,
 
674
  "content": content,
675
  "content_summary": self._get_content_summary(content),
676
  "content_length": len(content),
677
+ "status": DocStatus.PENDING,
678
  "created_at": datetime.now().isoformat(),
679
  "updated_at": datetime.now().isoformat(),
680
  }
 
745
  await self.doc_status.upsert(
746
  {
747
  doc_status_id: {
748
+ "status": DocStatus.PROCESSING,
749
  "updated_at": datetime.now().isoformat(),
750
  "content": status_doc.content,
751
  "content_summary": status_doc.content_summary,
 
782
  await self.doc_status.upsert(
783
  {
784
  doc_status_id: {
785
+ "status": DocStatus.PROCESSED,
786
  "chunks_count": len(chunks),
787
  "content": status_doc.content,
788
  "content_summary": status_doc.content_summary,
 
799
  await self.doc_status.upsert(
800
  {
801
  doc_status_id: {
802
+ "status": DocStatus.FAILED,
803
  "error": str(e),
804
  "content": status_doc.content,
805
  "content_summary": status_doc.content_summary,