Long-running apps like LLM agents rarely show you their inner workings out of the box. On top of that, if a response takes too long to generate, users get impatient and leave. Not ideal!
If you're not always confident in your model's output, how do you inspect the intermediate steps and chain of thought to verify results? A few months ago, we provided a targeted solution by integrating with LangChain, using their callback system.
Now you can add
st.status to any interactive or API-powered app to:
- Animate its "under-the-hood" processes such as API calls or data retrieval.
- See step-by-step logic to understand what went wrong (or validate what went right).
- Allow users to engage with your app, rather than experiencing a blank page.
Let's look at two examples to see it in action.
Step-by-step transparency, in real-time
st.status, every process step is defined, broken out, and animated. The app viewer can expand the status to check the details or leave it collapsed to focus on the final output.
st.spinner, the intermediate steps remain available to inspect even after the process completes.
Flexible interaction to validate results
This can be particularly helpful to validate results from LLM-based apps.
LLMs aren't perfect. Their intelligence relies on the data sets they are trained on, which could be incomplete or contain misinformation. The LLM attempts to generate a plausible response to a user's prompt, but if it reaches the boundaries of its knowledge base, it can take liberties. This phenomenon causes an LLM to "hallucinate." If the user can't quite tell if the model is correct, or is embellishing a result, they quickly lose trust.
st.status, the context and intermediate steps are available so users can validate the output logic:
This flexible framework gives you a higher degree of control to up-level your app’s user experience, and easily integrate custom components. It’s worth the extra lines of code!
Help us raise the bar with new (and refined) UI improvements. What additional transparency features would you like to see next?
Let us know in the comments below or on Discord.
Happy Streamlit-ing! 🎈