Files
zeyu.fz 892ae300ae feat(knowledge): 新增基于 workspace 的知识库语义检索与问答功能
- 新增 `bl knowledge search` 命令,支持语义检索及多模态检索参数
- 新增 `bl knowledge chat` 命令,支持知识库 SSE 流式问答及多轮历史对话
- 在 `bailian-cli-core` 中添加相应的知识 API 类型和端点支持
- `kscli` 新增 `search` 和 `chat` 两个命令,`retrieve` 标记为废弃
- 更新 `kscli` README,调整主推命令并标记 `retrieve` 废弃
- 补充完善 E2E 测试覆盖检索与问答功能的多种用例
- 修正若干缺少必要参数时的 CLI 行为,确保打印帮助并正常退出
- 升级各相关包版本至 1.6.0,更新 CHANGELOG 及相关文档说明
2026-07-02 15:19:38 +08:00
..

Knowledge Studio CLI

Lightweight RAG CLI for Aliyun Model Studio — focused on knowledge-base retrieval.

npm version Node.js TypeScript License

Knowledge Studio Console · 中文文档 · API Documentation

What is this?

kscli is a standalone CLI for knowledge-base retrieval on Aliyun Model Studio (DashScope), purpose-built for RAG (Retrieval-Augmented Generation) workflows.

Installation

npm install -g knowledge-studio-cli

Requires Node.js >= 22.12.

Quick Start

# Search a knowledge base
kscli search \
  --query "What is Model Studio?" \
  --agent-id <your-agent-id> \
  --workspace-id <your-workspace-id>

# Chat with a knowledge base
kscli chat \
  --message "What is RAG?" \
  --agent-id <your-agent-id> \
  --workspace-id <your-workspace-id>

Commands

Command Description
search Semantic search across knowledge bases (RAG)
chat Knowledge-base Q&A with streaming (RAG)
retrieve Query a knowledge base (deprecated, use search)
config show Display current configuration
config set Set a configuration value
update Self-update to the latest version

Authentication

A DashScope API Key is recommended. Get yours from the DashScope Console.

# Option 1: Environment variable
export DASHSCOPE_API_KEY=sk-xxxxx

# Option 2: Persist to config (~/.bailian/config.json)
kscli config set --key api_key --value sk-xxxxx

# Option 3: Per-command flag
kscli search --api-key sk-xxxxx --query "..." --agent-id <id> --workspace-id <id>

Configuration

# View current config
kscli config show

# Set defaults
kscli config set --key base_url --value https://dashscope-us.aliyuncs.com
kscli config set --key timeout --value 600

# Self-update
kscli update

Config file location: ~/.bailian/config.json

Resource URL
Knowledge Studio Console https://rag.console.aliyun.com/
DashScope API Docs https://help.aliyun.com/zh/model-studio/
Get API Key https://bailian.console.aliyun.com/?tab=app#/api-key

Contributing

Bug reports, feature requests, and PRs are welcome. See CONTRIBUTING.md for developer setup and contribution workflow.

License

Apache 2.0