Data apps in Python with Plotly Dash and DBRX LLM

Meet the Speaker

Adam Schroeder
Adam Schroeder is a Community Manager at Plotly.
This tutorial walks through the development of two Dash apps powered by the DBRX large language model.
The first app is a basic chatbot interface that demonstrates how to integrate DBRX into a Dash application using fewer than 60 lines of code. It accepts user input, sends the query to DBRX via a callback, and displays the model's response directly in the app. The setup includes environment variable handling for secure API access, use of Dash components like dcc.Input and html.Div, and a simple layout and callback structure.
- Uses Dash as the UI and DBRX as the LLM backend
- Integrates Databricks token and endpoint for authentication
- Callback sends user input to the LLM and renders the output
- Token usage is controlled via the max token setting for demo purposes
The second app introduces retrieval-augmented generation (RAG). It takes a document URL or PDF and answers user questions using content from that specific source. The app distinguishes between PDFs and web pages using regex and loads content accordingly using PyPDFLoader or WebBaseLoader. The loaded content is embedded into vectors using OpenAI's embedding API, then processed through a LangChain document retrieval chain.
- Accepts input from either a webpage or a PDF link
- Uses LangChain, OpenAI embeddings, and DBRX for RAG
- Loads, splits, and embeds documents before querying
- Displays real-time responses with a loading spinner for better UX
Both apps demonstrate how Dash enables LLM integration in Python without web dev overhead. From layout to logic, all functionality is managed in Python using the Dash framework and LLM services.
Watch the video to follow along and learn how to build and scale your own LLM-powered data apps with Dash and DBRX.