Retrieval CLI Commands
Command-line interface for knowledge indexing and retrieval
Overview
The retrieval CLI provides unified commands for indexing documents and querying knowledge bases. These commands are Agent-first and use the same retrieval pipeline as the Python SDK.
Commands
praisonai index – Index Documents
Index documents into a knowledge base for later retrieval.
# Index a directory
praisonai index ./docs
# Index specific files
praisonai index paper.pdf report.txt
# Index with custom collection name
praisonai index ./data --collection research
# Index with verbose output
praisonai index ./docs --verboseOptions
| Option | Description | Default |
|---|---|---|
--collection, -c | Collection/knowledge base name | default |
--config, -f | Config file path (YAML) | None |
--verbose, -v | Verbose output | False |
--profile | Enable performance profiling | False |
--profile-out | Save profile to JSON file | None |
--profile-top | Top N items in profile | 20 |
praisonai query – Query with Answer and Citations
Query the knowledge base and get a structured answer with citations.
# Basic query
praisonai query "What are the main findings?"
# Query specific collection
praisonai query "Summarize the document" --collection research
# Query with more results
praisonai query "Key points?" --top-k 10
# Query without citations
praisonai query "Summary?" --no-citations
# Query with hybrid retrieval and reranking
praisonai query "What is the conclusion?" --hybrid --rerankOptions
| Option | Description | Default |
|---|---|---|
--collection, -c | Collection to query | default |
--top-k, -k | Number of results to retrieve | 5 |
--min-score | Minimum relevance score (0.0-1.0) | 0.0 |
--hybrid | Use hybrid retrieval (dense + keyword) | False |
--rerank | Enable reranking of results | False |
--citations/--no-citations | Include citations | True |
--citations-mode | Citations mode: append, inline, hidden | append |
--max-context-tokens | Maximum context tokens | 4000 |
--config, -f | Config file path | None |
--verbose, -v | Verbose output | False |
--profile | Enable performance profiling | False |
praisonai search – Retrieve from Knowledge Base
Return raw ranked hits from a knowledge-base collection. No LLM call, no answer synthesis.
Use it when you want the retrieved snippets themselves (debugging retrieval, inspecting what an Agent would see). For an LLM-synthesised answer with citations, use praisonai query above.
# Search the default collection
praisonai search "capital of France"
# Search a specific collection with more results
praisonai search "main findings" --collection research --top-k 10
# Hybrid retrieval (dense + keyword)
praisonai search "key concepts" --hybridOptions
| Option | Description | Default |
|---|---|---|
--collection, -c | Collection to search | default |
--top-k, -k | Number of results to retrieve | 5 |
--hybrid | Use hybrid retrieval (dense + keyword) | False |
--config, -f | Config file path (YAML) | None |
--verbose, -v | Verbose output | False |
Examples
Complete Workflow
# 1. Index your documents
praisonai index ./company_docs --collection company
# 2. Query with citations
praisonai query "What is our vacation policy?" --collection company
# 3. Search for specific terms
praisonai search "remote work" --collection company --top-k 10Using Config Files
Create a config file retrieval.yaml:
knowledge:
vector_store:
provider: chroma
config:
collection_name: my_docs
path: .praison/knowledge
retrieval:
top_k: 10
rerank: true
max_context_tokens: 8000Use with commands:
praisonai index ./docs --config retrieval.yaml
praisonai query "Summary?" --config retrieval.yamlPerformance Profiling
Profile indexing and query performance:
# Profile indexing
praisonai index ./large_corpus --profile --profile-out index_profile.json
# Profile query
praisonai query "Complex question" --profile --profile-out query_profile.json
# View profile results
cat query_profile.jsonVerbose Mode
Get detailed output for debugging:
praisonai query "What is the answer?" --verboseOutput includes:
- Collection being queried
- Retrieval strategy used
- Number of sources found
- Relevance scores
- Elapsed time
Environment Variables
| Variable | Description |
|---|---|
OPENAI_API_KEY | OpenAI API key for embeddings and generation |
ANTHROPIC_API_KEY | Anthropic API key (if using Claude) |
Comparison with Legacy Commands
The unified retrieval commands replace the separate knowledge and rag command families:
| Legacy | New Unified |
|---|---|
praisonai knowledge add | praisonai index |
praisonai rag query | praisonai query |
praisonai knowledge search | praisonai search "Q" --collection C (or praisonai search "Q" for the default collection) |
The legacy commands are still available but marked as deprecated. Use the new unified commands for all new projects.
Next Steps
- Agent Retrieval (Python) – Use retrieval in Python code
- Knowledge Concepts – Learn about knowledge bases
- CLI Reference – Full CLI documentation