File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,15 @@ def execute(self, state: dict) -> dict:
9999 )
100100 embeddings = self .embedder_model
101101
102- if self .node_config .get ("cache" , False ):
103- index = FAISS .from_documents (chunked_docs , embeddings )
104- folder_name = "cache"
102+ folder_name = "cache"
105103
106- if not os .path .exists (folder_name ):
107- os .makedirs (folder_name )
104+ if self .node_config .get ("cache" , False ) and not os .path .exists (folder_name ):
105+ index = FAISS .from_documents (chunked_docs , embeddings )
106+ os .makedirs (folder_name )
108107
109108 index .save_local (folder_name )
109+ if self .node_config .get ("cache" , False ) and os .path .exists (folder_name ):
110+ index = FAISS .load_local (folder_path = folder_name , embeddings = embeddings )
110111 else :
111112 index = FAISS .from_documents (chunked_docs , embeddings )
112113
You can’t perform that action at this time.
0 commit comments