From d03192a3bdfe1411e31a8961754b11e8b96415bd Mon Sep 17 00:00:00 2001 From: iridium-soda Date: Sat, 11 Jan 2025 09:27:53 +0000 Subject: [PATCH 1/3] fix: Resolve 500 error caused by missing `len()` for `LightRAG` --- lightrag/api/lollms_lightrag_server.py | 2 +- lightrag/api/ollama_lightrag_server.py | 2 +- lightrag/api/openai_lightrag_server.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lightrag/api/lollms_lightrag_server.py b/lightrag/api/lollms_lightrag_server.py index 8a2804a0..50a47ec1 100644 --- a/lightrag/api/lollms_lightrag_server.py +++ b/lightrag/api/lollms_lightrag_server.py @@ -376,7 +376,7 @@ def create_app(args): return InsertResponse( status="success", message="Text successfully inserted", - document_count=len(rag), + document_count=1, ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) diff --git a/lightrag/api/ollama_lightrag_server.py b/lightrag/api/ollama_lightrag_server.py index b3140aba..66b272d8 100644 --- a/lightrag/api/ollama_lightrag_server.py +++ b/lightrag/api/ollama_lightrag_server.py @@ -375,7 +375,7 @@ def create_app(args): return InsertResponse( status="success", message="Text successfully inserted", - document_count=len(rag), + document_count=1, ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) diff --git a/lightrag/api/openai_lightrag_server.py b/lightrag/api/openai_lightrag_server.py index 349c09da..d65eaa34 100644 --- a/lightrag/api/openai_lightrag_server.py +++ b/lightrag/api/openai_lightrag_server.py @@ -390,7 +390,7 @@ def create_app(args): return InsertResponse( status="success", message="Text successfully inserted", - document_count=len(rag), + document_count=1, ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) From 7a56f2924629ca99cde1fe952738dfe0a701e47d Mon Sep 17 00:00:00 2001 From: iridium-soda Date: Sat, 11 Jan 2025 09:38:54 +0000 Subject: [PATCH 2/3] fix --- lightrag/api/openai_lightrag_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightrag/api/openai_lightrag_server.py b/lightrag/api/openai_lightrag_server.py index d65eaa34..349c09da 100644 --- a/lightrag/api/openai_lightrag_server.py +++ b/lightrag/api/openai_lightrag_server.py @@ -390,7 +390,7 @@ def create_app(args): return InsertResponse( status="success", message="Text successfully inserted", - document_count=1, + document_count=len(rag), ) except Exception as e: raise HTTPException(status_code=500, detail=str(e)) From fd5683f6ad48189395ac21b936ef9085a4cf077d Mon Sep 17 00:00:00 2001 From: iridium-soda Date: Sat, 11 Jan 2025 09:39:52 +0000 Subject: [PATCH 3/3] Revert "fix" This reverts commit 7a56f2924629ca99cde1fe952738dfe0a701e47d. --- lightrag/api/openai_lightrag_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightrag/api/openai_lightrag_server.py b/lightrag/api/openai_lightrag_server.py index 349c09da..d65eaa34 100644 --- a/lightrag/api/openai_lightrag_server.py +++ b/lightrag/api/openai_lightrag_server.py @@ -390,7 +390,7 @@ def create_app(args): return InsertResponse( status="success", message="Text successfully inserted", - document_count=len(rag), + document_count=1, ) except Exception as e: raise HTTPException(status_code=500, detail=str(e))