Merge pull request #1511 from danielaskdd/Persistent-llm-cache
Persistent LLM cache on error
This commit is contained in:
@@ -1010,6 +1010,10 @@ class LightRAG:
|
|||||||
if not task.done():
|
if not task.done():
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
||||||
|
# Persistent llm cache
|
||||||
|
if self.llm_response_cache:
|
||||||
|
await self.llm_response_cache.index_done_callback
|
||||||
|
|
||||||
# Update document status to failed
|
# Update document status to failed
|
||||||
await self.doc_status.upsert(
|
await self.doc_status.upsert(
|
||||||
{
|
{
|
||||||
@@ -1028,7 +1032,7 @@ class LightRAG:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Semphore was released here
|
# Semphore released, concurrency controlled by graph_db_lock in merge_nodes_and_edges instead
|
||||||
|
|
||||||
if file_extraction_stage_ok:
|
if file_extraction_stage_ok:
|
||||||
try:
|
try:
|
||||||
@@ -1082,6 +1086,10 @@ class LightRAG:
|
|||||||
pipeline_status["latest_message"] = error_msg
|
pipeline_status["latest_message"] = error_msg
|
||||||
pipeline_status["history_messages"].append(error_msg)
|
pipeline_status["history_messages"].append(error_msg)
|
||||||
|
|
||||||
|
# Persistent llm cache
|
||||||
|
if self.llm_response_cache:
|
||||||
|
await self.llm_response_cache.index_done_callback
|
||||||
|
|
||||||
# Update document status to failed
|
# Update document status to failed
|
||||||
await self.doc_status.upsert(
|
await self.doc_status.upsert(
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user