Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Knowledge CLI Commands

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

Commands Overview

CommandDescription
indexAdd/index documents into a knowledge base
searchSearch/retrieve from knowledge base
addAlias for index
listList available knowledge bases

Index Command

Add documents to a knowledge base.
praisonai knowledge index [OPTIONS] SOURCES...

Arguments

ArgumentDescription
SOURCESSource files, directories, or URLs to index (required)

Options

OptionShortDescriptionDefault
--collection-cCollection/knowledge base namedefault
--user-id-uUser ID for scoping (required for mem0)None
--agent-id-aAgent ID for scopingNone
--run-id-rRun ID for scopingNone
--backend-bKnowledge backend: mem0, chroma, internalmem0
--config-fConfig file pathNone
--verbose-vVerbose outputFalse
--profileEnable performance profilingFalse
--profile-outSave profile to JSON fileNone

Examples

# Index a directory with user scope
praisonai knowledge index ./docs --user-id myuser

# Index with specific collection and agent scope
praisonai knowledge index paper.pdf --collection research --agent-id research_agent

# Index using chroma backend
praisonai knowledge index ./data --backend chroma

# Index with profiling
praisonai knowledge index ./docs --user-id myuser --profile --profile-out ./profile.json

Search Command

Search/retrieve from a knowledge base without LLM generation.
praisonai knowledge search [OPTIONS] QUERY

Arguments

ArgumentDescription
QUERYSearch query (required)

Options

OptionShortDescriptionDefault
--collection-cCollection to searchdefault
--user-id-uUser ID for scoping (required for mem0)None
--agent-id-aAgent ID for scopingNone
--run-id-rRun ID for scopingNone
--backend-bKnowledge backend: mem0, chroma, internalmem0
--top-k-kNumber of results to retrieve5
--hybridUse hybrid retrieval (dense + BM25)False
--config-fConfig file pathNone
--verbose-vVerbose outputFalse
--profileEnable performance profilingFalse

Examples

# Basic search with user scope
praisonai knowledge search "capital of France" --user-id myuser

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

# Hybrid search using chroma backend
praisonai knowledge search "Python tutorial" --hybrid --backend chroma

# Search with agent scope
praisonai knowledge search "company policy" --agent-id company_bot

List Command

List available knowledge bases/collections.
praisonai knowledge list [OPTIONS]

Options

OptionShortDescriptionDefault
--verbose-vVerbose outputFalse

Example

praisonai knowledge list
Output:
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Collection   ┃ Path                              ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ default      │ ./.praison/knowledge/default      │
│ research     │ ./.praison/knowledge/research     │
└──────────────┴───────────────────────────────────┘

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

ScopeUse CaseExample
--user-idPer-user knowledge isolationMulti-tenant apps
--agent-idShared agent knowledgeCompany FAQ bot
--run-idSession-specific contextConversation history

Backend Selection

mem0 (Default)

Best for production apps with multi-user support:
praisonai knowledge index ./docs --user-id alice --backend mem0

Chroma

Best for local development:
praisonai knowledge index ./docs --backend chroma

Internal

Lightweight built-in storage:
praisonai knowledge index ./docs --backend internal

Configuration File

You can provide a YAML configuration file:
# knowledge-config.yaml
knowledge:
  vector_store:
    provider: chroma
    config:
      collection_name: my_docs
      path: ./.praison/knowledge/my_docs
  retrieval:
    strategy: hybrid
praisonai knowledge index ./docs --config knowledge-config.yaml

Profiling

Enable profiling to measure performance:
praisonai knowledge index ./docs --user-id myuser --profile --profile-out ./profile.json
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