A Proof of Concept (POC) for a Retrieval-Augmented Generation (RAG) application using Databricks Vector Search, LangChain, OpenAI (GPT-4), and Streamlit.
This project indexes free and open-source New York Taxi data in Databricks, retrieves relevant embeddings via Vector Search and uses an LLM to generate contextual answers based on user queries.
-
Databricks
- Stores embeddings created from NYC Taxi open data
- Provides similarity search over indexed data
-
LangChain
- Connects to Databricks Vector Search
- Handles retrieval and prompt orchestration
-
OpenAI (GPT-4)
- Receives retrieved context + user query
- Generates final response
-
Streamlit
- User-facing web interface
- Displays answers returned by the LLM
POC – Retrieval Augmented Generation (RAG)
Built using:
- Databricks
- LangChain
- OpenAI LLM (GPT-4)
- Streamlit
.
├── my_app.py # Streamlit application
|── vector_search_helper.py # helper functions
├── databricks_nyc_indexing_script.py # Databricks indexing script
├── .env # Environment variables
├── requirements.txt
└── README.md
- Databricks workspace (Free Edition)
- Databricks Vector Search enabled
- OpenAI API key
- Python 3.9+
- Streamlit
- LangChain
-
Go to Databricks Workspace
-
Navigate to:
Compute --> Vector Search --> Create Endpoint -
Create an endpoint with the following details:
- Name:
vs_index
- Name:
-
Wait until the endpoint status becomes ONLINE
-
Open Databricks workspace
-
Create a new notebook
-
Choose:
- Language: Python
-
Run the script:
databricks_nyc_indexing_script.py
✅ This script:
- Loads free open-source NYC Taxi data
- Generates embeddings
- Creates and populates a Vector Search index
- Is compatible with Databricks Free Edition
Create or update the .env file with the required secrets and configuration.
Example:
OPENAI_API_KEY=your_openai_api_key
DATABRICKS_HOST=https://<your-databricks-workspace>
DATABRICKS_TOKEN=your_databricks_token
⚠️ Make sure.envis not committed to version control.
Install dependencies:
pip install -r requirements.txtRun the Streamlit app:
streamlit run ./my_app.py- User submits a query via Streamlit UI
- LangChain sends the query to Databricks Vector Search
- Relevant embeddings are retrieved from the NYC Taxi index
- Retrieved context + user query is sent to OpenAI GPT-4
- LLM generates a response grounded in retrieved data
- Answer is displayed back to the user
- Analyze NYC Taxi trip patterns
- Ask questions about fares, locations, and trends
- Natural language querying over structured datasets
- This is a POC and not production-hardened
- Error handling and security can be extended
- Designed for experimentation and learning
This project uses open-source NYC Taxi data Use responsibly and comply with data usage policies.
- Databricks Vector Search
- LangChain
- OpenAI
- Streamlit