Skip to content

Quick Start

Get up and running with Lumen in under 30 seconds.

Installation

Install Lumen with your preferred LLM provider:

pip install 'lumen[ai-openai]'
export OPENAI_API_KEY=your_key_here
pip install 'lumen[ai-anthropic]'
export ANTHROPIC_API_KEY=your_key_here
pip install 'lumen[ai-local]'
# Example: Using a local Ollama model
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_API_KEY=ollama  # Dummy key for local models

Start Chatting with Data

lumen-ai serve https://datasets.holoviz.org/penguins/v1/penguins.csv --show

If a browser tab doesn't automatically open, visit https://localhost:5006 and start chatting with your data.

Try these questions:

"What datasets are available?"

"Show me a summary of the data"

"Which species has the largest average body mass? Show as a bar chart."

"Create a scatter plot of bill length vs flipper length, colored by island"

"Filter for penguins over 4kg and show me the distribution by species"

from lumen.ai import ExplorerUI

ui = ExplorerUI(
    data='https://datasets.holoviz.org/penguins/v1/penguins.csv'
)
ui.servable()
panel serve app.py

Then ask:

"What's the correlation between bill length and body mass?"

"Group by island and show average measurements as a table"

"Create a histogram of flipper lengths with 20 bins"

"Are there any outliers in the body mass data?"

How It Works

You don't need to write SQL or Python; just ask a question:

Which islands have the most penguins? Plot as a horizontal bar chart.

1. Lumen creates a plan:

- [ ] Query the penguin dataset to aggregate the total number of penguins by island.
- [ ] Create a horizontal bar chart showing islands on the y-axis and penguin counts on the x-axis.

2. Generates SQL to query the data:

SELECT "island", COUNT(*) AS "penguin_count" 
FROM penguins 
GROUP BY "island" 
ORDER BY "penguin_count" DESC
island penguin_count
Biscoe 168
Dream 124
Torgersen 52

3. Creates a Vega-Lite visualization:

$schema: https://vega.github.io/schema/vega-lite/v5.json
data:
  name: penguin_count_by_island
height: container
layer:
- encoding:
    color:
      value: '#4682b4'
    x:
      axis:
        title: Penguin Count
      field: penguin_count
      type: quantitative
    y:
      axis:
        title: Island
      field: island
      sort: -x
      type: nominal
  mark: bar
title:
  anchor: start
  fontSize: 20
  subtitle: Biscoe island has the highest penguin count, followed by Dream and Torgersen
  subtitleColor: '#666666'
  subtitleFontSize: 16
  text: Penguin Counts by Island
width: container

4. Renders the result:

All of this happens automatically when you just ask a question!

Try with Your Own Data

lumen serve data/sales.csv
lumen serve https://example.com/data.csv
lumen serve postgresql://user:pass@localhost/mydb
lumen serve mysql://user:pass@localhost/mydb
lumen serve sqlite:///data.db
lumen serve https://api.example.com/data.json
lumen serve https://datasets.holoviz.org/penguins/v1/penguins.csv

Next Steps