Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,8 @@ def _create_embeddings_and_save(user: User, chunks: any) -> tuple[int, FAISS]:
|
|
76 |
def ask_question(user: User, question: str, vector_store : FAISS) -> tuple[str, int]:
|
77 |
|
78 |
docs = vector_store.similarity_search(question,k = 3)
|
79 |
-
|
|
|
80 |
prompt = f'Question: "{question}"\nContext: "{retrieved_chunks}"'
|
81 |
|
82 |
try:
|
|
|
76 |
def ask_question(user: User, question: str, vector_store : FAISS) -> tuple[str, int]:
|
77 |
|
78 |
docs = vector_store.similarity_search(question,k = 3)
|
79 |
+
x = min(len(docs), 3)
|
80 |
+
retrieved_chunks = "".join([docs[i].page_content for i in range(x)])
|
81 |
prompt = f'Question: "{question}"\nContext: "{retrieved_chunks}"'
|
82 |
|
83 |
try:
|