elasticRagF1 is a project that integrates ElasticSearch with OpenAI's LLM to provide a powerful question-answering system for Formula 1 data. This project enables users to query a curated dataset of Formula 1 information sourced from various reliable websites.
- ElasticSearch Integration: Index and search Formula 1 data efficiently.
- OpenAI Integration: Use OpenAI's LLM to generate insightful and accurate answers.
- Customizable Data Sources: Add or modify domains to crawl for indexing.
- Playground for Queries: Use ElasticSearch's playground to test and refine queries.
The following websites were used to build the Formula 1 dataset:
- ElasticSearch Account: Create an account on ElasticSearch.
- OpenAI API Key: Obtain an API key from OpenAI.
- Python Environment: Ensure you have Python 3 installed.
- Clone the repository:
git clone https://github.com/your-username/elasticRagF1.git cd elasticRagF1 - Install the required Python packages:
pip install -r requirements.txt
- Copy the
.env.examplefile to.env:cp .env.example .env
- Update the
.envfile with your credentials:OPENAI_API_KEY: Your OpenAI API key.ES_API_KEY: Your ElasticSearch API key.ES_ENDPOINT: Your ElasticSearch endpoint.
- Add the domains you want to crawl for data in your ElasticSearch configuration.
- Use ElasticSearch's tools to crawl and index the data from the specified sources.
- Use the ElasticSearch playground to test queries on the indexed dataset.
- Run the Jupyter Notebook
basic.ipynbto interact with the system:- Load the
.envfile. - Query ElasticSearch for relevant data.
- Generate prompts for OpenAI's LLM.
- Retrieve and display answers.
- Load the
- Start by querying the indexed dataset using the
get_elasticsearch_resultsfunction in the notebook. - Use the
create_openai_promptfunction to generate a context-aware prompt. - Generate answers using the
generate_openai_completionfunction.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to submit issues or pull requests to improve the project.