Use the CLI
Updated at:
Search and query knowledge bases directly from the terminal with the Bailian CLI.
The Bailian CLI (bailian-cli) wraps knowledge-base search and Q&A into commands you can drive from the terminal or an Agent.
NoteKnowledge-base CLI capabilities are currently available only to China site (aliyun.com) accounts.
Commands
| Capability | Command | Notes | Common options |
|---|---|---|---|
| Semantic search | bl knowledge search | Calls a published retrieval service to run semantic search | --query query text, --agent-id retrieval service ID |
| RAG Q&A | bl knowledge chat | Calls a published Q&A service for RAG Q&A with streaming output | --message message text, --agent-id Q&A service ID |
To initialize a knowledge base or sync a local directory, use bl knowledge init, bl knowledge doc sync, or bl knowledge doc import; see the RAG command reference for full parameters. |
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. Installation commands and usage examples are available on the console's Service Channels page.
Notebl knowledge retrieve (direct retrieval by knowledge base ID) was removed in Bailian CLI 2.5.0. Use bl knowledge search with the --agent-id of a published retrieval service instead; see the RAG command reference.
Is this page helpful?