knowledge-studio-cli 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6)](https://www.typescriptlang.org)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
11
11
 
12
- [Knowledge Studio Console](https://rag.console.aliyun.com/) · [中文文档](README.zh.md) · [API Documentation](https://help.aliyun.com/zh/model-studio/) · [Full CLI Guide](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md)
12
+ [Knowledge Studio Console](https://rag.console.aliyun.com/) · [中文文档](README.zh.md) · [API Documentation](https://help.aliyun.com/zh/model-studio/) · [Full CLI Guide](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md)
13
13
 
14
14
  </div>
15
15
 
@@ -38,39 +38,41 @@ npm install -g knowledge-studio-cli
38
38
 
39
39
  ## Quick Start
40
40
 
41
+ Configure a valid DashScope API key (for example through `DASHSCOPE_API_KEY`) and choose a workspace with knowledge-base permissions. Replace the placeholder IDs below with your actual values.
42
+
43
+ Knowledge bases accrue running-time charges from creation, even without queries. The one-time **720-hour Standard Edition allowance is shared across knowledge bases and expires 30 days after service activation for new users**. Model calls are billed separately; the CLI does not assume your remaining allowance. See [billing rules](https://help.aliyun.com/zh/model-studio/billing-for-knowledge-base).
44
+
45
+ ```bash
46
+ # Preview first; this may authenticate and read existing resources, but writes nothing.
47
+ kscli init --workspace-id <workspace-id> --dry-run
48
+ ```
49
+
50
+ Review the plan and billing notice. Only after confirming this operation and its scope, run:
51
+
52
+ ```bash
53
+ kscli init --workspace-id <workspace-id> --yes
54
+ ```
55
+
56
+ Initialization uploads a sample, creates or reuses an owned knowledge base and beta retrieval service, and verifies sample retrieval. It does not create a chat service or deploy a service. Keep the returned IDs and `.bailian/knowledge/init.json` recovery record. Use the returned **agent ID**, not the knowledge-base index ID:
57
+
41
58
  ```bash
42
- # 1. Create a knowledge base
43
- kscli kb create \
44
- --name "my-kb" \
45
- --description "my product docs knowledge base" \
46
- --embedding-model text-embedding-v3 \
47
- --workspace-id <your-workspace-id>
48
-
49
- # 2. Upload a document
50
- kscli doc upload \
51
- --kb-id <kb-id> \
52
- --file ./product-docs.pdf \
53
- --workspace-id <your-workspace-id>
54
-
55
- # 3. Check processing status
56
- kscli doc status \
57
- --kb-id <kb-id> \
58
- --doc-id <doc-id> \
59
- --workspace-id <your-workspace-id>
60
-
61
- # 4. Semantic search
62
- kscli search \
63
- --query "What is Model Studio?" \
64
- --agent-id <your-agent-id> \
65
- --workspace-id <your-workspace-id>
66
-
67
- # 5. Knowledge-base Q&A (streaming)
68
- kscli chat \
69
- --message "What is RAG?" \
70
- --agent-id <your-agent-id> \
71
- --workspace-id <your-workspace-id>
59
+ kscli search --agent-id <agent-id> --agent-version beta --query "RAG" --workspace-id <workspace-id>
72
60
  ```
73
61
 
62
+ Closing the terminal or a failed later step does not stop billing. Inspect the resources and cleanup actions reported by init, including partial failures. Delete only the resources you no longer need; reused resources are not temporary resources. After reviewing the specific knowledge base and deletion consequences:
63
+
64
+ ```bash
65
+ kscli kb delete --index-id <index-id> --workspace-id <workspace-id>
66
+ ```
67
+
68
+ Deletion requires confirmation; add `--yes` only after confirming that scope. Successful knowledge-base deletion stops its running-time charges. Deleting documents or a retrieval service alone does not. Source files and other resources may require separate cleanup.
69
+
70
+ ### Use with an AI assistant
71
+
72
+ Install the knowledge workflow through `bl skill init`, or select `bl skill add --name bailian-protocol,bailian-knowledge`. Use `bl skill update` to update installed skills. This uses the full Bailian CLI installer; `kscli` has no `skill` subcommand.
73
+
74
+ The assistant first reads `kscli --introspect` to check the installed capabilities. It previews changes and explains billing before creating resources. Capabilities absent from that schema are not available in the installed version.
75
+
74
76
  ## Commands
75
77
 
76
78
  ### Knowledge Base Management
@@ -149,7 +151,7 @@ kscli chat \
149
151
  | `config set` | Set a configuration value |
150
152
  | `update` | Self-update to the latest version |
151
153
 
152
- > For full parameter details, output formats, and usage examples, see the [CLI Guide](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md).
154
+ > For full parameter details, output formats, and usage examples, see the [CLI Guide](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md).
153
155
 
154
156
  ## Authentication
155
157
 
@@ -197,12 +199,12 @@ All commands support these common flags:
197
199
 
198
200
  ## Links
199
201
 
200
- | Resource | URL |
201
- | :----------------------- | :-------------------------------------------------------------------------------------------------------- |
202
- | Knowledge Studio Console | https://rag.console.aliyun.com/ |
203
- | DashScope API Docs | https://help.aliyun.com/zh/model-studio/ |
204
- | Get API Key | https://bailian.console.aliyun.com/?spm=a2ty07.github&tab=app#/api-key |
205
- | Full CLI Guide | [docs/knowledge-cli-guide.md](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md) |
202
+ | Resource | URL |
203
+ | :----------------------- | :------------------------------------------------------------------------------------------------------------------ |
204
+ | Knowledge Studio Console | https://rag.console.aliyun.com/ |
205
+ | DashScope API Docs | https://help.aliyun.com/zh/model-studio/ |
206
+ | Get API Key | https://bailian.console.aliyun.com/?spm=a2ty07.github&tab=app#/api-key |
207
+ | Full CLI Guide | [docs/knowledge-cli-guide.md](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md) |
206
208
 
207
209
  ## Contributing
208
210
 
@@ -211,3 +213,7 @@ Bug reports, feature requests, and PRs are welcome. See [CONTRIBUTING.md](https:
211
213
  ## License
212
214
 
213
215
  [Apache 2.0](LICENSE)
216
+
217
+ ### RAG audio and video
218
+
219
+ `kscli doc import --index-id <id> --doc-id <fileId>` imports an existing file into a knowledge base; `doc list --details` shows per-file processing settings. Media support includes parser options, streaming uploads, and media references in search/chunk output. Chat JSON separates the final answer from phases, tools, docs, usage, and raw events; quiet mode emits only the final answer. See the [command guide](../../docs/knowledge/knowledge-cli-guide.md).
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6)](https://www.typescriptlang.org)
10
10
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
11
11
 
12
- [Knowledge Studio 控制台](https://rag.console.aliyun.com/) · [English](README.md) · [API 文档](https://help.aliyun.com/zh/model-studio/) · [完整 CLI 指南](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md)
12
+ [Knowledge Studio 控制台](https://rag.console.aliyun.com/) · [English](README.md) · [API 文档](https://help.aliyun.com/zh/model-studio/) · [完整 CLI 指南](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md)
13
13
 
14
14
  </div>
15
15
 
@@ -24,7 +24,7 @@
24
24
  - **检索服务** — 创建、配置、部署、复制和管理检索服务,将知识库绑定到指定模型
25
25
  - **Chunk 管理** — 在文档内新增、列出、更新、删除文本分片,实现细粒度内容控制
26
26
  - **数据中心** — 管理工作区数据中心的独立文件,在挂载到知识库前进行预处理
27
- - **集合与分类** — 通过集合组织知识库,通过分类对文档进行标记,实现范围检索
27
+ - **数据集与分类** — 通过数据集组织知识库,通过分类对文档进行标记,实现范围检索
28
28
  - **RAG 检索与对话** — 跨知识库语义检索,流式问答返回基于知识的回答
29
29
  - **Agent 友好** — 支持 JSON 结构化输出(`--output json`)、预览模式(`--dry-run`)和静默模式(`--quiet`),便于脚本集成
30
30
 
@@ -38,39 +38,41 @@ npm install -g knowledge-studio-cli
38
38
 
39
39
  ## 快速开始
40
40
 
41
+ 先配置有效的 DashScope API Key(例如通过 `DASHSCOPE_API_KEY`),并准备有知识库权限的工作空间。下方占位 ID 请替换为实际值。
42
+
43
+ 知识库创建成功后,即使不检索也持续按时计费。**标准版一次性 720 小时额度由多个知识库共享,新用户开通服务后 30 天内有效**;模型调用另计,CLI 不假定当前账户还剩多少额度。详见[计费规则](https://help.aliyun.com/zh/model-studio/billing-for-knowledge-base)。
44
+
45
+ ```bash
46
+ # 先预览:可能鉴权并读取已有资源,但不会写入。
47
+ kscli init --workspace-id <workspace-id> --dry-run
48
+ ```
49
+
50
+ 查看计划和计费说明,确认本次操作及范围后再执行:
51
+
52
+ ```bash
53
+ kscli init --workspace-id <workspace-id> --yes
54
+ ```
55
+
56
+ 初始化会上传样例、创建或复用可确认归属的知识库与 beta 检索服务,并验证样例检索。不会自动创建问答服务或发布服务。保留返回的 ID 和 `.bailian/knowledge/init.json` 恢复记录。继续检索时使用返回的 **agent ID**,不要填知识库 index ID:
57
+
41
58
  ```bash
42
- # 1. 创建知识库
43
- kscli kb create \
44
- --name "my-kb" \
45
- --description "我的产品文档知识库" \
46
- --embedding-model text-embedding-v3 \
47
- --workspace-id <your-workspace-id>
48
-
49
- # 2. 上传文档
50
- kscli doc upload \
51
- --kb-id <kb-id> \
52
- --file ./product-docs.pdf \
53
- --workspace-id <your-workspace-id>
54
-
55
- # 3. 查看处理状态
56
- kscli doc status \
57
- --kb-id <kb-id> \
58
- --doc-id <doc-id> \
59
- --workspace-id <your-workspace-id>
60
-
61
- # 4. 语义检索
62
- kscli search \
63
- --query "什么是 Model Studio?" \
64
- --agent-id <your-agent-id> \
65
- --workspace-id <your-workspace-id>
66
-
67
- # 5. 知识库问答(流式输出)
68
- kscli chat \
69
- --message "什么是RAG?" \
70
- --agent-id <your-agent-id> \
71
- --workspace-id <your-workspace-id>
59
+ kscli search --agent-id <agent-id> --agent-version beta --query "RAG" --workspace-id <workspace-id>
72
60
  ```
73
61
 
62
+ 关闭终端或后续步骤失败不会停止计费。请查看 init 输出的资源及清理动作,部分失败时也要核对已创建资源。仅清理不再需要的资源,复用资源不属于默认临时资源。查看具体知识库并确认删除后果后:
63
+
64
+ ```bash
65
+ kscli kb delete --index-id <index-id> --workspace-id <workspace-id>
66
+ ```
67
+
68
+ 删除需要确认;只有确认范围后才添加 `--yes`。成功删除知识库才能停止其规格计费,仅删除文档或检索服务不行。源文件等其他资源可能需要另行清理。
69
+
70
+ ### 通过 AI 助手使用
71
+
72
+ 通过 `bl skill init` 安装知识库工作流,或用 `bl skill add --name bailian-protocol,bailian-knowledge` 选择安装。更新已安装 Skill 使用 `bl skill update`。安装渠道属于完整百炼 CLI,`kscli` 没有 `skill` 子命令。
73
+
74
+ 助手先读取 `kscli --introspect` 确认当前能力,创建资源前预览变更并解释计费。当前 schema 未列出的能力不能视为已安装版本支持。
75
+
74
76
  ## 命令列表
75
77
 
76
78
  ### 知识库管理
@@ -124,15 +126,15 @@ kscli chat \
124
126
  | `file get` | 查看数据中心文件详情 |
125
127
  | `file delete` | 删除数据中心文件 |
126
128
 
127
- ### 集合与分类
129
+ ### 数据集与分类
128
130
 
129
- | 命令 | 说明 |
130
- | :------------------ | :----------------- |
131
- | `collection create` | 在知识库中创建集合 |
132
- | `collection get` | 查看集合详情 |
133
- | `category list` | 列出知识库中的分类 |
134
- | `category add` | 向知识库添加分类 |
135
- | `category delete` | 删除知识库中的分类 |
131
+ | 命令 | 说明 |
132
+ | :------------------ | :------------------- |
133
+ | `collection create` | 在知识库中创建数据集 |
134
+ | `collection get` | 查看数据集详情 |
135
+ | `category list` | 列出知识库中的分类 |
136
+ | `category add` | 向知识库添加分类 |
137
+ | `category delete` | 删除知识库中的分类 |
136
138
 
137
139
  ### 检索与对话
138
140
 
@@ -149,7 +151,7 @@ kscli chat \
149
151
  | `config set` | 设置配置项 |
150
152
  | `update` | 自更新到最新版本 |
151
153
 
152
- > 完整参数说明、输出格式与使用示例请参阅 [CLI 指南](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md)。
154
+ > 完整参数说明、输出格式与使用示例请参阅 [CLI 指南](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md)。
153
155
 
154
156
  ## 认证方式
155
157
 
@@ -202,12 +204,12 @@ kscli update
202
204
 
203
205
  ## 相关链接
204
206
 
205
- | 资源 | 地址 |
206
- | :---------------------- | :-------------------------------------------------------------------------------------------------------- |
207
- | Knowledge Studio 控制台 | https://rag.console.aliyun.com/ |
208
- | DashScope API 文档 | https://help.aliyun.com/zh/model-studio/ |
209
- | 获取 API Key | https://bailian.console.aliyun.com/?spm=a2ty07.github&tab=app#/api-key |
210
- | 完整 CLI 指南 | [docs/knowledge-cli-guide.md](https://github.com/modelstudioai/cli/blob/main/docs/knowledge-cli-guide.md) |
207
+ | 资源 | 地址 |
208
+ | :---------------------- | :------------------------------------------------------------------------------------------------------------------ |
209
+ | Knowledge Studio 控制台 | https://rag.console.aliyun.com/ |
210
+ | DashScope API 文档 | https://help.aliyun.com/zh/model-studio/ |
211
+ | 获取 API Key | https://bailian.console.aliyun.com/?spm=a2ty07.github&tab=app#/api-key |
212
+ | 完整 CLI 指南 | [docs/knowledge-cli-guide.md](https://github.com/modelstudioai/cli/blob/main/docs/knowledge/knowledge-cli-guide.md) |
211
213
 
212
214
  ## 参与贡献
213
215
 
@@ -216,3 +218,7 @@ kscli update
216
218
  ## 许可证
217
219
 
218
220
  [Apache 2.0](LICENSE)
221
+
222
+ ### RAG 音视频接入
223
+
224
+ `kscli doc import --index-id <id> --doc-id <fileId>` 将历史文件导入已有库;`doc list --details` 查看文件级处理参数。支持音视频 parser、流式上传,以及检索/切片中的媒体来源展示。问答 JSON 将最终 answer 与 phases/tools/docs/usage/events 分开保存,quiet 仅输出最终回答。参阅 [命令指南](../../docs/knowledge/knowledge-cli-guide.md)。
package/dist/kscli.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import{createCli as e}from"bailian-cli-runtime";import{configSet as t,configShow as n,knowledgeCategoryAdd as r,knowledgeCategoryDelete as i,knowledgeCategoryList as a,knowledgeChat as o,knowledgeChunkAdd as s,knowledgeChunkDelete as c,knowledgeChunkList as l,knowledgeChunkUpdate as u,knowledgeCollectionCreate as d,knowledgeCollectionGet as f,knowledgeDocDelete as p,knowledgeDocImportOss as m,knowledgeDocList as h,knowledgeDocStatus as g,knowledgeDocTag as _,knowledgeDocUpload as v,knowledgeFileDelete as y,knowledgeFileGet as b,knowledgeFileList as x,knowledgeKbCreate as S,knowledgeKbDelete as C,knowledgeKbInfo as w,knowledgeKbList as T,knowledgeKbStats as E,knowledgeKbUpdate as D,knowledgeSearch as O,knowledgeServiceCopy as k,knowledgeServiceCreate as A,knowledgeServiceDelete as j,knowledgeServiceDeploy as M,knowledgeServiceGet as N,knowledgeServiceList as P,knowledgeServiceUpdate as F,update as I}from"bailian-cli-commands";e({"config show":n,"config set":t,update:I,search:O,chat:o,"kb list":T,"kb info":w,"kb create":S,"kb update":D,"kb delete":C,"doc list":h,"doc status":g,"doc upload":v,"doc delete":p,"doc tag":_,"service list":P,"service get":N,"service create":A,"service update":F,"service deploy":M,"service delete":j,"service copy":k,"chunk add":s,"chunk list":l,"chunk update":u,"chunk delete":c,"kb stats":E,"category list":a,"category add":r,"category delete":i,"file list":x,"file get":b,"file delete":y,"collection create":d,"collection get":f,"doc import-oss":m},{binName:`kscli`,version:`2.5.0`,clientName:`knowledge-studio-cli`,npmPackage:`knowledge-studio-cli`}).run();export{};
3
+ import{createCli as e}from"bailian-cli-runtime";import{configSet as t,configShow as n,knowledgeCategoryAdd as r,knowledgeCategoryDelete as i,knowledgeCategoryList as a,knowledgeChat as o,knowledgeChunkAdd as s,knowledgeChunkDelete as c,knowledgeChunkList as l,knowledgeChunkUpdate as u,knowledgeCollectionCreate as d,knowledgeCollectionGet as f,knowledgeDocDelete as p,knowledgeDocImport as m,knowledgeDocImportOss as h,knowledgeDocList as g,knowledgeDocStatus as _,knowledgeDocSync as v,knowledgeDocTag as y,knowledgeDocUpload as b,knowledgeFileDelete as x,knowledgeFileGet as S,knowledgeFileList as C,knowledgeInit as w,knowledgeKbCreate as T,knowledgeKbDelete as E,knowledgeKbInfo as D,knowledgeKbList as O,knowledgeKbStats as k,knowledgeKbUpdate as A,knowledgeSearch as j,knowledgeServiceCopy as M,knowledgeServiceCreate as N,knowledgeServiceDelete as P,knowledgeServiceDeploy as F,knowledgeServiceGet as I,knowledgeServiceList as L,knowledgeServiceUpdate as R,update as z}from"bailian-cli-commands";e({"config show":n,"config set":t,update:z,search:j,chat:o,"kb list":O,"kb info":D,"kb create":T,init:w,"kb update":A,"kb delete":E,"doc list":g,"doc status":_,"doc upload":b,"doc sync":v,"doc delete":p,"doc tag":y,"service list":L,"service get":I,"service create":N,"service update":R,"service deploy":F,"service delete":P,"service copy":M,"chunk add":s,"chunk list":l,"chunk update":u,"chunk delete":c,"kb stats":k,"category list":a,"category add":r,"category delete":i,"file list":C,"file get":S,"file delete":x,"collection create":d,"collection get":f,"doc import-oss":h,"doc import":m},{binName:`kscli`,version:`2.6.0`,clientName:`knowledge-studio-cli`,npmPackage:`knowledge-studio-cli`}).run();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowledge-studio-cli",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Lightweight RAG CLI for Aliyun Model Studio — focused on knowledge-base retrieval.",
5
5
  "keywords": [
6
6
  "alibaba-cloud",
@@ -38,9 +38,9 @@
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
40
  "dependencies": {
41
- "bailian-cli-commands": "2.5.0",
42
- "bailian-cli-core": "2.5.0",
43
- "bailian-cli-runtime": "2.5.0"
41
+ "bailian-cli-commands": "2.6.0",
42
+ "bailian-cli-core": "2.6.0",
43
+ "bailian-cli-runtime": "2.6.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@clack/prompts": "^0.7.0",