Summary
NoneType object not callable for session_state object. How to fix it?
I made an LLM chatbot, installed all the required modules but for some reason this error keeps showing up. I assume it is because session_state is missing?
Code snippet:
def handle_userinput(user_question):
response = st.session_state.conversation({'question': user_question})
st.session_state.chat_history = response['chat_history']
for i, message in enumerate(st.session_state.chat_history):
if i % 2 == 0:
st.write(user_template.replace(
"{{MSG}}", message.content), unsafe_allow_html=True)
else:
st.write(bot_template.replace(
"{{MSG}}", message.content), unsafe_allow_html=True)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
I expect the session_state object to work and use the required methods
Actual behavior:
Debug info
langchain==0.0.184
PyPDF2==3.0.1
python-dotenv==1.0.0
streamlit==1.18.1
openai==0.27.6
faiss-cpu==1.7.4
python=3.11.1
uncomment to use huggingface llms
huggingface-hub==0.14.1
uncomment to use instructor embeddings
InstructorEmbedding==1.0.1
sentence-transformers==2.2.2
Requirements file
(App dependencies - Streamlit Docs) and add a requirements file to your app.
Links
- Link to your GitHub repo:GitHub - Memomer/Pdfllm: huggingfaces hkunlp model used
Additional information
If needed, add any other context about the problem here.