F1-AI is a Retrieval-Augmented Generation (RAG) application that leverages OpenAI's GPT-4 model and a vector database to provide context-aware answers to questions about Formula 1 racing. This project demonstrates how to build a RAG application using TypeScript, OpenAI, DataStax Astra DB, and Playwright.
- Clone the repository:
git clone https://github.com/IAmTomShaw/f1-rag-ai.git- Install the dependencies:
cd f1-rag-ai
npm installYou'll need to paste your OpenAI API key and DataStax Astra DB credentials into the relevant files, or create a .env file in the root directory with the following environment variables:
OPENAI_API_KEY=your-openai-api-key
ASTRA_DB_ID=your-astra-db-id
ASTRA_DB_REGION=your-astra-db-region
ASTRA_DB_USERNAME=your-astra-db-username
ASTRA_DB_PASSWORD=your-astra-db-passwordYou'll then need to make sure that these environment variables are referenced in your code and loaded correctly.
You can modify the list of urls that I am scraping in the src/ingest.ts file. You can then run the following command to scrape the data:
npm run ingestThis will scrape the data from the urls and store it in the Astra DB.
You can then run the following command to test the RAG application using the query defined in the src/answer.ts file:
npm run answerThis project is licensed under the MIT License - see the LICENSE file for details.
This project was created by Tom Shaw