We know that coding AIs can be amazing coders but they hallucinate when coding Streamlit. Here’s an example of a request to code an text_input() callback. It hallucinates that callbacks have a parameter and doesn’t show how to access the new input. Perhaps Streamlit is under represented in training data or were callbacks not originally supported? Results are so much better with other apis such as SQL or Pandas.
I would not expect these kinds of hallucinations if trained on API Reference manuals, programming language manuals or Swagger files. I wonder if these kinds of documents are given priority for training?
Can Streamlit do something about getting better results?
Here’s the problematic response from Bing, ChatGPT and Perplexity (Code Pilot?).
import streamlit as st
def text_input_callback(value):
st.write("Text input value changed to:", value)
st.write("Enter some text below:")
text_input_value = st.text_input("Text Input", value="", on_change=text_input_callback)