CLI¶
ragwise ships two CLI commands: ragwise init and ragwise serve.
ragwise init¶
Generates a fully-typed config file in the current directory.
Creates ragwise_config.py:
# ragwise_config.py — generated by `ragwise init`
# Edit and import into your project.
from ragwise import RAG, QueryConfig
rag = RAG(
# LLM provider — change to "anthropic/claude-haiku-4-5" or "ollama/llama3"
llm="openai/gpt-4o-mini",
# Embedder — change to "local/all-MiniLM-L6-v2" for offline use
embedder="openai/text-embedding-3-small",
# Store — upgrade path:
# "memory" dev / CI (volatile)
# "lance://./ragwise-index" persistent dev (no server)
# "postgresql://user:pass@host/db" production
store="memory",
# Chunking
chunk_size=512,
chunk_overlap=64,
# LLM response caching
cache=True,
)
query_config = QueryConfig(
top_k=5,
include_citations=True,
check_sufficiency=True,
)
Import and use directly:
from ragwise_config import rag, query_config
async def main():
async with rag:
await rag.ingest("./docs/")
answer = await rag.query("What is the refund policy?", config=query_config)
print(answer.text)
ragwise serve¶
Starts a minimal HTTP server exposing the RAG pipeline as an API.
pip install ragwise[serve]
ragwise serve --store lance://./ragwise-index --llm openai/gpt-4o-mini --port 8080
Options:
| Flag | Default | Description |
|---|---|---|
--store |
memory |
Store backend (same strings as RAG(store=...)) |
--llm |
openai/gpt-4o-mini |
LLM provider string |
--embedder |
openai/text-embedding-3-small |
Embedder string |
--port |
8080 |
Port to listen on |
--host |
0.0.0.0 |
Host to bind to |
Endpoints¶
POST /ingest¶
curl -X POST http://localhost:8080/ingest \
-H "Content-Type: application/json" \
-d '{"path": "./docs/"}'
Response:
POST /query¶
curl -X POST http://localhost:8080/query \
-H "Content-Type: application/json" \
-d '{"question": "What is the refund policy?", "top_k": 5}'
Response:
{
"text": "You can get a full refund within 30 days.",
"citations": [
{"source": "docs/policies.md", "text": "Our refund policy..."}
],
"sufficient": true
}