优化属性图检索功能及支持OpenAI线上模型

This commit is contained in:
wanyaokun
2024-09-20 17:34:38 +08:00
parent 092f7230c1
commit f7260da6d9
12 changed files with 350 additions and 76 deletions
+3 -1
View File
@@ -5,6 +5,7 @@ from typing import Dict,Any
from llama_index.core import PropertyGraphIndex
from llama_index.core.storage.storage_context import StorageContext
from llama_index.core import load_index_from_storage
from app.engine.graph.graphStore import RAGPropertyGraphStore
logger = logging.getLogger("uvicorn")
@@ -33,6 +34,7 @@ def getPropertyGraphIndex(prjFlag:str):
prjCachePath = GRAPH_STORAGE_DIR + f"/{prjFlag}"
if not os.path.exists(prjCachePath):
return None
storeContext = StorageContext.from_defaults(persist_dir = prjCachePath,vector_store = get_vector_store(prjFlag))
storeContext = StorageContext.from_defaults(persist_dir = prjCachePath,vector_store = get_vector_store(prjFlag),
property_graph_store = RAGPropertyGraphStore.from_persist_dir(prjCachePath))
index = load_index_from_storage(storeContext)
return index