Hi,
I am trying to run a method on button_click which would create summary by LLM:
async def reflection():
st.write(“Reflection messages”)if "messages" in st.session_state: st.write("There are messages in the session state") breakpoint() last_message = st.session_state.messages[-1] st.write(last_message.content) if last_message.type == "ai": with st.chat_message("human"): message = "Provide detailed summary of the user's requirements." st.session_state.messages.append(message) breakpoint() last_message = st.session_state.last_message st.write(last_message.content)
But, when the code reaches st.chat_message(“human”), I am getting:
streamlit.errors.StreamlitAPIException: Chat messages cannot nested inside other chat messages.
Can someone please suggest how can I add human message and pass it again to LLM for response and store it as feedback?