Spaces:
Runtime error
Runtime error
removed source documents
Browse files
app.py
CHANGED
|
@@ -25,10 +25,10 @@ s3.download_file('rad-rag-demos', 'vectorstores/chroma.sqlite3', './chroma_db/ch
|
|
| 25 |
|
| 26 |
db = Chroma(persist_directory="./chroma_db", embedding_function=embeddings)
|
| 27 |
db.get()
|
| 28 |
-
retriever = db.as_retriever()
|
| 29 |
|
| 30 |
global qa
|
| 31 |
-
qa = RetrievalQA.from_chain_type(llm=model_id, chain_type="stuff", retriever=retriever
|
| 32 |
|
| 33 |
|
| 34 |
def add_text(history, text):
|
|
@@ -38,11 +38,7 @@ def add_text(history, text):
|
|
| 38 |
def bot(history):
|
| 39 |
response = infer(history[-1][0])
|
| 40 |
history[-1][1] = response['result']
|
| 41 |
-
|
| 42 |
-
src_list = '\n'.join(sources)
|
| 43 |
-
print_this = response['result']+"\n\n\n Sources: \n\n\n"+src_list
|
| 44 |
-
# return history
|
| 45 |
-
return print_this
|
| 46 |
|
| 47 |
def infer(question):
|
| 48 |
query = question
|
|
|
|
| 25 |
|
| 26 |
db = Chroma(persist_directory="./chroma_db", embedding_function=embeddings)
|
| 27 |
db.get()
|
| 28 |
+
retriever = db.as_retriever(search_type = "mmr")
|
| 29 |
|
| 30 |
global qa
|
| 31 |
+
qa = RetrievalQA.from_chain_type(llm=model_id, chain_type="stuff", retriever=retriever)
|
| 32 |
|
| 33 |
|
| 34 |
def add_text(history, text):
|
|
|
|
| 38 |
def bot(history):
|
| 39 |
response = infer(history[-1][0])
|
| 40 |
history[-1][1] = response['result']
|
| 41 |
+
return history
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
def infer(question):
|
| 44 |
query = question
|