Posts

Showing posts from February, 2024

Case Study : Chatbot with Streamlit

Streamlit It is an open-source Python library to change python scripts(written with streamlit library) into web apps using machine learning and data science. Install streamlit pip install streamlit Note : Write as .py file Import streamlit import streamlit as st Maintain Conversation State The following statement helps to keep track of the messages exchanged during a session. from langchain_community.chat_message_histories                                                        import StreamlitChatMessageHistory msgs = StreamlitChatMessageHistory() print(msgs) Output: {'_messages': []} Step 1 : Add the First AI Message to chat history # Give initial ai message from Chatbot if  len (msgs.messages) ==  0 :      msgs.add_ai_message( "How can I help you?" )      print (msgs) Output {'_mess...