wch / chatstream

Example Shiny for Python app which talks to the OpenAI API
https://wch.github.io/chatstream/
MIT License
74 stars 14 forks source link

How would you incorporate langchain with memory in chatstream? #9

Closed OlexiyPukhov closed 1 year ago

OlexiyPukhov commented 1 year ago

As mentioned, I built something similar with python's streamlit chat + langchain + pdf loader. The memory for this application was made by adding it to streamlit session. Here is some of my code for the memory with streamlit chat:

   with st.sidebar.form(key="message_form", clear_on_submit=True):
        user_input = st.text_input("Type your message here...", value="", key="user_input")
        submit_button = st.form_submit_button("Send")    
    if submit_button:
        st.session_state.messages.append(HumanMessage(content=user_input))
        with st.spinner("Thinking..."): 
            response = chat(st.session_state.messages)
        st.session_state.messages.append(AIMessage(content=response.content))

If I wanted to use chatstream instead, how would I handle this?

OlexiyPukhov commented 1 year ago

Nevermind. I read that it does not support langchain.