Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -159,7 +159,11 @@ st.write("π **Vector Store Created:**", st.session_state.vector_created)
|
|
| 159 |
query = st.text_input("π Ask a question about the document:")
|
| 160 |
if query:
|
| 161 |
with st.spinner("π Retrieving relevant context..."):
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
contexts = retriever.invoke(query)
|
| 164 |
# Debugging: Check what was retrieved
|
| 165 |
st.write("Retrieved Contexts:", contexts)
|
|
|
|
| 159 |
query = st.text_input("π Ask a question about the document:")
|
| 160 |
if query:
|
| 161 |
with st.spinner("π Retrieving relevant context..."):
|
| 162 |
+
if st.session_state.vector_store is None:
|
| 163 |
+
st.error("β Vector store is not initialized. Ensure document processing and chunking are completed.")
|
| 164 |
+
else:
|
| 165 |
+
retriever = st.session_state.vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5})
|
| 166 |
+
|
| 167 |
contexts = retriever.invoke(query)
|
| 168 |
# Debugging: Check what was retrieved
|
| 169 |
st.write("Retrieved Contexts:", contexts)
|