sabazo commited on
Commit
946ff7c
1 Parent(s): a143dd8

use chroma db from disk

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -15,12 +15,12 @@ from langchain.vectorstores import Chroma
15
 
16
  from langchain.chains import RetrievalQA
17
 
18
- web_links = ["https://www.databricks.com/","https://help.databricks.com","https://docs.databricks.com","https://kb.databricks.com/","http://docs.databricks.com/getting-started/index.html","http://docs.databricks.com/introduction/index.html","http://docs.databricks.com/getting-started/tutorials/index.html","http://docs.databricks.com/machine-learning/index.html","http://docs.databricks.com/sql/index.html"]
19
- loader = WebBaseLoader(web_links)
20
- documents = loader.load()
21
 
22
- texts = text_splitter.split_documents(documents)
23
- db = Chroma.from_documents(texts, embeddings)
24
  retriever = db.as_retriever()
25
  global qa
26
  qa = RetrievalQA.from_chain_type(llm=model_id, chain_type="stuff", retriever=retriever, return_source_documents=True)
 
15
 
16
  from langchain.chains import RetrievalQA
17
 
18
+ #web_links = ["https://www.databricks.com/","https://help.databricks.com","https://docs.databricks.com","https://kb.databricks.com/","http://docs.databricks.com/getting-started/index.html","http://docs.databricks.com/introduction/index.html","http://docs.databricks.com/getting-started/tutorials/index.html","http://docs.databricks.com/machine-learning/index.html","http://docs.databricks.com/sql/index.html"]
19
+ #loader = WebBaseLoader(web_links)
20
+ #documents = loader.load()
21
 
22
+ #texts = text_splitter.split_documents(documents)
23
+ db = Chroma.from_documents(persist_directory=chroma_db, embedding_function=embeddings)
24
  retriever = db.as_retriever()
25
  global qa
26
  qa = RetrievalQA.from_chain_type(llm=model_id, chain_type="stuff", retriever=retriever, return_source_documents=True)