Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -187,7 +187,7 @@ def query_chroma(vectorstore, query, k):
|
|
| 187 |
return chunks_with_references
|
| 188 |
|
| 189 |
def rag_workflow(query):
|
| 190 |
-
docs = query_chroma(vectorstore, query, k=
|
| 191 |
context = "\n\n".join([doc for doc, _ in docs])
|
| 192 |
references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(docs)])
|
| 193 |
print(f"Context for the query:\n{context}\n")
|
|
@@ -221,6 +221,11 @@ def add_text(history, text):
|
|
| 221 |
history = history + [(text, None)]
|
| 222 |
yield history, ""
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
def bot_kadi(history):
|
| 225 |
user_query = history[-1][0]
|
| 226 |
response, references = rag_workflow(user_query)
|
|
|
|
| 187 |
return chunks_with_references
|
| 188 |
|
| 189 |
def rag_workflow(query):
|
| 190 |
+
docs = query_chroma(vectorstore, query, k=20)
|
| 191 |
context = "\n\n".join([doc for doc, _ in docs])
|
| 192 |
references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(docs)])
|
| 193 |
print(f"Context for the query:\n{context}\n")
|
|
|
|
| 221 |
history = history + [(text, None)]
|
| 222 |
yield history, ""
|
| 223 |
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
import gradio as gr
|
| 227 |
+
|
| 228 |
+
|
| 229 |
def bot_kadi(history):
|
| 230 |
user_query = history[-1][0]
|
| 231 |
response, references = rag_workflow(user_query)
|