Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,9 +89,10 @@ if uploaded_file:
|
|
| 89 |
st.write("β
Documents successfully added to FAISS VectorStore.")
|
| 90 |
except Exception as e:
|
| 91 |
st.error(f"Error adding documents to FAISS: {e}")
|
|
|
|
| 92 |
|
| 93 |
# β
Limit number of retrieved documents
|
| 94 |
-
retriever = langchain_vector_store.as_retriever(search_kwargs={"k": 15})
|
| 95 |
|
| 96 |
# β
Query Processing
|
| 97 |
query = st.text_input("Ask a question about your data (LangChain):")
|
|
@@ -113,8 +114,10 @@ if uploaded_file:
|
|
| 113 |
f"{retrieved_context}"
|
| 114 |
)
|
| 115 |
|
| 116 |
-
|
| 117 |
-
st.write(
|
|
|
|
|
|
|
| 118 |
except Exception as e:
|
| 119 |
error_message = traceback.format_exc()
|
| 120 |
st.error(f"Error processing query: {e}")
|
|
@@ -124,3 +127,8 @@ if uploaded_file:
|
|
| 124 |
error_message = traceback.format_exc()
|
| 125 |
st.error(f"Error processing with LangChain: {e}")
|
| 126 |
st.text(error_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
st.write("β
Documents successfully added to FAISS VectorStore.")
|
| 90 |
except Exception as e:
|
| 91 |
st.error(f"Error adding documents to FAISS: {e}")
|
| 92 |
+
st.text(traceback.format_exc())
|
| 93 |
|
| 94 |
# β
Limit number of retrieved documents
|
| 95 |
+
retriever = langchain_vector_store.as_retriever(search_kwargs={"k": 15}) # Fetch 15 docs instead of 5
|
| 96 |
|
| 97 |
# β
Query Processing
|
| 98 |
query = st.text_input("Ask a question about your data (LangChain):")
|
|
|
|
| 114 |
f"{retrieved_context}"
|
| 115 |
)
|
| 116 |
|
| 117 |
+
# Simulate LangChain RAG Chain (update actual logic if necessary)
|
| 118 |
+
st.write("π Query processed successfully.")
|
| 119 |
+
st.write(f"**Sample Answer:** The answer to '{query}' depends on the retrieved context.")
|
| 120 |
+
|
| 121 |
except Exception as e:
|
| 122 |
error_message = traceback.format_exc()
|
| 123 |
st.error(f"Error processing query: {e}")
|
|
|
|
| 127 |
error_message = traceback.format_exc()
|
| 128 |
st.error(f"Error processing with LangChain: {e}")
|
| 129 |
st.text(error_message)
|
| 130 |
+
|
| 131 |
+
except Exception as e:
|
| 132 |
+
error_message = traceback.format_exc()
|
| 133 |
+
st.error(f"Error reading uploaded file: {e}")
|
| 134 |
+
st.text(error_message)
|