1000 Character Limit

Hi,

Bard told me Streamlit has 1000 character limit that’s why my response looked like below.

the OpenAI response:
During this quarter, Apple also repurchased $19.0 billion of its common stock and paid dividends and dividend equivalents of $3.8 billion.

The same output in the Streamlit Chat UI looks like this:

During this quarter, Apple also repurchased
19.0































































19.0billionofitscommonstockandpaiddividendsanddividendequivalentsof3.8 billion.

My code is using the standard Streamlit sample with markdown.

            for message in st.session_state.messages:
                chat_history_tuples.append((message["role"], message["content"]))
                result = qa({"question": prompt, "chat_history": chat_history_tuples})
                full_response = result["answer"]
                print(full_response)
                message_placeholder.markdown(full_response + "|")
            message_placeholder.markdown(full_response)

How do I get around this so it doesn’t get truncated?
Thanks,


Thanks all.

I am bit lost with my code because first it output the following with no issue, well above 1000 charaters.

Q: What data were you provided with?
A: The data provided includes information from a conference call or meeting involving Alphabet and Google's CFO, Ruth Porat, CEO Sundar Pichai, and SVP and CBO, Philipp Schindler. They discuss various aspects of the company's performance and future plans, including:

Alphabet's focus on the path to profitability, particularly in relation to Cloud services.
The company's efforts to provide customers with the necessary analytics, skills, and capabilities for long-term growth.
The growth of YouTube's subscription business, with YouTube Music and Premium surpassing 80 million subscribers.
The success of the Pixel 7 Pro, named "phone of the year" by many outlets and reviewers.
Google Cloud's Q4 revenue growth of 32% and its differentiated products and focused go-to-market strategy.
The performance of the Hardware business, particularly the success of the Pixel phones.
The strategic importance of having a wide range of Hardware products in relation to the company's AI initiatives.
The company's focus on investing sustainably across the portfolio in Other Bets, such as Calico and Waymo.
The company's approach to the future, with a focus on being bold, responsible, and focused.

Then on my second question, it start to truncate even it is under 1000.

Q: How did Google perform last quarter
A: In the last quarter, Google Services revenues were 
68
�
�
�
�
�
�
�
,
�
�
�
�
2
68billion,down235.3 billion, up 7%. Operating expenses were 
22.5
�
�
�
�
�
�
�
,
�
�
10
22.5billion,up1018.2 billion, down 17% versus last year. Net income was 
13.6
�
�
�
�
�
�
�
.
�
ℎ
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
ℎ
�
�
�
�
�
�
13.6billion.TheydeliveredFreeCashFlowof16 billion in the fourth quarter and 
60
�
�
�
�
�
�
�
�
�
2022.
�
ℎ
�
�
�
�
�
�
�
�
ℎ
�
�
�
�
�
�
�
�
ℎ
60billionin2022.Theyendedtheyearwith114 billion in cash and marketable securities.

Then on my third question, it doesn’t truncate anymore.

Q: What is the outlook for the next quarter?
A: The text does not provide specific information about the projected outlook for the next quarter.

I printed the response on the console, they all look fine. Not quite sure how the Streamlit is handling it.
Here is the code for displaying.

    # Accept user input
    if prompt := st.chat_input("Ask your questions?"):
        st.session_state.messages.append({"role": "user", "content": prompt})
        with st.chat_message("user"):
            st.markdown(prompt)

        # Query the assistant using the latest chat history
        result = qa({"question": prompt, "chat_history": [(message["role"], message["content"]) for message in st.session_state.messages]})

        # Display assistant response in chat message container
        with st.chat_message("assistant"):
            message_placeholder = st.empty()
            full_response = ""
            full_response = result["answer"]
            message_placeholder.markdown(full_response + "|")
        message_placeholder.markdown(full_response)    
        print(full_response)
        st.session_state.messages.append({"role": "assistant", "content": full_response})

Hey @nhtkid,

st.markdown doesn’t have a character limit. Can you share a full/runnable code snippet so we can try to reproduce the truncating behavior?