RAG CLI
Thepraisonai rag command group provides full RAG functionality from the command line.
Commands
index
Build or update an index from source documents.sources- Files, directories, or URLs to index
--collection, -c- Collection name (default: “default”)--chunking- Chunking strategy: token, sentence, recursive, semantic--chunk-size- Chunk size in tokens (default: 512)--config, -f- Config file path--verbose, -v- Verbose output--profile- Enable performance profiling--profile-out- Save profile to JSON file--profile-top- Top N items in profile (default: 20)
This command uses the Knowledge substrate for indexing. Equivalent to
praisonai knowledge index.query
One-shot question answering with citations.--collection, -c- Collection to query (default: “default”)--top-k, -k- Number of results (default: 5)--hybrid- Use hybrid retrieval (dense + BM25)--rerank- Enable reranking of results--citations/--no-citations- Include citations (default: true)--config, -f- Config file path--verbose, -v- Verbose output--profile- Enable performance profiling--profile-out- Save profile to JSON file--profile-top- Top N items in profile (default: 20)
chat
Interactive RAG chat session with streaming.--collection, -c- Collection to chat with (default: “default”)--top-k, -k- Results per query (default: 5)--hybrid- Use hybrid retrieval (dense + BM25)--rerank- Enable reranking of results--config, -f- Config file path--stream/--no-stream- Stream responses (default: true)
- Type questions to get answers
exit,quit, orqto end sessionCtrl+Cto interrupt
eval
Evaluate RAG retrieval quality against golden queries.test_file- JSON file with test queries
--collection, -c- Collection to evaluate (default: “default”)--top-k, -k- Results to retrieve (default: 5)--output, -o- Output results to file--verbose, -v- Verbose output--profile- Enable performance profiling--profile-out- Save profile to JSON file--profile-top- Top N items in profile (default: 20)
serve
Start RAG as a microservice API.--collection, -c- Collection to serve (default: “default”)--host, -h- Host to bind (default: 127.0.0.1)--port, -p- Port to bind (default: 8080)--hybrid- Use hybrid retrieval (dense + BM25)--rerank- Enable reranking of results--openai-compat- Enable OpenAI-compatible/v1/chat/completionsendpoint--config, -f- Config file path--verbose, -v- Verbose output--profile- Enable performance profiling--profile-out- Save profile to JSON file--profile-top- Top N items in profile (default: 20)
Query Request:
Configuration File
Create a YAML config file for reusable settings:Configuration Precedence
Settings are applied in this order (highest priority first):- CLI flags -
--hybrid,--rerank,--top-k, etc. - Environment variables -
PRAISONAI_HYBRID=true, etc. - Config file - YAML configuration
- Defaults - Built-in defaults
Environment Variables
Override settings with environment variables:Exit Codes
Knowledge vs RAG
Knowledge is the indexing and retrieval substrate:- Indexes documents into vector stores
- Performs similarity search
- Returns raw chunks/documents
- Use
praisonai knowledgefor indexing and search without LLM generation
- Retrieves context using Knowledge
- Generates answers with an LLM
- Provides citations
- Use
praisonai ragfor question answering with generated responses
knowledge index and query with rag query.
Tips
- Start simple: Use defaults, then customize
- Use hybrid retrieval:
--hybridcombines dense + keyword search for better recall - Enable reranking:
--rerankimproves precision for complex queries - Name collections: Organize by project or topic
- Use config files: For reproducible setups
- Check verbose output: Debug retrieval issues
- Profile performance: Use
--profileto identify bottlenecks - Evaluate regularly: Track quality over time

