RAG system for cultural event recommendation
Python, RAG, LangChain, FAISS, Mistral AI, FastAPI, Docker, Generative AI, NLP, Ragas
RAG System for Cultural Event Recommendation
Context
As part of a generative AI project, I developed a Proof of Concept (POC) for a Retrieval-Augmented Generation (RAG) system to answer natural language questions about cultural events. The system combines semantic search in a vector database with a Large Language Model (LLM) to generate contextualized and reliable answers.
Objectives
- Build a complete RAG chain.
- Collect and index events from the OpenAgenda API.
- Implement semantic search with FAISS.
- Generate contextualized answers with an LLM.
- Expose the system via a REST API.
- Automatically evaluate the quality of generated answers.
Architecture
API OpenAgenda
│
▼
Prétraitement des données
│
▼
Découpage en chunks
│
▼
Embeddings
(Hugging Face)
│
▼
Base vectorielle FAISS
│
▼
LangChain
│
▼
LLM Mistral
│
▼
FastAPI
│
▼
Client
Technologies Used
- Python
- LangChain
- FAISS
- Hugging Face Embeddings
- Mistral AI
- FastAPI
- Docker
- Pandas
- Ragas
- Pytest
Achievements
Data Collection and Preparation
- Event retrieval via the OpenAgenda API.
- Data cleaning and structuring.
- Filtering by period and location.
- Document chunking.
- Metadata preservation (date, location, category, description).
Vector Search
- Embedding generation with a Hugging Face model.
- Construction of a FAISS vector index.
- Semantic search by similarity.
- Automatic index reconstruction.
Augmented Generation (RAG)
- Orchestration of the RAG chain with LangChain.
- Search for relevant documents.
- Context injection into the prompt.
- Answer generation with Mistral.
- Contextualized answers based on indexed events.
REST API
Development of an API with FastAPI including:
/askendpoint/rebuildendpoint- Swagger/OpenAPI documentation
- Request validation
- Error handling
Evaluation
Implementation of a system evaluation strategy:
- Annotated question set
- Unit tests
- Automation of evaluations
- Metrics with Ragas
- Analysis of answer relevance and faithfulness
Containerization
- Dockerfile
- Local deployment
- Environment reproducibility
- Full demonstration via Docker container
Demonstrated Skills
Generative AI
- Retrieval-Augmented Generation (RAG)
- Prompt Engineering
- LLM
- Context Augmentation
NLP
- Embeddings
- Semantic Search
- Document Chunking
- Vector Similarity
Backend Development
- FastAPI
- REST API
- Swagger / OpenAPI
- Request Validation
Data Engineering
- Data Collection via API
- Preprocessing
- Metadata Management
- Vector Indexing
MLOps
- Docker
- Automated Tests
- RAG System Evaluation
- Reproducibility
- Industrialization of an AI POC
Outcome
This project allowed me to design a complete RAG system, from data collection to the generation of LLM-augmented answers. It illustrates the integration of modern technologies such as LangChain, FAISS, FastAPI, and Docker, while implementing a performance evaluation approach using Ragas to ensure the quality of the generated answers.
Skills Acquired
- Python
- LangChain
- RAG
- FAISS
- Mistral AI
- Hugging Face Embeddings
- FastAPI
- Docker
- REST API
- Prompt Engineering
- Vector Database
- Semantic Search
- NLP
- Ragas
- Pytest
- OpenAPI
- Data Engineering
- Generative AI