Quickstart
Install RAGForge, build a knowledge base, and run a query — three ways. Code is sourced from README.md.
Install
RAGForge requires Python 3.9+. The core install has no required dependencies.
bash
pip install ragforge # core (zero dependencies)
pip install ragforge[api] # add HTTP API server
pip install ragforge[pdf] # PDF support (pypdf)
pip install ragforge[pipeline] # sentence-transformers embeddings + reranking
pip install ragforge[openai] # OpenAI embeddings + LLM
pip install ragforge[anthropic] # Anthropic LLM
pip install ragforge[docling] # Docling backend (best for complex docs)
pip install ragforge[ui] # local web dashboard
pip install ragforge[all] # everything1. CLI in 30 seconds
bash
ragforge info # see registered components
ragforge knowledge build my-kb ./docs/ # build a knowledge base
ragforge query my-kb "How do refunds work?" # query it
ragforge query my-kb "refunds?" --generate --llm ollama # with grounded answerFull reference: see the CLI page.
2. Python library
python
import ragforge as rf
doc = rf.parse_file("notes.md")
chunks = rf.chunk_document(doc, strategy="structure")
for c in chunks:
print(f"[{c.metadata.get('section')}] ~{c.token_count} tokens")Build a knowledge base and query it:
python
from ragforge.pipeline import build_knowledge_base, query_knowledge_base
build_knowledge_base(name="my-kb", sources=["./docs/"])
result = query_knowledge_base(knowledge="my-kb", question="Refund policy?")
for chunk in result["chunks"]:
print(f" [{chunk['score']:.3f}] {chunk['text'][:80]}")Or use the object-oriented KnowledgeBase class:
python
from ragforge.pipeline import KnowledgeBase
kb = KnowledgeBase.build(
name="my-kb",
sources=["docs/", "faq.md"],
embedder="default",
chunk_strategy="structure",
)
for chunk, score in kb.query("How do refunds work?", top_k=5, mode="hybrid"):
print(f" [{score:.4f}] {chunk.text[:80]}...")3. HTTP API
bash
pip install ragforge[api]
ragforge serve
# Interactive docs at http://localhost:8000/docsThen call it from any language. Example: curl with an LLM answer.
bash
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{
"knowledge": "my-kb",
"question": "How do refunds work?",
"generate": true,
"llm": "ollama"
}'Docker
bash
docker build -t ragforge .
docker run -p 8000:8000 ragforgeWhat's next
- Browse the HTTP API reference for every endpoint.
- Read Architecture to see how the pieces fit together.
- Set up Evaluation to measure changes objectively.