Open Source RAG Frameworks 2026: Build Free RAG Pipelines
You've probably heard the concept of RAG (Retrieval-Augmented Generation) countless times by now—letting AI query a database before answering questions to significantly reduce hallucinations. But when it actually comes to building one, most people get stuck at the same spot: too many tools, no idea which to pick. LangChain? LlamaIndex? Haystack? Chroma or Qdrant? Every one of them claims to be an all-in-one RAG solution, yet after installing a pile of libraries, you still can't get a complete Q&A pipeline running. This article helps you sort through the most mainstream open-source RAG frameworks in 2026, covering everything from tech selection to actual code in one go. Repo links are at the end.
💡 What You Will Learn
You've probably heard the concept of RAG (Retrieval-Augmented Generation) countless times by now—letting AI query a database before answering questions to significantly reduce hallucinations. But when
📜 Table of Contents
LangChain⭐115k
from langchain.chains import create_retrieval_chain
from langchain.chains.combine_documents import create_stuff_documents_chain
from langchain_community.vectorstores import Chroma
retriever = vectorstore.as_retriever()
chain = create_stuff_documents_chain(llm, prompt)
rag_chain = create_retrieval_chain(retriever, chain)
LlamaIndex⭐38k
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What is RAG?")
Haystack by deepset⭐18k
from haystack import Pipeline
from haystack.components.retrievers import InMemoryBM25Retriever
from haystack.components.generators import OpenAIGenerator
pipe = Pipeline()
pipe.add_component("retriever", InMemoryBM25Retriever(document_store))
pipe.add_component("generator", OpenAIGenerator(model="gpt-4"))
pipe.connect("retriever.documents", "generator.documents")
Chroma⭐17k
pip install chromadb
import chromadb
from chromadb.utils import embedding_functions
client = chromadb.Client()
collection = client.create_collection("my_docs")
collection.add(documents=["RAG stands for Retrieval-Augmented Generation"], ids=["1"])
results = collection.query(query_texts=["What is RAG"], n_results=3)
Qdrant⭐23k
from qdrant_client import QdrantClient
client = QdrantClient(":memory:")
client.create_collection(collection_name="test", vectors_config=...)
Weaviate⭐12k
{
"modules": {
"generative-openai": {},
"text2vec-transformers": {}
}
}
{
Get {
Documents(ask: { question: "What is RAG?" }) {
title
_additional { answer { result } }
}
}
}
RAGFlow⭐22k
Dify⭐60k
|:----|:--------|:----|
# 1. Load documents → 2. Chunk/Split → 3. Embedding → 4. Store → 5. Retrieve → 6. Generate
# Example using LangChain + Chroma
from langchain_community.document_loaders import TextLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.vectorstores import Chroma
from langchain.chains import RetrievalQA
#
loader = TextLoader("knowledge.txt")
docs = loader.load()
# Chunk/Split
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
splits = text_splitter.split_documents(docs)
# Embedding+Store
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings)
# Retrieve+GenerateAPI
qa = RetrievalQA.from_chain_type(llm=llm, retriever=vectorstore.as_retriever())
answer = qa.invoke("")
---
| GitHub | Stars | |
|---|---|---|
| LangChain | https://github.com/langchain-ai/langchain | ⭐115k |
| LlamaIndex | https://github.com/run-llama/llama_index | ⭐38k |
| Haystack | https://github.com/deepset-ai/haystack | ⭐18k |
| Chroma | https://github.com/chroma-core/chroma | ⭐17k |
| Qdrant | https://github.com/qdrant/qdrant | ⭐23k |
| Weaviate | https://github.com/weaviate/weaviate | ⭐12k |
| RAGFlow | https://github.com/infiniflow/ragflow | ⭐22k |
| Dify | https://github.com/langgenius/dify | ⭐60k |
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.
