PDFs_chat_bots / app.py
ahmedumeraziz's picture
Update app.py
c6eeec2 verified
# ... (previous imports remain the same)
def handle_chat():
st.subheader("πŸ’¬ Document Chat")
if "messages" not in st.session_state:
st.session_state.messages = []
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
if prompt := st.chat_input("Ask about your documents"):
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
with st.chat_message("assistant"):
with st.spinner("Thinking..."):
try:
response = get_groq_response(
prompt,
get_vector_db(),
model_name="llama3-70b-8192" # Updated model
)
st.markdown(response)
st.session_state.messages.append(
{"role": "assistant", "content": response}
)
except Exception as e:
st.error(f"Please check the model name in rag_utils.py. Error: {str(e)}")