Deepseek RAG langchain Ubuntu server

Deepseek RAG langchain Ubuntu server

  • 13 Feb, 2025
  • AI
Installation Deekseek RAG on Ubuntu 22.04, 24.04 Server:


The installation and setup of DeepSeek RAG on Ubuntu 22.04 can be divided into three main parts:

1. Installation of DeepSeek Model & Dependencies
This step involves setting up the environment, installing the required libraries, and downloading the DeepSeek 1.5B model(or other Deeekseek model) from Hugging Face. It ensures that the model is properly configured for local execution.

2. Creation of Vector Database from PDFs
In this phase, we extract text from PDF documents, generate vector embeddings using DeepSeek embeddings, and store them in a vector database (ChromaDB/FAISS, etc.). This enables efficient semantic search over documents.

3. Generating Responses Using RAG (Retrieval-Augmented Generation)
The final step involves retrieving relevant document chunks from the vector database based on a query, using them as context for the DeepSeek model, and generating a meaningful response. This is done via an API that allows querying through an endpoint.


Please find below details of each step.


Install DeepSeek LLM, LangChain, and other dependencies.(Install Deekseek using Hugging Face)
Install a vector database (e.g., FAISS, ChromaDB).
Ensure all required libraries (like PyPDF for PDF processing) are installed.


Vector Generation (generate_vector.py):

Read PDFs from a specified directory.
Extract text from PDFs.
Convert extracted text into embeddings (vectors) using a DeepSeek-compatible model.
Store vectors in a vector database.


Main API (main.py):

Load the stored vector database.
Accept user queries via API.
Retrieve the most relevant content using a similarity search.
Process the query and return results.