YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
RAG System with FAISS Vector Database
This repository contains a Retrieval-Augmented Generation (RAG) system with:
- FAISS vector database for efficient similarity search
- Document embeddings using thenlper/gte-small
- Compatible with HuggingFaceH4/zephyr-7b-beta for generation
Usage with API
from huggingface_hub import hf_hub_download
from langchain.vectorstores import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings
import json
import os
# Download the vector database and config
vector_db_path = hf_hub_download(repo_id="tush1507/my-rag-system", repo_type="model", filename="vector_database/index.faiss")
vector_db_dir = os.path.dirname(vector_db_path)
config_path = hf_hub_download(repo_id="tush1507/my-rag-system", repo_type="model", filename="config/embedding_config.json")
# Load the embedding configuration
with open(config_path, 'r') as f:
embedding_config = json.load(f)
# Create the embedding model
embedding_model = HuggingFaceEmbeddings(
model_name=embedding_config["model_name"],
encode_kwargs={"normalize_embeddings": embedding_config.get("normalize_embeddings", True)}
)
# Load the vector database
knowledge_base = FAISS.load_local(vector_db_dir, embedding_model)
# Search for similar documents
query = "Your question here"
docs = knowledge_base.similarity_search(query, k=5)
# Now process with your preferred LLM
# [Your LLM code here]
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support