DrishtiSharma commited on
Commit
f2ed563
Β·
verified Β·
1 Parent(s): 9826dae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
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
- retriever = st.session_state.vector_store.as_retriever(search_type="similarity", search_kwargs={"k": 5})
 
 
 
 
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)