Welcome to the LLM Chatbot API! This project is designed to integrate an intelligent chatbot into my personal website, enabling users to get insightful responses based on pre-stored data.
The following technologies power the LLM Chatbot API:
- Flask: Lightweight web framework to expose the API endpoints.
- Sentence Transformers: Used for generating embeddings from textual data.
- Pinecone: A vector database to store and efficiently retrieve sentence embeddings.
- Groq (Not to be confused with Grok by Elon Musk!): A Large Language Model (LLM) used for generating insightful responses.
Here’s a step-by-step breakdown of the process:
- All input data is stored in a structured JSON format. This data serves as the knowledge base for the chatbot.
- The data is processed through the all-MiniLM-L6-v2 model (part of the Sentence Transformers library) to convert each sentence into high-dimensional embeddings.
- The generated embeddings are stored in Pinecone, a vector database, allowing for efficient and fast retrieval during query processing.
- When a user sends a query, the API retrieves the top 5 most relevant results from the vector database using cosine similarity. This ensures the most relevant pieces of information are returned.
- The top 5 results are then passed to the deepseek-r1-distill-llama-70b Large Language Model (LLM) to generate a coherent and contextually appropriate response to the user’s query.
- Fast Response Time: The use of vector embeddings ensures efficient retrieval of relevant data.
- Seamless Integration: Easily integrates with your personal website for a more interactive experience.
- Scalable: Can handle large datasets and provide insightful responses across various domains.
- Python 3.x
- Install dependencies via
pip install -r requirements.txt
.
- Change directory to
embeddings/
- Run
python embeddings.py
to run the embeddings code
This will transform all data in the json file to embeddings and store in the pinecone db.
- Clone this repository.
- Install the required packages.
- Run the Flask app:
python api/index.py
The API will be up and running, ready to handle your queries!
This API serves as a powerful tool for integrating AI-driven conversations into any platform, allowing for dynamic interactions based on your custom dataset. With the combination of vector embeddings and an LLM, this project provides an intelligent and scalable solution for creating a chatbot that can understand and respond with meaningful information.