Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Databricks App: Chatbot Starter

A ~35-line Streamlit chatbot you can deploy on Databricks Free Edition in a few minutes. It calls a hosted Foundation Model (no API keys, no billing setup, no model deployment) and streams the reply. Built as the hands-on build for a "everyone ships an app" workshop.

You make it yours by editing two lines at the top of app.py:

MODEL = "databricks-meta-llama-3-3-70b-instruct"   # try another model
SYSTEM_PROMPT = "You are a friendly, concise assistant."   # give it a personality

What you need

  • A Databricks Free Edition workspace (free signup).
  • The Databricks CLI (v0.229.0+), authenticated to your workspace:
    databricks auth login --host https://<your-workspace>.cloud.databricks.com --profile my-free-edition

Deploy it (CLI)

# 1. Create the app (provisions compute — takes a couple of minutes)
databricks apps create chatbot-starter --profile my-free-edition

# 2. Upload the code to your workspace
databricks sync . /Workspace/Users/<you@example.com>/chatbot-starter \
  --exclude .git --profile my-free-edition

# 3. Deploy
databricks apps deploy chatbot-starter \
  --source-code-path /Workspace/Users/<you@example.com>/chatbot-starter \
  --profile my-free-edition

# 4. Get the URL
databricks apps get chatbot-starter --profile my-free-edition

Open the printed URL, sign in, and chat.

Prefer no CLI?

In the workspace UI: Compute → Apps → Create app → pick the Streamlit template, then paste in the contents of app.py. Same result, zero local tooling.

Files

File Purpose
app.py The whole app — Streamlit chat UI + streaming model call.
app.yaml Tells Databricks Apps how to start it (streamlit run app.py).
requirements.txt streamlit, databricks-sdk, openai.

How the model call works (and one gotcha)

Inside a Databricks App, credentials are auto-injected, so you don't handle any secrets. The app builds an OpenAI-compatible client pointed at your workspace's serving endpoints:

w = WorkspaceClient()
token = w.config.authenticate()["Authorization"].split(" ", 1)[1]
client = OpenAI(api_key=token, base_url=f"{w.config.host}/serving-endpoints")

Gotcha: you may see serving_endpoints.get_open_ai_client() in newer docs. The Databricks Apps runtime can ship an older databricks-sdk that doesn't have that helper (AttributeError). The pattern above works regardless of SDK version — that's why this starter uses it.

Available models on Free Edition

Any of these MODEL values work out of the box (list yours with databricks serving-endpoints list):

  • databricks-meta-llama-3-3-70b-instruct
  • databricks-llama-4-maverick
  • databricks-gpt-oss-120b / databricks-gpt-oss-20b
  • databricks-qwen3-next-80b-a3b-instruct
  • databricks-gemma-3-12b

License

MIT — see LICENSE.

About

Minimal Streamlit chatbot you deploy on Databricks Free Edition — hands-on workshop starter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages