Skip to main content

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 --verbose

Options

OptionDescriptionDefault
--collection, -cCollection/knowledge base namedefault
--config, -fConfig file path (YAML)None
--verbose, -vVerbose outputFalse
--profileEnable performance profilingFalse
--profile-outSave profile to JSON fileNone
--profile-topTop N items in profile20

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 --rerank

Options

OptionDescriptionDefault
--collection, -cCollection to querydefault
--top-k, -kNumber of results to retrieve5
--min-scoreMinimum relevance score (0.0-1.0)0.0
--hybridUse hybrid retrieval (dense + keyword)False
--rerankEnable reranking of resultsFalse
--citations/--no-citationsInclude citationsTrue
--citations-modeCitations mode: append, inline, hiddenappend
--max-context-tokensMaximum context tokens4000
--config, -fConfig file pathNone
--verbose, -vVerbose outputFalse
--profileEnable performance profilingFalse

praisonai search - Search Without LLM

Search the knowledge base and return raw results without LLM generation.
# Basic search
praisonai search "capital of France"

# Search with more results
praisonai search "main findings" --collection research --top-k 10

# Hybrid search
praisonai search "key concepts" --hybrid

Options

OptionDescriptionDefault
--collection, -cCollection to searchdefault
--top-k, -kNumber of results to retrieve5
--hybridUse hybrid retrievalFalse
--config, -fConfig file pathNone
--verbose, -vVerbose outputFalse

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 10

Using 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: 8000
Use with commands:
praisonai index ./docs --config retrieval.yaml
praisonai query "Summary?" --config retrieval.yaml

Performance 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.json

Verbose Mode

Get detailed output for debugging:
praisonai query "What is the answer?" --verbose
Output includes:
  • Collection being queried
  • Retrieval strategy used
  • Number of sources found
  • Relevance scores
  • Elapsed time

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key for embeddings and generation
ANTHROPIC_API_KEYAnthropic API key (if using Claude)

Comparison with Legacy Commands

The unified retrieval commands replace the separate knowledge and rag command families:
LegacyNew Unified
praisonai knowledge addpraisonai index
praisonai rag querypraisonai query
praisonai knowledge searchpraisonai search
The legacy commands are still available but marked as deprecated. Use the new unified commands for all new projects.

Next Steps