Project Description
This project involves developing an intelligent chatbot for Enervia, a company specializing in energy solutions. The central idea is to leverage techniques of Retrieval Augmented Generation (RAG) The chatbot will answer customer inquiries using information extracted directly from PDF documents. These documents include a unified corporate brochure and an FAQ file, which contain all relevant information about the company.
The process is divided into several key stages:
Data Extraction and Processing:
The library is used PyPDF2 To extract the text content from PDFs, a cleaning and segmentation process is implemented because the extracted text may contain formatting errors and incorrect spacing. This process divides the content into semantically coherent fragments based on headings and line breaks, ensuring that each fragment is of an appropriate size for further processing (e.g., fragments of up to 300 words).

Embedding Generation:
To transform text fragments into numerical representations that capture their semantic meaning, the following is used: Sentence Transformers with the model all-MiniLM-L6-v2. These embeddings allow you to convert textual content into vectors that can then be compared and searched efficiently.
Indexing with FAISS:
The generated embeddings are indexed using FAISS (Facebook AI Similarity Search). This tool allows for fast and scalable similarity searches, so that when a user formulates a query, the system can retrieve the most relevant snippets based on semantic proximity.
Generating Responses with the OpenAI API:
Once the relevant fragments are retrieved, they are integrated into a prompt along with the user's query. This prompt is then sent to the OpenAI API using the model GPT-3.5-turbo through the ChatCompletion endpoint, which generates contextual and accurate responses based on information extracted from documents.
Integration and Scalability:
Although the project starts with a small corpus (around 11 pages in total), the architecture is designed to easily scale as more information or additional documents are added. This allows the knowledge base to be kept up-to-date and the chatbot's response quality to be continuously improved.
In summary, the project combines natural language processing techniques, embedding, vector indexing, and natural language generation to create a chatbot that can answer questions intelligently and contextually. The experience gained in the process is invaluable, especially for those new to NLP and artificial intelligence, as it covers everything from unstructured data manipulation to the integration of multiple cutting-edge technological tools.
