mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-12 21:01:56 +08:00
This commit is contained in:
parent
7ed2fe8ef0
commit
d79036149a
@ -99,14 +99,15 @@ class RAGNode(BaseNode):
|
|||||||
)
|
)
|
||||||
embeddings = self.embedder_model
|
embeddings = self.embedder_model
|
||||||
|
|
||||||
if self.node_config.get("cache", False):
|
folder_name = "cache"
|
||||||
index = FAISS.from_documents(chunked_docs, embeddings)
|
|
||||||
folder_name = "cache"
|
|
||||||
|
|
||||||
if not os.path.exists(folder_name):
|
if self.node_config.get("cache", False) and not os.path.exists(folder_name):
|
||||||
os.makedirs(folder_name)
|
index = FAISS.from_documents(chunked_docs, embeddings)
|
||||||
|
os.makedirs(folder_name)
|
||||||
|
|
||||||
index.save_local(folder_name)
|
index.save_local(folder_name)
|
||||||
|
if self.node_config.get("cache", False) and os.path.exists(folder_name):
|
||||||
|
index = FAISS.load_local(folder_path=folder_name, embeddings=embeddings)
|
||||||
else:
|
else:
|
||||||
index = FAISS.from_documents(chunked_docs, embeddings)
|
index = FAISS.from_documents(chunked_docs, embeddings)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user