Skip to main content

Knowledge CLI Commands

The praisonai knowledge command group provides CLI access to knowledge base management.

Commands Overview

Index Command

Add documents to a knowledge base.

Arguments

Options

Examples

Exit Codes

Chain commands with praisonai knowledge index … && … to run the next step only when every source indexes successfully.

Search Command

Search/retrieve from a knowledge base without LLM generation.

Arguments

Options

Examples

Output

Results print as a Rich table with #, Score, Source, and Content columns:
When nothing matches, the command prints:
If search consistently returns No results found. for content you just indexed, the embedding call likely failed silently on an older build. Upgrade to the latest release (PR #2823), where indexing errors exit non-zero and print ✗ Failed to index …. See Troubleshooting.

Result normalisation

The CLI accepts results from all three backend return shapes — a typed SearchResult, a legacy dict with a "results" key, or a plain list. Custom backends don’t have to pick one format; the command normalises them all before display. See Search Results for the SearchResult shape and how to consume it from Python.

List Command

List available knowledge bases/collections.

Options

Example

Output:

Scope Identifiers

The mem0 backend requires at least one scope identifier (--user-id, --agent-id, or --run-id). If none is provided, a warning will be shown and default_user will be used.

When to Use Each Scope

Backend Selection

mem0 (Default)

Best for production apps with multi-user support:

Chroma

Best for local development:

Internal

Lightweight built-in storage:

Configuration File

You can provide a YAML configuration file:

Environment Variables

Custom embedders configured via --config knowledge-config.yaml (see Configuration File) take precedence over OPENAI_EMBEDDING_MODEL — the env var is a convenience for the default OpenAI path only.

Profiling

Enable profiling to measure performance:
The profile output includes:
  • Wall time
  • Peak memory usage
  • Modules imported
  • Top functions by time
  • praisonai rag query - Answer questions with citations
  • praisonai chat - Interactive chat with knowledge retrieval