attributeerrorstreamlit

Streamlit AttributeError: module 'streamlit' has no attribute 'chat_input'


This is my first time using streamlit, how do I resolve AttributeError? Thank you! #Streamlit, version 1.33.0 (streamlit version), 3.8.16 (python version)

import streamlit as st

prompt: str = st.chat_input("Enter a prompt here")

USER = "user"
ASSISTANT = "assistant"

if prompt:
    st.chat_message(USER).write(prompt)
    st.chat_message(ASSISTANT).write(f"You wrote {prompt}")

Solution

  • Basic rule of working with Python and its compatibilities -

    Python release notes - https://www.python.org/doc/versions/

    Streamlit release notes - https://docs.streamlit.io/develop/quick-reference/changelog

    Streamlit released chatbot in Version 1.24.0 which was published on June 27, 2023.

    Python released 3.8.16 version on 6 December 2022.

    It is very likely that streamlit team created and tested this features on 3.11.x and 3.10.x versions.

    Please do upgrade your python version as well as pip3 version. Plus, Reinstall streamlit if required.

    I hope this helps!