Spaces:
Build error
Build error
Integrating chat to llm response
Browse files35 unmodified lines36373839404142434445464720 unmodified lines68697071727335 unmodified lines# Streamed response emulatordef response_generator():response = random.choice([result['result']])for word in response.split():yield word + " "time.sleep(0.05)20 unmodified lines# Display assistant response in chat message containerwith st.chat_message("assistant"):response = st.write_stream(response_generator())# Add assistant response to chat historyst.session_state.messages.append({"role": "assistant", "content": response})35 unmodified lines36373839404142434445464748495020 unmodified lines71727374757635 unmodified lines# Streamed response emulatordef response_generator(prompt):# response = random.choice(# [# result['result']# ]# )response = qa_chain({"query": prompt})['result']for word in response.split():yield word + " "time.sleep(0.05)20 unmodified lines# Display assistant response in chat message containerwith st.chat_message("assistant"):response = st.write_stream(response_generator(prompt))# Add assistant response to chat historyst.session_state.messages.append({"role": "assistant", "content": response})
app.py+10-7