AI Assistant for BART (Bay Area Rapid Transit)
This is a simple example of exposing PromptQL to real-time public data using the BART API. The BART API is a public API that provides real-time data on the Bay Area Rapid Transit system. This example demonstrates how to use PromptQL to create a real-time chat application that allows a user to talk to the BART API and get real-time information on departures.
Check out the GitHub repo.
Here's a sample of what you can ask:
- What time is the next train arriving at Embarcadero?
- If I leave 576 Folsom St now, can I make the next train at Montgomery?

Prerequisites
Install the DDN CLI
To use this guide, ensure you've installed/updated your CLI to at least v2.28.0
.
- macOS and Linux
- Windows
Simply run the installer script in your terminal:
curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash
Currently, the CLI does not support installation on ARM-based Linux systems.
- Download the latest DDN CLI installer for Windows.
- Run the
DDN_CLI_Setup.exe
installer file and follow the instructions. This will only take a minute. - By default, the DDN CLI is installed under
C:\Users\{Username}\AppData\Local\Programs\DDN_CLI
- The DDN CLI is added to your
%PATH%
environment variable so that you can use theddn
command from your terminal.
Install Docker
The Docker-based workflow helps you iterate and develop locally without deploying any changes to Hasura DDN, making the
development experience faster and your feedback loops shorter. You'll need Docker Compose v2.20
or later.
Validate the installation
You can verify that the DDN CLI is installed correctly by running:
ddn doctor
Setup the Bart API
Step 1: Clone the project
git clone [email protected]:robertjdominguez/example-promptql-bart.git
cd example-promptql-bart
Step 2: Add Anthropic API key to .env
Set up your .env file with your Anthropic (or OpenAI) API key and GitHub API token.
cp .env.example .env
Get an api key from https://console.anthropic.com/settings/keys
# .env
...
...
ANTHROPIC_API_KEY=<your-anthropic-api-key>
To use an OpenAI key instead, you'll have to set OPENAI_API_KEY
in your .env file and change the environment variable
LLM
to openai
in the compose.yaml file.
Build your PromptQL app
Now, let's set up the Hasura DDN project with PromptQL to start exploring the data in natural language!
- Set up the Hasura DDN project already scaffolded in the repo:
In the root directory of the repo, run the following commands:
ddn project init
Create a build:
ddn supergraph build local
- Start the DDN project
Let's start the DDN project by executing the following command:
ddn run docker-start
- Open the local DDN Console to start exploring:
ddn console --local
This should open up your browser (or print a browser URL) for displaying the Hasura Console. It’ll typically be something like: https://console.hasura.io/local?engine=localhost:3280&promptql=localhost:3282