Hey there, thanks for reaching out to the community!
From your description and the attached image, it sounds like your chatbot output is being incorrectly formatted—most likely due to the presence of dollar signs ($) or other special characters in your text, which Streamlit interprets as LaTeX math expressions when using st.write or st.markdown. This is a common issue, especially with financial or pricing data.
To fix this, you should escape all dollar signs in your output by replacing $ with \$ before displaying the text. This prevents Streamlit from rendering the text as LaTeX. For example:
formatted_response = response.replace('$', '\\$')
st.markdown(formatted_response)
This approach is confirmed as the recommended solution in both the Streamlit documentation and community discussions. If you need to display raw text without any formatting, you can also use st.text, but note that it uses a monospace font and doesn’t support rich formatting.
Sources: