Skip to main content
Getting Started

Use the CLI

Search and query knowledge bases directly from the terminal with the Bailian CLI.

The Bailian CLI wraps knowledge-base search and Q&A into commands you can drive from the terminal or an Agent.
Knowledge-base CLI capabilities are currently available only to China site (aliyun.com) accounts.

Commands

CapabilityCommandNotesCommon options
Semantic searchbl knowledge searchCalls a published retrieval service to run semantic search--query query text, --agent-id retrieval service ID
RAG Q&Abl knowledge chatCalls a published Q&A service for RAG Q&A with streaming output--message message text, --agent-id Q&A service ID
Direct retrieval (deprecated)bl knowledge retrieveRetrieves directly against a knowledge base; use search instead--index-id knowledge base ID, --query query text

Example

bl knowledge search --query "How do I configure the chunking strategy?" --agent-id <retrieval-service-id>
bl knowledge chat --message "How do I configure the chunking strategy?" --agent-id <qa-service-id>
Append --help to any command for full parameter details. See the RAG command reference for more commands.