Skip to content

CLI

Both packages install a raglite command with the same commands and flags.

Terminal window
npm install -g raglite-toolkit @huggingface/transformers
# or run without installing:
npx -y -p raglite-toolkit -p @huggingface/transformers raglite --help

Every command takes a <path|url>: a file, a folder (indexed as a collection) or a web URL. The index is reused between commands, so search after index embeds only the query.

Terminal window
raglite index ./docs
raglite search ./docs "refund policy" --top-k 3
raglite search ./docs "ERR_4021" --mode hybrid
raglite ask ./docs "What is the refund policy?" --llm-provider anthropic --stream
raglite serve ./docs --llm-provider openai --port 8085 --token "$RAGLITE_TOKEN"
raglite mcp ./docs --store-dir "$PWD/.raglite"
raglite eval ./docs questions.jsonl --rerank cohere

Builds or reuses the index and prints the build result as JSON.

Flag Meaning
--chunk-size N Words per chunk (characters for Chinese, Japanese, Thai, …)
--overlap N Overlap between chunks
--rebuild Re-index even if nothing changed

raglite search <path|url> "query" prints the results as JSON.

Flag Meaning
--top-k N Number of results
--mode M vector, keyword or hybrid

raglite ask <path|url> "question" prints the answer, then a Sources: list of the cited passages with page and section.

Flag Meaning
--llm-provider P Required. openai, anthropic, google, mistral, cohere, groq, xai, ollama
--llm-model M Model; default from Choosing providers
--llm-key K API key; default from the provider’s environment variable
--top-k N Passages given to the LLM
--mode M Retrieval mode
--stream Print the answer as it is written (no Sources: list)

Starts the REST API and runs until stopped.

Flag Meaning
--llm-provider P, --llm-model M, --llm-key K LLM for /ask; without one, /ask returns 503
--host H Default 127.0.0.1
--port N Default 8085
--token T Bearer token required on every endpoint except /health
--mode M Default retrieval mode

Serves the MCP server over stdio. Takes --llm-provider, --llm-model and --llm-key (which add the ask tool) and --mode. The TypeScript package needs @modelcontextprotocol/sdk; the Python package needs the [mcp] extra.

raglite eval <path|url> questions.jsonl scores retrieval on your questions: recall@k, MRR and hit rate for each mode. See Evaluating retrieval.

Flag Meaning
--top-k N Results scored per question (default 5)
--modes M,M Modes to compare, comma-separated (default vector,keyword,hybrid)
--rerank P Also score each mode reranked by cohere, voyage or llm
--rerank-model M, --rerank-key K Reranking model and API key
--llm-provider P, --llm-model M, --llm-key K LLM for --rerank llm
--json Print the report as JSON
Flag Meaning
--store-dir D Where indexes are kept (default ./.raglite)
--embed-provider P Embedding provider; default: the existing index’s, or local for a new one
--embed-model M Embedding model
--embed-key K Embedding API key

Use the same --store-dir and embedding flags for every command on the same index.

Flag Meaning
--vector-provider P memory, qdrant, pinecone or lancedb
--vector-url U Qdrant URL or Pinecone index host
--vector-key K API key for the store
--vector-index I Shared Qdrant collection name
--vector-store-dir D Folder for the memory and LanceDB stores

Results go to stdout and logs to stderr, so JSON output can be piped:

Terminal window
raglite search ./docs "refund policy" --top-k 3 | jq -r '.[] | "\(.score) \(.metadata.source)"'

raglite --version prints the version.