Skip to main content

Index Types API

Configure the indexing strategy for document retrieval.

Flag

--index-type <type>
# or
--index <type>

Available Index Types

TypeDescriptionBest For
vectorSemantic similarity searchConceptual queries
keywordBM25 keyword matchingExact term queries
hybridCombined vector + keywordGeneral purpose
graphKnowledge graph (placeholder)Entity relationships

Usage

Vector Index (Default)

# Semantic similarity search
praisonai knowledge query "What is machine learning?" --index-type vector

Keyword Index (BM25)

# Exact keyword matching
praisonai knowledge query "API endpoint authentication" --index-type keyword

Hybrid Index

# Combined semantic + keyword
praisonai knowledge query "Python async await" --index-type hybrid

Index Selection Guide

Query TypeRecommended Index
Conceptual questionsvector
Exact terms, code, nameskeyword
Mixed querieshybrid
Unknown query typeshybrid

Examples

Keyword Search for Code

# Find exact function names
praisonai knowledge query "def authenticate_user" --index-type keyword

Semantic Search for Concepts

# Find conceptually related content
praisonai knowledge query "How to handle errors gracefully" --index-type vector

Hybrid for General Queries

# Best of both worlds
praisonai knowledge query "Python authentication best practices" --index-type hybrid

Full Pipeline

# Complete configuration
praisonai knowledge query "How to implement OAuth?" \
  --vector-store chroma \
  --retrieval fusion \
  --reranker simple \
  --index-type hybrid \
  --query-mode default

See Also