将属性图流程同步至主流程中

This commit is contained in:
wanyaokun
2024-09-14 16:35:46 +08:00
parent 6de6cc201e
commit 67b1959d80
8 changed files with 208 additions and 24 deletions
+8 -2
View File
@@ -103,10 +103,12 @@ class PropertyGraphChache:
def simplePropertyGraph(self,prjName:str,prjFlag:str,filePath:str):
documents = get_documents(prjFlag)
storeContext = StorageContext.from_defaults(vector_store=get_vector_store(prjFlag))
index = PropertyGraphIndex(
nodes =documents,
kg_extractors = [PrjGraphExtractor(prjName)],
embed_model = Settings.embed_model,
storage_context = storeContext,
show_progress= True
)
os.makedirs(filePath,exist_ok = True)
@@ -126,7 +128,11 @@ class PropertyGraphChache:
if __name__ == "__main__":
init_settings()
llm_query = os.getenv('LLM_QUERY_WAY','rag')
from phoenix.trace import using_project
with using_project(os.getenv("PHOENIX_PROJECT_NAME") + "_generate") as obj:
generate_datasource()
PropertyGraphChache().generate()
if llm_query == 'graph':
PropertyGraphChache().generate()
else:
generate_datasource()