Skip to content

Commit 1d99e03

Browse files
authored
Merge pull request #282 from modelstudioai/feat/batch-command
Feat/batch command
2 parents 40d7445 + d154822 commit 1d99e03

113 files changed

Lines changed: 9919 additions & 2433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ _Built for AI Agents. Every command works as a structured tool call._
2828
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools
2929
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, Gemini CLI, or Pi
3030
- **Training & deployment** — Validate and upload datasets, fine-tune models, deploy dedicated models as endpoints
31+
- **Batch inference** — Prepare CSV/JSONL, create and follow asynchronous Chat/Embedding tasks, download original results/errors with optional CSV, or send one synchronous Batch Chat request
3132
- **Account operations** — Login, UI-based configuration, model marketplace, usage and quota, rate-limit increases, team seat management
3233
- **Plan onboarding** — Connect subscription plans such as Token Plan to the CLI and common coding agents in one step
3334

@@ -138,6 +139,24 @@ Knowledge bases accrue running-time charges from creation, even without queries.
138139

139140
Keep the returned IDs and recovery record. Closing the CLI or a later failure does not stop billing; follow the reported cleanup actions to delete unused knowledge bases. See the [Knowledge Studio quick start](packages/kscli/README.md#quick-start) for retrieval and cleanup. The `bailian-knowledge` Skill is available through `bl skill init`.
140141

142+
## Batch Inference
143+
144+
```bash
145+
bl batch convert --help
146+
bl batch convert --file input.csv --output-file input.jsonl --model qwen-plus
147+
bl batch create --file input.jsonl --dry-run
148+
bl batch create --file input.jsonl
149+
bl batch get --batch-id <id> --follow
150+
bl batch download --batch-id <id> --csv
151+
bl text chat --batch --model qwen-plus --message "Hello" --timeout 3600
152+
```
153+
154+
`--help` includes CSV, JSONL and result data examples. `convert` is local and needs no key; inference/task commands use a model API key. File inference uses asynchronous tasks via `create → get → download`: `create` uploads/submits and returns a task ID without waiting for completion. Query with `get` and download results after completion. Conversion/download files are atomically published per file and never silently overwritten. Use `--force` to recover partial downloads. JSONL is the authoritative result, while CSV is a lossy display; import IDs as text to preserve leading zeros. Ctrl-C stops local polling, not the remote task.
155+
156+
`text chat --batch` sends one synchronous request and waits for its response; it does not create an asynchronous task ID. Use `--message` or `--messages-file`, which contains one request's conversation context, not independent file requests. The total request timeout defaults to 300 seconds (`--timeout`: 60–3600 seconds). Timeout/Ctrl-C/disconnection do not guarantee server cancellation.
157+
158+
Synchronous Batch Chat is non-streaming; explicit realtime/international/Token Plan endpoints are rejected. An explicit realtime profile requires `--base-url https://batch.dashscope.aliyuncs.com`. Batch availability and limits depend on the service/model. Dry-run avoids business requests and output/directory writes; framework update checks/telemetry follow their settings.
159+
141160
## Authentication
142161

143162
### Console Login (OAuth, Recommended)

‎README.zh.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
2727
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具
2828
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code、Gemini CLI 或 Pi
2929
- **模型训推** — 数据集校验上传、模型精调、专属模型部署上线
30+
- **批量推理** — CSV/JSONL 构造、异步 Chat/Embedding 任务创建与跟踪、原始结果/错误下载及可选 CSV,或同步单请求 Batch Chat
3031
- **账号运维** — 授权登录、界面化配置、模型市场、用量与额度、限流提额、团队席位管理
3132
- **套餐接入** — 支持 Token Plan 等订阅计划一键接到 CLI 和常见 Coding Agent
3233

@@ -137,6 +138,24 @@ bl knowledge init --workspace-id <workspace-id> --dry-run
137138

138139
保留返回的 ID 和恢复记录。退出 CLI 或后续步骤失败不会停止计费;按返回的清理动作删除不再需要的知识库。检索及清理示例见 [Knowledge Studio 快速开始](packages/kscli/README.zh.md#快速开始)。知识库 Skill `bailian-knowledge` 通过 `bl skill init` 安装。
139140

141+
## 批量推理
142+
143+
```bash
144+
bl batch convert --help
145+
bl batch convert --file input.csv --output-file input.jsonl --model qwen-plus
146+
bl batch create --file input.jsonl --dry-run
147+
bl batch create --file input.jsonl
148+
bl batch get --batch-id <id> --follow
149+
bl batch download --batch-id <id> --csv
150+
bl text chat --batch --model qwen-plus --message "你好" --timeout 3600
151+
```
152+
153+
`--help` 提供 CSV、JSONL 和结果数据样例。`convert` 为本地转换,无需凭证;推理/任务命令使用模型 API Key。文件推理统一使用异步任务 `create → get → download`:`create` 上传/提交后返回任务 ID,不等待任务完成;通过 `get` 查询,完成后用 `download` 下载结果。转换/下载产物逐文件原子发布,不静默覆盖,部分下载失败可用 `--force` 重跑恢复。JSONL 是保真结果,CSV 为有损展示;导入 ID 请选择文本类型以保留前导零。Ctrl-C 仅停止本地轮询,不取消远端任务。
154+
155+
`text chat --batch` 发送单次同步请求并等待响应,不创建异步任务 ID。使用 `--message` 或 `--messages-file`;后者表示同一请求的对话上下文,不表示文件中的独立请求。请求总超时默认为 300 秒(`--timeout`:60–3600 秒)。超时、Ctrl-C、断线不保证服务端已取消执行。
156+
157+
同步 Batch Chat 强制非流式;拒绝显式实时/国际站/Token Plan 端点。显式实时 Profile 需指定 `--base-url https://batch.dashscope.aliyuncs.com`。Batch 可用范围和限制取决于服务与模型。dry-run 不调用业务 API、不写产物或目录,框架更新检查/遥测遵循其配置。
158+
140159
## 认证方式
141160

142161
### 控制台登录(OAuth,推荐)

‎packages/bailian-kb-dsh/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-kb-dsh",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Bailian knowledge-base tools for DeepSeek Harness: kb_search and kb_chat over the DashScope RAG API, plus the bl CLI management skill.",
55
"keywords": [
66
"alibaba-cloud",

‎packages/bailian-memo-dsh/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-memo-dsh",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Bailian personal memory for DeepSeek Harness: automatic recall, silent curation, and user-controlled remember/forget.",
55
"keywords": [
66
"alibaba-cloud",

‎packages/cli/README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ _Built for AI Agents. Every command works as a structured tool call._
2828
- **App orchestration** — Call Managed Agents, agents, and workflows published on Aliyun Model Studio, wired to knowledge bases, memory, web search, and MCP tools
2929
- **Native MCP setup** — Register Bailian MCP servers in Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork (千问办公), Qwen Code, Gemini CLI, or Pi
3030
- **Training & deployment** — Validate and upload datasets, fine-tune models, deploy dedicated models as endpoints
31+
- **Batch inference** — Prepare CSV/JSONL, create and follow asynchronous Chat/Embedding tasks, download original results/errors with optional CSV, or send one synchronous Batch Chat request
3132
- **Account operations** — Login, UI-based configuration, model marketplace, usage and quota, rate-limit increases, team seat management
3233
- **Plan onboarding** — Connect subscription plans such as Token Plan to the CLI and common coding agents in one step
3334

@@ -138,6 +139,24 @@ Knowledge bases accrue running-time charges from creation, even without queries.
138139

139140
Keep the returned IDs and recovery record. Closing the CLI or a later failure does not stop billing; follow the reported cleanup actions to delete unused knowledge bases. See the [Knowledge Studio quick start](packages/kscli/README.md#quick-start) for retrieval and cleanup. The `bailian-knowledge` Skill is available through `bl skill init`.
140141

142+
## Batch Inference
143+
144+
```bash
145+
bl batch convert --help
146+
bl batch convert --file input.csv --output-file input.jsonl --model qwen-plus
147+
bl batch create --file input.jsonl --dry-run
148+
bl batch create --file input.jsonl
149+
bl batch get --batch-id <id> --follow
150+
bl batch download --batch-id <id> --csv
151+
bl text chat --batch --model qwen-plus --message "Hello" --timeout 3600
152+
```
153+
154+
`--help` includes CSV, JSONL and result data examples. `convert` is local and needs no key; inference/task commands use a model API key. File inference uses asynchronous tasks via `create → get → download`: `create` uploads/submits and returns a task ID without waiting for completion. Query with `get` and download results after completion. Conversion/download files are atomically published per file and never silently overwritten. Use `--force` to recover partial downloads. JSONL is the authoritative result, while CSV is a lossy display; import IDs as text to preserve leading zeros. Ctrl-C stops local polling, not the remote task.
155+
156+
`text chat --batch` sends one synchronous request and waits for its response; it does not create an asynchronous task ID. Use `--message` or `--messages-file`, which contains one request's conversation context, not independent file requests. The total request timeout defaults to 300 seconds (`--timeout`: 60–3600 seconds). Timeout/Ctrl-C/disconnection do not guarantee server cancellation.
157+
158+
Synchronous Batch Chat is non-streaming; explicit realtime/international/Token Plan endpoints are rejected. An explicit realtime profile requires `--base-url https://batch.dashscope.aliyuncs.com`. Batch availability and limits depend on the service/model. Dry-run avoids business requests and output/directory writes; framework update checks/telemetry follow their settings.
159+
141160
## Authentication
142161

143162
### Console Login (OAuth, Recommended)

‎packages/cli/README.zh.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ _专为 AI Agent 打造,每个命令均可作为结构化工具调用。_
2727
- **应用编排** — 调用百炼已发布的 Managed Agent、智能体和工作流,接入知识库、记忆库、联网搜索与 MCP 工具
2828
- **原生 MCP 接入** — 将百炼 MCP 服务注册到 Codex、Claude Code、Cursor、Qoder、Qoder Work、千问办公(QwenWork)、Qwen Code、Gemini CLI 或 Pi
2929
- **模型训推** — 数据集校验上传、模型精调、专属模型部署上线
30+
- **批量推理** — CSV/JSONL 构造、异步 Chat/Embedding 任务创建与跟踪、原始结果/错误下载及可选 CSV,或同步单请求 Batch Chat
3031
- **账号运维** — 授权登录、界面化配置、模型市场、用量与额度、限流提额、团队席位管理
3132
- **套餐接入** — 支持 Token Plan 等订阅计划一键接到 CLI 和常见 Coding Agent
3233

@@ -137,6 +138,24 @@ bl knowledge init --workspace-id <workspace-id> --dry-run
137138

138139
保留返回的 ID 和恢复记录。退出 CLI 或后续步骤失败不会停止计费;按返回的清理动作删除不再需要的知识库。检索及清理示例见 [Knowledge Studio 快速开始](packages/kscli/README.zh.md#快速开始)。知识库 Skill `bailian-knowledge` 通过 `bl skill init` 安装。
139140

141+
## 批量推理
142+
143+
```bash
144+
bl batch convert --help
145+
bl batch convert --file input.csv --output-file input.jsonl --model qwen-plus
146+
bl batch create --file input.jsonl --dry-run
147+
bl batch create --file input.jsonl
148+
bl batch get --batch-id <id> --follow
149+
bl batch download --batch-id <id> --csv
150+
bl text chat --batch --model qwen-plus --message "你好" --timeout 3600
151+
```
152+
153+
`--help` 提供 CSV、JSONL 和结果数据样例。`convert` 为本地转换,无需凭证;推理/任务命令使用模型 API Key。文件推理统一使用异步任务 `create → get → download`:`create` 上传/提交后返回任务 ID,不等待任务完成;通过 `get` 查询,完成后用 `download` 下载结果。转换/下载产物逐文件原子发布,不静默覆盖,部分下载失败可用 `--force` 重跑恢复。JSONL 是保真结果,CSV 为有损展示;导入 ID 请选择文本类型以保留前导零。Ctrl-C 仅停止本地轮询,不取消远端任务。
154+
155+
`text chat --batch` 发送单次同步请求并等待响应,不创建异步任务 ID。使用 `--message` 或 `--messages-file`;后者表示同一请求的对话上下文,不表示文件中的独立请求。请求总超时默认为 300 秒(`--timeout`:60–3600 秒)。超时、Ctrl-C、断线不保证服务端已取消执行。
156+
157+
同步 Batch Chat 强制非流式;拒绝显式实时/国际站/Token Plan 端点。显式实时 Profile 需指定 `--base-url https://batch.dashscope.aliyuncs.com`。Batch 可用范围和限制取决于服务与模型。dry-run 不调用业务 API、不写产物或目录,框架更新检查/遥测遵循其配置。
158+
140159
## 认证方式
141160

142161
### 控制台登录(OAuth,推荐)

‎packages/cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
55
"keywords": [
66
"agent",

‎packages/cli/src/commands.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import {
55
authLogout,
66
authGenerateAccessToken,
77
textChat,
8+
batchConvert,
9+
batchCreate,
10+
batchList,
11+
batchGet,
12+
batchCancel,
13+
batchDownload,
814
textOmni,
915
imageGenerate,
1016
imageEdit,
@@ -327,6 +333,12 @@ export const commands: Record<string, AnyCommand> = {
327333
"auth logout": authLogout,
328334
"auth generate-access-token": authGenerateAccessToken,
329335
"text chat": textChat,
336+
"batch convert": batchConvert,
337+
"batch create": batchCreate,
338+
"batch list": batchList,
339+
"batch get": batchGet,
340+
"batch cancel": batchCancel,
341+
"batch download": batchDownload,
330342
omni: textOmni,
331343
"image generate": imageGenerate,
332344
"image edit": imageEdit,

‎packages/cli/tests/e2e/registry.smoke.e2e.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { join } from "path";
44
import { afterAll, describe, expect, test } from "vite-plus/test";
55
import { captureRegistryHelp, deriveGroupPaths } from "e2e/registry-smoke";
66
import { CommandRegistry, resolve } from "bailian-cli-runtime";
7-
import { commands } from "../../src/commands.ts";
7+
import { commands, commandAliases } from "../../src/commands.ts";
88
import { runCli } from "./helpers.ts";
99

1010
const commandPaths = Object.keys(commands).sort();
@@ -19,6 +19,16 @@ function runCliSmoke(args: string[]) {
1919
}
2020

2121
describe("e2e: bl registry smoke", () => {
22+
test("Batch 仅注册 convert,prepare 不保留别名或可执行路径", async () => {
23+
expect(resolve(["batch", "convert", "--help"], registry)).toMatchObject({
24+
kind: "help",
25+
path: ["batch", "convert"],
26+
});
27+
expect(commands).not.toHaveProperty("batch prepare");
28+
expect(commandAliases).not.toHaveProperty("batch prepare");
29+
const removed = await runCliSmoke(["batch", "prepare", "--help"]);
30+
expect(removed.exitCode).toBe(2);
31+
});
2232
test("knowledge init is registered with read-only preparation and billing risk", () => {
2333
expect(commands["knowledge init"]).toMatchObject({
2434
auth: "apiKey",

‎packages/commands/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli-commands",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
55
"homepage": "https://bailian.console.aliyun.com/cli",
66
"bugs": {

0 commit comments

Comments
 (0)