The notebooks in this repository shows you how to build an AI Agent that accepts natural language questions concerning the Backblaze Drive Stats data set, generates SQL queries, and responds with natural language answers.
There are currently two notebooks:
- agent_demo.ipynb uses OpenAI GPT-4o mini as the underlying LLM
- agent_demo_deepseek.ipynb explores the use of DeepSeek R1 and DeepSeek V3 as alternatives to OpenAI.
You must configure the notebook(s) with your API credential(s). You can either set environment variables or use a .env
file. To do the latter, copy .env.template
to .env
, then set the relevant API key(s) as explained below.
Remember - never put secrets in source code!
To use the OpenAI API, you must sign up for an OpenAI account and create an OpenAI API key.
Either set an environment variable, or edit your .env
file:
OPENAI_API_KEY=<your-openai-api-key>
To use the DeepSeek API, you must sign up for a DeepSeek account and create a DeepSeek API key.
Either set an environment variable, or edit your .env
file:
DEEPSEEK_API_KEY=<your-deepseek-api-key>
Both notebooks should run on any Jupyter-compatible platform:
- The "classic" Jupyter Notebook interface is lightweight and easy to install and use: https://docs.jupyter.org/en/latest/install/notebook-classic.html
- JupyterLab is more versatile, with more features: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html
- There are Jupyter plugins for many integrated development environments (IDEs), for example, IntelliJ and VS Code.
If you are deploying JupyterLab on a virtual machine at a cloud provider, you will need to configure it to accept connections from the internet. Here is the configuration we set in ~/.jupyter/jupyter_server_config.py
for this purpose:
# Allow requests where the Host header doesn't point to a local server
c.ServerApp.allow_remote_access = True
# The IP address the Jupyter server will listen on.
# 0.0.0.0 = all addresses
c.ServerApp.ip = '0.0.0.0'
# Allow access to hidden files
# Set to True to allow access to .venv
c.ContentsManager.allow_hidden = True