Skip to main content
Capabilities

RAG

Bailian CLI command reference for knowledge bases, documents, chunks, and retrieval/Q&A services.

Invoke the full Bailian knowledge-base surface from the terminal: retrieval/Q&A service calls, knowledge base lifecycle management, document and chunk management, and category/collection management.
Knowledge-base capabilities are currently available only to China site (aliyun.com) accounts.
Append --help to any command for full parameter details, e.g. bl knowledge search --help. High-risk delete operations require an explicit --yes to actually run — without it, the command only previews what would happen.
See the RAG docs for feature-page usage.

Retrieval and Q&A

search and chat call a published retrieval/Q&A service via --agent-id; the actual retrieval strategy (multi-index recall, ranking, reranking, etc.) is driven by the service's server-side configuration.
CapabilityCommandNotesCommon options
Semantic searchbl knowledge searchCall a retrieval service for semantic search--query, --agent-id retrieval service ID
RAG Q&Abl knowledge chatCall a Q&A service for RAG Q&A, with streaming output--message, --agent-id Q&A service ID
Direct retrieval (deprecated)bl knowledge retrieveRetrieve directly from a knowledge base; prefer search--index-id knowledge base ID, --query
bl knowledge search --query "How do I configure the chunking strategy?" --agent-id <retrieval-service-id> --workspace-id <workspace-id>
bl knowledge chat --message "What is RAG?" --agent-id <qa-service-id> --workspace-id <workspace-id>

Knowledge base management

CapabilityCommandNotes
Create knowledge basebl knowledge createCreate a knowledge base and import data-center files or categories
List knowledge basesbl knowledge listList knowledge bases in the workspace
Knowledge base detailsbl knowledge infoShow a knowledge base's indexing configuration
Update knowledge basebl knowledge updateUpdate a knowledge base's name, description, or rerank threshold
Delete knowledge basebl knowledge deleteDelete a knowledge base with all its documents and chunks (data-center files are unaffected)
Usage statsbl knowledge statsView a knowledge base's storage and QPS monitoring data
bl knowledge create --name demo --description "product docs" --doc-id <file-id> --workspace-id <workspace-id> --wait

Document and file management

A data-center file is the raw asset; once imported into a knowledge base it becomes a document. Deleting a file and deleting a document are independent operations.
CapabilityCommandNotes
Upload documentbl knowledge doc uploadUpload local files or directories to the data center, optionally importing into a knowledge base
OSS batch importbl knowledge doc import-ossBatch-import files from an authorized OSS bucket into the data center
List documentsbl knowledge doc listView parse/index status of documents in a knowledge base
Import job statusbl knowledge doc statusCheck a knowledge base import job's status
Tag documentsbl knowledge doc tagBatch-update tags on data-center files
Delete documentbl knowledge doc deleteDelete documents and their chunks from a knowledge base
File detailsbl knowledge file getShow a data-center file's details (size, MD5, tags, timestamps)
List filesbl knowledge file listList files in a data-center category
Delete filebl knowledge file deletePermanently delete a data-center file
bl knowledge doc upload --file ./docs/ --index-id <index-id> --wait

Chunk management

CapabilityCommandNotes
Add chunkbl knowledge chunk addAdd a chunk directly to a knowledge base
List chunksbl knowledge chunk listList chunks in a knowledge base with content and status
Update chunkbl knowledge chunk updateUpdate chunk content, or toggle its retrieval visibility
Delete chunkbl knowledge chunk deleteDelete chunks from a knowledge base (irreversible)
bl knowledge chunk add --index-id <index-id> --doc-id <doc-id> --content "chunk body" --title intro

Category and collection management

Categories organize data-center files by business domain. Collections define where files are stored — platform-managed storage by default, or a custom OSS bucket.
CapabilityCommandNotes
Add categorybl knowledge category addCreate a data-center category, optionally as a sub-category
List categoriesbl knowledge category listList data-center categories
Delete categorybl knowledge category deleteDelete a data-center category
Create collectionbl knowledge collection createCreate a FILE data collection (managed storage, or a custom OSS bucket)
Collection detailsbl knowledge collection getShow a data collection's details

Retrieval/Q&A service management

A service (agent) is the entry point for search and chat: create a service, bind a knowledge base, verify against the beta draft, then deploy to publish.
CapabilityCommandNotes
Create servicebl knowledge service createCreate a retrieval/Q&A service (initial status: draft/beta)
List servicesbl knowledge service listList retrieval/Q&A services in the workspace
Service detailsbl knowledge service getShow service details and per-version configuration
Update servicebl knowledge service updateUpdate service name, description, or the draft's model/parameter configuration
Deploy servicebl knowledge service deployPublish the beta draft as a new published version
Copy servicebl knowledge service copyCopy a service into a new draft
Delete servicebl knowledge service deleteDelete a retrieval/Q&A service (soft delete)
bl knowledge service create --name my-qa --scene chat --index-id <index-id> --workspace-id <workspace-id>