@volcengine/ark-cli-darwin-arm64 0.0.0-stage → 1.0.46-prerelease.dc921200a42d
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/LICENSE +201 -0
- package/bin/arkcli-darwin-arm64 +4 -0
- package/manifest.json +37 -0
- package/package.json +20 -4
- package/skills/arkcli-agent/SKILL.md +197 -0
- package/skills/arkcli-agent/references/activation.md +23 -0
- package/skills/arkcli-agent/references/agent.md +442 -0
- package/skills/arkcli-agent/references/byok.md +74 -0
- package/skills/arkcli-agent/references/context-management.md +61 -0
- package/skills/arkcli-agent/references/debug-export.md +27 -0
- package/skills/arkcli-agent/references/dream.md +91 -0
- package/skills/arkcli-agent/references/evals.md +215 -0
- package/skills/arkcli-agent/references/events-chat.md +192 -0
- package/skills/arkcli-agent/references/interfaces-gaps.md +55 -0
- package/skills/arkcli-agent/references/mcp-vault.md +111 -0
- package/skills/arkcli-agent/references/model-config.md +46 -0
- package/skills/arkcli-agent/references/self-hosted.md +47 -0
- package/skills/arkcli-agent/references/session-files.md +157 -0
- package/skills/arkcli-agent/references/session-upgrade.md +64 -0
- package/skills/arkcli-agent/references/skills.md +94 -0
- package/skills/arkcli-agent/references/todo-write.md +37 -0
- package/skills/arkcli-agent/references/vision-agent.md +92 -0
- package/skills/arkcli-api-explorer/SKILL.md +114 -0
- package/skills/arkcli-api-explorer/references/arkcli-api.md +185 -0
- package/skills/arkcli-api-explorer/references/evals.md +92 -0
- package/skills/arkcli-auth/SKILL.md +127 -0
- package/skills/arkcli-auth/references/api-key-query.md +74 -0
- package/skills/arkcli-auth/references/arkcli-auth-init-volc.md +58 -0
- package/skills/arkcli-auth/references/arkcli-auth-login.md +125 -0
- package/skills/arkcli-auth/references/arkcli-auth-status.md +41 -0
- package/skills/arkcli-auth/references/arkcli-auth-whoami.md +128 -0
- package/skills/arkcli-auth/references/auth-modes.md +101 -0
- package/skills/arkcli-auth/references/identity-resolution.md +74 -0
- package/skills/arkcli-auth/references/realname-gate.md +23 -0
- package/skills/arkcli-auth/scripts/key-metadata.jq +34 -0
- package/skills/arkcli-billing/SKILL.md +105 -0
- package/skills/arkcli-billing/references/arkcli-billing-list.md +247 -0
- package/skills/arkcli-billing/references/evals.md +50 -0
- package/skills/arkcli-chat/SKILL.md +229 -0
- package/skills/arkcli-chat/references/arkcli-chat.md +300 -0
- package/skills/arkcli-chat/references/caching-thinking.md +138 -0
- package/skills/arkcli-chat/references/chat-meta.md +77 -0
- package/skills/arkcli-chat/references/evals.md +60 -0
- package/skills/arkcli-chat/references/stream-events.md +163 -0
- package/skills/arkcli-chat/references/text-format.md +160 -0
- package/skills/arkcli-chat/references/tools.md +130 -0
- package/skills/arkcli-code-example/SKILL.md +73 -0
- package/skills/arkcli-code-example/assets/demo-code/examples.json +14 -0
- package/skills/arkcli-code-example/assets/demo-code/go/main.go +53 -0
- package/skills/arkcli-code-example/assets/demo-code/python.py +26 -0
- package/skills/arkcli-code-example/references/arkcli-code-example.md +146 -0
- package/skills/arkcli-code-example/references/evals.md +12 -0
- package/skills/arkcli-config/SKILL.md +129 -0
- package/skills/arkcli-config/references/arkcli-config-init.md +49 -0
- package/skills/arkcli-config/references/arkcli-config-profile.md +54 -0
- package/skills/arkcli-config/references/evals.md +87 -0
- package/skills/arkcli-connect/SKILL.md +62 -0
- package/skills/arkcli-connect/references/arkcli-connect.md +129 -0
- package/skills/arkcli-connect/references/evals.md +117 -0
- package/skills/arkcli-custommodel/SKILL.md +177 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-available-quantizations.md +28 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-delete.md +36 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-get.md +45 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-list.md +72 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-quantize.md +58 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-update.md +47 -0
- package/skills/arkcli-custommodel/references/arkcli-custommodel-upload.md +60 -0
- package/skills/arkcli-custommodel/references/evals.md +58 -0
- package/skills/arkcli-datasets/SKILL.md +41 -0
- package/skills/arkcli-datasets/references/commands.md +91 -0
- package/skills/arkcli-datasets/references/evals.md +30 -0
- package/skills/arkcli-deploy/SKILL.md +128 -0
- package/skills/arkcli-deploy/references/arkcli-deploy.md +138 -0
- package/skills/arkcli-deploy/references/evals.md +117 -0
- package/skills/arkcli-docs/SKILL.md +232 -0
- package/skills/arkcli-docs/references/commands.md +225 -0
- package/skills/arkcli-docs/references/evals.md +200 -0
- package/skills/arkcli-docs/references/failure-modes.md +77 -0
- package/skills/arkcli-doctor/CONTRIBUTING.md +202 -0
- package/skills/arkcli-doctor/SKILL.md +302 -0
- package/skills/arkcli-doctor/references/error-codes.md +504 -0
- package/skills/arkcli-doctor/references/evals.md +70 -0
- package/skills/arkcli-doctor/references/scope-account.md +205 -0
- package/skills/arkcli-doctor/references/scope-cli.md +217 -0
- package/skills/arkcli-doctor/references/scope-infer-endpoint.md +214 -0
- package/skills/arkcli-doctor/references/scope-metrics.md +197 -0
- package/skills/arkcli-doctor/references/scope-model.md +241 -0
- package/skills/arkcli-doctor/references/scope-report.md +242 -0
- package/skills/arkcli-doctor/references/verify-origin.md +142 -0
- package/skills/arkcli-gen/SKILL.md +348 -0
- package/skills/arkcli-gen/references/arkcli-gen-audio.md +125 -0
- package/skills/arkcli-gen/references/arkcli-gen.md +297 -0
- package/skills/arkcli-gen/references/evals.md +93 -0
- package/skills/arkcli-gen/references/gen-meta.md +182 -0
- package/skills/arkcli-gen/references/image-stream.md +105 -0
- package/skills/arkcli-gen/references/intent-and-validation.md +177 -0
- package/skills/arkcli-helper/SKILL.md +233 -0
- package/skills/arkcli-helper/references/arkcli-helper.md +372 -0
- package/skills/arkcli-helper/references/evals.md +110 -0
- package/skills/arkcli-infer-endpoint/SKILL.md +141 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-create.md +142 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-delete.md +68 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-get.md +60 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-list.md +142 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-start.md +34 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-stop.md +34 -0
- package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-update.md +76 -0
- package/skills/arkcli-infer-endpoint/references/evals.md +24 -0
- package/skills/arkcli-models/SKILL.md +314 -0
- package/skills/arkcli-models/references/arkcli-models-activate.md +110 -0
- package/skills/arkcli-models/references/arkcli-models-get.md +100 -0
- package/skills/arkcli-models/references/arkcli-models-list.md +73 -0
- package/skills/arkcli-models/references/arkcli-models-performance.md +32 -0
- package/skills/arkcli-models/references/arkcli-models-scenario-table.md +83 -0
- package/skills/arkcli-models/references/arkcli-models-search.md +208 -0
- package/skills/arkcli-models/references/evals.md +88 -0
- package/skills/arkcli-onboard/SKILL.md +81 -0
- package/skills/arkcli-onboard/references/evals.md +107 -0
- package/skills/arkcli-plans/SKILL.md +208 -0
- package/skills/arkcli-plans/references/arkcli-plans-agreement-signing.md +74 -0
- package/skills/arkcli-plans/references/arkcli-plans-buy.md +209 -0
- package/skills/arkcli-plans/references/arkcli-plans-get.md +96 -0
- package/skills/arkcli-plans/references/arkcli-plans-harness-status.md +149 -0
- package/skills/arkcli-plans/references/arkcli-plans-model-apply.md +56 -0
- package/skills/arkcli-plans/references/arkcli-plans-model-list.md +119 -0
- package/skills/arkcli-plans/references/arkcli-plans-personal-rotate-apikey.md +83 -0
- package/skills/arkcli-plans/references/arkcli-plans-renew.md +134 -0
- package/skills/arkcli-plans/references/arkcli-plans-team-rotate-apikey.md +108 -0
- package/skills/arkcli-plans/references/arkcli-plans-team-seat-assign.md +142 -0
- package/skills/arkcli-plans/references/arkcli-plans-team-seat-list.md +115 -0
- package/skills/arkcli-plans/references/evals.md +224 -0
- package/skills/arkcli-pricing/SKILL.md +125 -0
- package/skills/arkcli-pricing/references/arkcli-pricing-models.md +260 -0
- package/skills/arkcli-pricing/references/arkcli-pricing-plans.md +147 -0
- package/skills/arkcli-profile/SKILL.md +188 -0
- package/skills/arkcli-profile/references/arkcli-profile-create.md +101 -0
- package/skills/arkcli-profile/references/arkcli-profile-keys.md +100 -0
- package/skills/arkcli-profile/references/arkcli-profile-set-default.md +81 -0
- package/skills/arkcli-profile/references/evals.md +5 -0
- package/skills/arkcli-resources/SKILL.md +122 -0
- package/skills/arkcli-resources/references/arkcli-resources-list.md +140 -0
- package/skills/arkcli-shared/SKILL.md +236 -0
- package/skills/arkcli-shared/references/execution-context.md +108 -0
- package/skills/arkcli-shared/references/global-flags.md +45 -0
- package/skills/arkcli-shared/references/profile-defaults.md +57 -0
- package/skills/arkcli-shared/references/troubleshooting.md +36 -0
- package/skills/arkcli-shared/references/update.md +72 -0
- package/skills/arkcli-train-finetune/SKILL.md +123 -0
- package/skills/arkcli-train-finetune/references/ark-finetune-sdk.md +133 -0
- package/skills/arkcli-train-finetune/references/create.md +262 -0
- package/skills/arkcli-train-finetune/references/download.md +44 -0
- package/skills/arkcli-train-finetune/references/evals.md +14 -0
- package/skills/arkcli-train-finetune/references/export-deploy.md +177 -0
- package/skills/arkcli-train-finetune/references/job-configuration.md +122 -0
- package/skills/arkcli-train-finetune/references/list.md +78 -0
- package/skills/arkcli-train-finetune/references/manage.md +128 -0
- package/skills/arkcli-train-finetune/references/rl-plugins.md +77 -0
- package/skills/arkcli-train-finetune/references/testing-debug-monitoring.md +137 -0
- package/skills/arkcli-understand/SKILL.md +131 -0
- package/skills/arkcli-understand/references/arkcli-understand-asr.md +53 -0
- package/skills/arkcli-understand/references/arkcli-understand.md +268 -0
- package/skills/arkcli-understand/references/evals.md +119 -0
- package/skills/arkcli-understand/references/sub-skills.md +141 -0
- package/skills/arkcli-usage/SKILL.md +166 -0
- package/skills/arkcli-usage/references/arkcli-usage-balance.md +217 -0
- package/skills/arkcli-usage/references/arkcli-usage-plan-details.md +136 -0
- package/skills/arkcli-usage/references/arkcli-usage-plan.md +166 -0
- package/skills/arkcli-usage/references/arkcli-usage-seats.md +194 -0
- package/skills/arkcli-usage/references/arkcli-usage-stats.md +195 -0
- package/skills/arkcli-usage/references/evals.md +30 -0
- package/README.md +0 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tools
|
|
3
|
+
description: arkcli +chat Tools 用法 reference, 含 web_search 简单语法糖、function 自定义工具的 JSON 文件协议、tool_choice / max_tool_calls 调节。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# +chat Tools
|
|
7
|
+
|
|
8
|
+
PR-1 内置 `function` 与 `web_search` 两种 tool; `mcp` / `knowledge_search` 留 PR-5b。
|
|
9
|
+
|
|
10
|
+
## 何时使用
|
|
11
|
+
|
|
12
|
+
- 用户问"今天有什么 AI 新闻" → `web_search`
|
|
13
|
+
- 用户提供函数 schema 让模型调 → `function`
|
|
14
|
+
- 用户问"帮我查个会议纪要" / "用我们的知识库回答" → 当前 PR 不支持, 需提示用户走 `arkcli api arkruntime.create_responses --params '...'` (raw API) 或等 PR-5b。
|
|
15
|
+
|
|
16
|
+
## 4 个新 flag
|
|
17
|
+
|
|
18
|
+
| flag | 类型 | 用途 |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `--tools <type>` | 可重复 string | 简单语法糖, 只支持单字段 `{"type":"<type>"}` 形态。当前实测能用的只有 `--tools web_search`。 |
|
|
21
|
+
| `--tools-file <path>` | string | 读取一个 JSON 文件, 内容是一个 tool object 数组, 完整 SDK 形态; function 必须走这条路。 |
|
|
22
|
+
| `--tool-choice <mode>` | string | 工具调用策略: `auto` / `required` / `none`。不传则使用服务端默认。 |
|
|
23
|
+
| `--max-tool-calls <int>` | int | 单次会话最大 tool 调用次数, 防止失控。**仅对 built-in tools 生效**(如 `web_search`);与 function tool(`--tools-file` 或 `--tools function:*`)组合时 arkcli 会在客户端就拦截,原因是服务端 `max_tool_calls only supported by build-in tools now`。 |
|
|
24
|
+
|
|
25
|
+
`--tools` 与 `--tools-file` 可同时存在, 会按"sugar 在前, 文件在后"合并。
|
|
26
|
+
|
|
27
|
+
## web_search (最简)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
arkcli +chat "帮我查今天与AI相关的几条重要新闻, 给出要点和来源" \
|
|
31
|
+
--model ep-xxx \
|
|
32
|
+
--tools web_search \
|
|
33
|
+
--tool-choice auto \
|
|
34
|
+
--max-tool-calls 3
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## function (需要 JSON 文件)
|
|
38
|
+
|
|
39
|
+
`tools.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
"type": "function",
|
|
45
|
+
"name": "query_weather",
|
|
46
|
+
"description": "查询某个城市的天气, 返回 JSON",
|
|
47
|
+
"parameters": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"city": {"type": "string", "description": "城市名, 如 Beijing"}
|
|
51
|
+
},
|
|
52
|
+
"required": ["city"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
调用:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
arkcli +chat "北京今天天气怎么样?" \
|
|
62
|
+
--model ep-xxx \
|
|
63
|
+
--tools-file tools.json \
|
|
64
|
+
--tool-choice required
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`function` object 的字段 (与 SDK `responses.ToolFunction` 对齐):
|
|
68
|
+
|
|
69
|
+
| 字段 | 必填 | 说明 |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `type` | ✅ | 必须是 `"function"` |
|
|
72
|
+
| `name` | ✅ | 函数名, 模型用它来识别 tool |
|
|
73
|
+
| `description` | 推荐 | 给模型看的函数说明; 写得越清楚, 模型越能正确触发 |
|
|
74
|
+
| `parameters` | 推荐 | JSON Schema 描述参数; 直接嵌套写, arkcli 会内部序列化成 SDK Bytes |
|
|
75
|
+
| `strict` | 可选 bool | 严格模式: 强制参数符合 schema |
|
|
76
|
+
|
|
77
|
+
## tool_choice 三种模式
|
|
78
|
+
|
|
79
|
+
| mode | 含义 |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `auto` | 服务端默认, 让模型自行决定要不要调 tool |
|
|
82
|
+
| `required` | 强制必须至少调一次 tool |
|
|
83
|
+
| `none` | 即使传了 tools 也禁止模型调用 |
|
|
84
|
+
|
|
85
|
+
复杂的 function-specific tool_choice (`{"type":"function","name":"query_weather"}`) 在后续 PR 实现, 当前请用 `required` 加唯一一个 tool 等效达成。
|
|
86
|
+
|
|
87
|
+
## 输出形态
|
|
88
|
+
|
|
89
|
+
### 非流式 (`+chat ...` 不带 `--stream`)
|
|
90
|
+
|
|
91
|
+
`ResponsesResult` 多了 `function_calls` 字段:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"id": "resp_...",
|
|
96
|
+
"model": "...",
|
|
97
|
+
"content": "...", // 模型最终文本; tool 触发时可能为空
|
|
98
|
+
"reasoning_content": "...",
|
|
99
|
+
"usage": { ... },
|
|
100
|
+
"function_calls": [
|
|
101
|
+
{
|
|
102
|
+
"type": "function_tool_call",
|
|
103
|
+
"id": "call_...",
|
|
104
|
+
"name": "query_weather",
|
|
105
|
+
"arguments": "{\"city\":\"Beijing\"}",
|
|
106
|
+
...
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`function_calls[]` 是原始 SDK 形态透传; 不同 tool type 字段不同 (`function_tool_call` / `function_web_search` / 等), 用 `jq '.function_calls[].type'` 区分。
|
|
113
|
+
|
|
114
|
+
### 流式 (`--stream`)
|
|
115
|
+
|
|
116
|
+
stdout 上会出现 `[Tool args] {"city":"Beijing"}` 这样的标签行, 在 `Response:` 之前 / 之后插入, 取决于事件顺序。`ChatStreamDelta.FunctionCallArgs` 的所有 chunk 拼起来就是完整 args JSON。
|
|
117
|
+
|
|
118
|
+
## 错误处理
|
|
119
|
+
|
|
120
|
+
| 现象 | 原因 |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `tool[N] type "X" not supported in this build` | 用了 PR-5b 才支持的 tool type (mcp/knowledge_search/image_process); 走 raw API 或等 PR-5b |
|
|
123
|
+
| `function tool requires 'name'` | function 缺 name 字段 |
|
|
124
|
+
| `unsupported tool_choice "X"` | tool_choice 不是 auto/required/none |
|
|
125
|
+
| 模型回复但没触发 tool | tool description 写得不够清楚, 或 tool_choice=none, 或问题与 tool 不相关 |
|
|
126
|
+
| 模型反复调用同一 tool | 加 `--max-tool-calls` 限制, 或在 tool description 里说明何时停止 |
|
|
127
|
+
|
|
128
|
+
## 与 chat get 联动
|
|
129
|
+
|
|
130
|
+
加了 `--store` 之后, 即使流式跑完, 后面也能用 `chat get <id>` 拿到完整 `function_calls` 列表; `chat list-input-items <id>` 还能看到完整的 tool 调用历史 (含 `function_tool_call_output` 这种结果项)。
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkcli-code-example
|
|
3
|
+
version: 1.2.0
|
|
4
|
+
description: "arkcli +code-example:为指定基础模型生成多语言(Python / Go / Java / Node / curl)调用示例代码并写入本地文件。数据源是火山方舟 OpenTOP OpenGetSampleCode。当用户需要拿某个基础模型的 SDK / curl 调用示例、保存为本地接入模板时使用。反触发:TTS/ASR/语音模型没有 arkcli 示例代码路径,不能靠补版本解决,只能转 models search 说明当前不支持。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["arkcli"]
|
|
8
|
+
cliHelp: "arkcli +code-example --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# arkcli +code-example
|
|
12
|
+
|
|
13
|
+
> **前置条件:** 先阅读 [`../arkcli-shared/SKILL.md`](../arkcli-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
|
14
|
+
|
|
15
|
+
为指定基础模型生成多语言 SDK 调用示例代码,同时写入本地文件。数据源是火山方舟 OpenTOP `OpenGetSampleCode`。
|
|
16
|
+
|
|
17
|
+
## 什么时候用
|
|
18
|
+
|
|
19
|
+
- 用户说"生成示例代码 / SDK 示例 / curl 命令 / 怎么调用这个模型",且已经知道模型名
|
|
20
|
+
- 想把某个基础模型的多语言调用模板保存到本地
|
|
21
|
+
- 教程或技术文档需要引用该基础模型的具体 SDK import、安装包、方法或请求格式:先取得对应版本示例并核对官方文档,不能从模型生成的草稿直接采信接口写法。
|
|
22
|
+
|
|
23
|
+
## 教程中的代码事实核对
|
|
24
|
+
|
|
25
|
+
以真实返回条目的 `install`、`language`、`io_type` 和 `code` 作为示例依据;明确目标模型/版本、语言及接口路径。更换 SDK 包或版本、图片/视频方法、响应字段、错误码时必须另核对该版本源码或官方文档正文;一个模型的文本示例不能证明所有媒体接口。服务端提供模板也不等于已在本轮执行成功,分别标明“官方示例/静态核对/实际运行”。检索片段或 AI 初稿不足时缩小教程到已查证内容,未验证片段标注或移除,不写成完整已验证接入指南。
|
|
26
|
+
|
|
27
|
+
示例命令可能将当前 Key 填入文件;遵守共享身份/授权协议,提交教程前将 Key、Token 和签名 URL 等真实凭证替换为占位符并检查附件。不得直接回显未脱敏的生成条目,不为拿示例切换账号或绕过 Access 门禁。
|
|
28
|
+
|
|
29
|
+
**反路由**(不要用本命令):
|
|
30
|
+
|
|
31
|
+
- 只是想试模型效果 → [`../arkcli-chat/SKILL.md`](../arkcli-chat/SKILL.md)(文本/多模态对话)或 [`../arkcli-gen/SKILL.md`](../arkcli-gen/SKILL.md)(出图/视频)
|
|
32
|
+
- 还不知道模型名 → 先 [`../arkcli-models/SKILL.md`](../arkcli-models/SKILL.md) `models search/get`
|
|
33
|
+
- 需要先创建接入点 → [`../arkcli-deploy/SKILL.md`](../arkcli-deploy/SKILL.md)
|
|
34
|
+
- 语音模型(TTS / ASR / 配音 / 朗读 / 播客 / 音色 / 实时语音交互,或 `doubao-seed-tts-*` / `doubao-seed-asr-*` / `seedasr-*`)→ 不使用 `+code-example`。`models search` 能搜到不代表 OpenGetSampleCode 有示例;不要把后端 `ModelVersion required` 理解成"补一个版本就能生成",应说明当前 arkcli 不支持语音模型示例代码。
|
|
35
|
+
|
|
36
|
+
## 快速开始
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# 拿某基础模型的全部语言示例(写入 ./ark-examples/<model>/)
|
|
40
|
+
arkcli +code-example --model doubao-seedream-5-0
|
|
41
|
+
|
|
42
|
+
# 指定版本 + 只看 Python + 结构化输出
|
|
43
|
+
arkcli +code-example --model doubao-seedream-5-0 --version 260128 --language python --format json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- `--model` 必填,可传基础模型名或合并 ID(`doubao-seedream-5-0-260128`)
|
|
47
|
+
- `--version` 可选;不传时 CLI 自动推导(合并 ID 拆版本 → 找 `ArkModels` 匹配 → GetFoundationModel 取 `PrimaryVersion` 兜底),全都拿不到才报错要求显式传 `--version`
|
|
48
|
+
- 内部机制:接口约束 `ModelVersion` 必填,缺失时 CLI 走上述回退链自动补齐;custom model 走 PrimaryVersion 兜底时 scenario 自动切 `finetune_inference`,foundation model 无论显式版本或 PrimaryVersion 兜底一律保持 `quick_access`
|
|
49
|
+
- `--language` 可选:`python` / `go` / `java` / `node` / `curl`(`shell` 是 `curl` 别名),默认全部
|
|
50
|
+
- `--output-dir` 可选,默认 `./ark-examples/<model>`
|
|
51
|
+
- `--format json` 输出结构化条目(含 `language` / `io_type` / `install` / `code`)
|
|
52
|
+
- 语音模型没有 arkcli 示例代码路径;命中 TTS / ASR / 语音交互时停在 `arkcli models search <keyword>` 的发现说明,不要继续调用本命令
|
|
53
|
+
|
|
54
|
+
> **0.1.17 变更**:旧版 `--endpoint-id` 已移除——新数据源按基础模型取码,不再支持按已有接入点 ID 取码。如需指向某 endpoint,生成后把代码里的 `model="..."` 手动改成你的 `ep-xxx`。
|
|
55
|
+
|
|
56
|
+
## 命令一览
|
|
57
|
+
|
|
58
|
+
| 命令 | 说明 |
|
|
59
|
+
|------|------|
|
|
60
|
+
| `arkcli +code-example --model <name> [--version <ver>] [--language <lang>] [--output-dir <dir>] [--format json]` | 生成多语言示例代码并写入本地 |
|
|
61
|
+
|
|
62
|
+
## 输出形态
|
|
63
|
+
|
|
64
|
+
- **本地文件**:按"IO 任务类型"分子目录(对齐后端 `IOType` 维度),同类型下按语言分文件;带安装步骤的语言把安装命令写进文件头注释。
|
|
65
|
+
- **结构化 JSON**:`--format json` 时给出按 `(语言 × IO 类型)` 展开的条目。
|
|
66
|
+
- **人类可读**:默认按后端顺序打印各代码块。
|
|
67
|
+
|
|
68
|
+
详细参数、目录结构示例、常见链路与 FAQ 见 [`references/arkcli-code-example.md`](references/arkcli-code-example.md)。
|
|
69
|
+
|
|
70
|
+
## 参考
|
|
71
|
+
|
|
72
|
+
- [references/arkcli-code-example.md](references/arkcli-code-example.md) — 完整命令手册
|
|
73
|
+
- [arkcli-models](../arkcli-models/SKILL.md) / [arkcli-deploy](../arkcli-deploy/SKILL.md) / [arkcli-infer-endpoint](../arkcli-infer-endpoint/SKILL.md) / [arkcli-shared](../arkcli-shared/SKILL.md)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Install: go get github.com/volcengine/volcengine-go-sdk@latest
|
|
2
|
+
//
|
|
3
|
+
// 模板说明:
|
|
4
|
+
// - model 使用带版本号的合并 ID (模型名-PrimaryVersion);
|
|
5
|
+
// 用 `arkcli models get <name> --format json` 查 PrimaryVersion 后拼合
|
|
6
|
+
// - $ARK_API_KEY 运行前由环境变量提供, 不要把真实 Key 写进文件
|
|
7
|
+
package main
|
|
8
|
+
|
|
9
|
+
import (
|
|
10
|
+
"context"
|
|
11
|
+
"fmt"
|
|
12
|
+
"os"
|
|
13
|
+
|
|
14
|
+
"github.com/volcengine/volcengine-go-sdk/service/arkruntime"
|
|
15
|
+
"github.com/volcengine/volcengine-go-sdk/service/arkruntime/model/responses"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
func main() {
|
|
19
|
+
client := arkruntime.NewClientWithApiKey(
|
|
20
|
+
// 通过 os.Getenv 从环境变量中获取 ARK_API_KEY
|
|
21
|
+
os.Getenv("ARK_API_KEY"),
|
|
22
|
+
arkruntime.WithBaseUrl("https://ark.cn-beijing.volces.com/api/v3"),
|
|
23
|
+
)
|
|
24
|
+
ctx := context.Background()
|
|
25
|
+
|
|
26
|
+
resp, err := client.CreateResponses(ctx, &responses.ResponsesRequest{
|
|
27
|
+
Model: "doubao-seed-2-0-pro-260215",
|
|
28
|
+
Input: &responses.ResponsesInput{
|
|
29
|
+
Union: &responses.ResponsesInput_ListValue{
|
|
30
|
+
ListValue: &responses.InputItemList{ListValue: []*responses.InputItem{{
|
|
31
|
+
Union: &responses.InputItem_InputMessage{
|
|
32
|
+
InputMessage: &responses.ItemInputMessage{
|
|
33
|
+
Role: responses.MessageRole_user,
|
|
34
|
+
Content: []*responses.ContentItem{{
|
|
35
|
+
Union: &responses.ContentItem_Text{
|
|
36
|
+
Text: &responses.ContentItemText{
|
|
37
|
+
Type: responses.ContentItemType_input_text,
|
|
38
|
+
Text: "Hello!",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}}},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
if err != nil {
|
|
49
|
+
fmt.Printf("response error: %v\n", err)
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
fmt.Println(resp)
|
|
53
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Install: pip install openai
|
|
2
|
+
#
|
|
3
|
+
# 模板说明:
|
|
4
|
+
# - model 使用带版本号的合并 ID (模型名-PrimaryVersion);
|
|
5
|
+
# 用 `arkcli models get <name> --format json` 查 PrimaryVersion 后拼合
|
|
6
|
+
# - $ARK_API_KEY 运行前由环境变量提供, 不要把真实 Key 写进文件
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
from openai import OpenAI
|
|
10
|
+
|
|
11
|
+
client = OpenAI(
|
|
12
|
+
api_key=os.getenv("ARK_API_KEY", "$ARK_API_KEY"),
|
|
13
|
+
base_url="https://ark.cn-beijing.volces.com/api/v3",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# 非流式对话
|
|
17
|
+
chat_completion = client.chat.completions.create(
|
|
18
|
+
model="doubao-seed-2-0-pro-260215",
|
|
19
|
+
messages=[
|
|
20
|
+
{"role": "system", "content": "你是人工智能助手"},
|
|
21
|
+
{"role": "user", "content": "Hello!"},
|
|
22
|
+
],
|
|
23
|
+
stream=False,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
print(chat_completion.choices[0].message.content)
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# +code-example
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../arkcli-shared/SKILL.md`](../../arkcli-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
|
4
|
+
|
|
5
|
+
为指定基础模型生成多语言 SDK 调用示例代码,同时写入本地文件。
|
|
6
|
+
|
|
7
|
+
数据源是火山方舟 OpenTOP `OpenGetSampleCode`:按 `(model, version)` + `scenario` 拉取一批"代码块",arkcli 自动按 `(语言 × IO 任务类型)` 去重、配好安装命令后渲染落盘。
|
|
8
|
+
|
|
9
|
+
## 什么时候用
|
|
10
|
+
|
|
11
|
+
- 已经明确模型名(或合并 ID),想直接拿多语言调用代码
|
|
12
|
+
- 想把示例保存到本地目录,作为后续接入模板
|
|
13
|
+
|
|
14
|
+
不要在这些场景使用本命令:
|
|
15
|
+
|
|
16
|
+
- 只是想快速试模型效果:转 `arkcli +chat` 或 `arkcli +gen`
|
|
17
|
+
- 还不知道模型名:先 `arkcli models search/get`
|
|
18
|
+
- 需要先创建 Endpoint:先 `arkcli +deploy` 或 `arkcli infer endpoint create`
|
|
19
|
+
- 目标是语音模型(TTS / ASR / 配音 / 朗读 / 播客 / 音色 / 实时语音交互,或 `doubao-seed-tts-*` / `doubao-seed-asr-*` / `seedasr-*`):只允许 `arkcli models search <keyword>` 做广场发现;当前 arkcli 不支持语音模型示例代码,不能通过补 `--version` 解决
|
|
20
|
+
|
|
21
|
+
## 用法
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 基础用法(传基础模型名)
|
|
25
|
+
arkcli +code-example --model doubao-seedream-5-0
|
|
26
|
+
|
|
27
|
+
# 指定模型版本(两种写法等价)
|
|
28
|
+
arkcli +code-example --model doubao-seedream-5-0 --version 260128
|
|
29
|
+
arkcli +code-example --model doubao-seedream-5-0-260128
|
|
30
|
+
|
|
31
|
+
# 只看 Python 示例
|
|
32
|
+
arkcli +code-example --model doubao-seedream-5-0 --language python
|
|
33
|
+
|
|
34
|
+
# 只看 curl 示例(shell 是别名,等价)
|
|
35
|
+
arkcli +code-example --model doubao-seedream-5-0 --language curl
|
|
36
|
+
|
|
37
|
+
# 指定输出目录
|
|
38
|
+
arkcli +code-example --model doubao-seedream-5-0 --output-dir ./my-examples
|
|
39
|
+
|
|
40
|
+
# 需要结构化结果时,显式要求 JSON
|
|
41
|
+
arkcli +code-example --model doubao-seedream-5-0 --format json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 参数
|
|
45
|
+
|
|
46
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
47
|
+
|------|------|------|------|
|
|
48
|
+
| `--model` | string | ✓ | 基础模型名(`doubao-seedream-5-0`)或合并 ID(`doubao-seedream-5-0-260128`) |
|
|
49
|
+
| `--version` | string | | 模型版本,如 `260128`;不传时 CLI 自动推导 —— 合并 ID 拆版本 → `ArkModels` 匹配 → `GetFoundationModel` 取 `PrimaryVersion` 兜底;三条链路都拿不到才报错要求显式传 `--version` |
|
|
50
|
+
| `--language` | string | | 语言过滤:`python` / `go` / `java` / `node` / `curl`(`shell` 是 `curl` 的别名),默认全部输出 |
|
|
51
|
+
| `--output-dir` | string | | 本地输出目录,默认 `./ark-examples/<model>` |
|
|
52
|
+
| `--format json` | flag | | 输出结构化结果,适合 Agent 或脚本继续消费 |
|
|
53
|
+
|
|
54
|
+
> **版本推导契约**:`OpenGetSampleCode` 接口要求 `ModelVersion` 必填。CLI 通过上述回退链自动补齐;custom model 走 `PrimaryVersion` 兜底时 `scenario` 自动切成 `finetune_inference`(fine-tune 推理示例模板),foundation model 无论是显式版本、合并 ID 拆分还是 `PrimaryVersion` 兜底,一律保持 `quick_access`。
|
|
55
|
+
|
|
56
|
+
> **0.1.17 变更**:旧版的 `--endpoint-id` 已移除 —— 新数据源 `OpenGetSampleCode` 按基础模型取码,不再支持按已有接入点 ID 取码。如需把代码指向某个 endpoint,自行把生成代码里的 `model="..."` 改成你的 `ep-xxx` 即可。
|
|
57
|
+
|
|
58
|
+
## 推荐执行顺序
|
|
59
|
+
|
|
60
|
+
1. 不确定认证状态时,先执行 `arkcli auth status`
|
|
61
|
+
2. 不确定模型名或版本时,先执行 `arkcli models search/get`
|
|
62
|
+
3. 需要结构化解析时,追加 `--format json`
|
|
63
|
+
4. 需要控制本地写入位置时,追加 `--output-dir`
|
|
64
|
+
|
|
65
|
+
## 输出
|
|
66
|
+
|
|
67
|
+
1. **本地文件**:写入 `--output-dir` 目录;未显式指定时,默认写到 `./ark-examples/<model>/`。文件按"IO 任务类型"分子目录(对齐后端返回的 `IOType` 维度),同类型下再按语言分文件。例如图像模型:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
ark-examples/<model>/
|
|
71
|
+
├── text_to_image_generate_single_image/
|
|
72
|
+
│ ├── python.py
|
|
73
|
+
│ ├── go/main.go
|
|
74
|
+
│ ├── java/Main.java
|
|
75
|
+
│ ├── node.ts
|
|
76
|
+
│ └── curl.sh
|
|
77
|
+
├── image_to_image_single_image_to_single_image/
|
|
78
|
+
│ └── ...
|
|
79
|
+
└── ...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
文本/对话类模型的子目录名会是对应的对话类 IO 类型。带安装步骤的语言(如 Python 的 `volcengine-python-sdk[ark]`、Go 的 `go get ...`),安装命令会作为文件头注释一并写入。
|
|
83
|
+
|
|
84
|
+
2. **结构化结果**:追加 `--format json` 后,得到按 `(语言 × IO 类型)` 展开的结构化条目(含 `language` / `io_type` / `call_method` / `install` / `code` 等字段),适合后续流程解析。
|
|
85
|
+
|
|
86
|
+
3. **人类可读代码块**:默认按后端给定顺序打印各示例代码块,便于直接复制。
|
|
87
|
+
|
|
88
|
+
## 常见链路
|
|
89
|
+
|
|
90
|
+
### 1. 先查模型,再生成示例
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
arkcli models search doubao-seedream
|
|
94
|
+
arkcli +code-example --model doubao-seedream-5-0
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. 只要某一种语言,并让下游脚本消费 JSON
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
arkcli +code-example \
|
|
101
|
+
--model doubao-seedream-5-0 \
|
|
102
|
+
--language python \
|
|
103
|
+
--format json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 注意事项
|
|
107
|
+
|
|
108
|
+
- 代码中的 `$ARK_API_KEY` 会自动替换为当前已解析上下文的 API Key;身份摘要用 `arkcli auth whoami --format json`。不要为普通准入调用 `profile show/list/keys list`,这些命令可能同步并回写 Key
|
|
109
|
+
- 需要先通过 `arkcli auth` 登录才能调用接口
|
|
110
|
+
- 模型名称可通过 `arkcli models search <keyword>` 查找
|
|
111
|
+
- 本命令会写入本地文件;如果不希望写到当前目录,请显式指定 `--output-dir`
|
|
112
|
+
- 示例只覆盖 API Key 鉴权方式(`Authorization: Bearer $ARK_API_KEY`)
|
|
113
|
+
- 语音模型广场可搜不等于有示例代码;遇到 `ModelVersion required` 或 no group 之类响应时,不要引导用户为 TTS / ASR 猜版本号,应说明当前不支持
|
|
114
|
+
|
|
115
|
+
## 内置模板资产
|
|
116
|
+
|
|
117
|
+
`assets/demo-code/` 内置了一组可直接运行的模板样例(随 Skill 一起分发给 Agent):
|
|
118
|
+
|
|
119
|
+
| 文件 | 语言 | 说明 |
|
|
120
|
+
|------|------|------|
|
|
121
|
+
| `python.py` | Python | OpenAI 兼容 `chat.completions`(`openai` SDK) |
|
|
122
|
+
| `go/main.go` | Go | Responses API(`volcengine-go-sdk` arkruntime) |
|
|
123
|
+
|
|
124
|
+
约定:
|
|
125
|
+
|
|
126
|
+
- 模板统一使用**带版本号的合并 ID**(如 `doubao-seed-2-0-pro-260215` = 模型名 + PrimaryVersion);版本号用 `arkcli models get <name> --format json` 查询 `PrimaryVersion` 后拼合,不要把裸家族名当可运行 model
|
|
127
|
+
- API Key 一律用 `$ARK_API_KEY` 环境变量占位,不要把真实 Key 写进模板或生成结果
|
|
128
|
+
- `ark-examples/` 只是 `+code-example` / `+deploy` 的**本地输出目录**(已在 `.gitignore` 中),不是模板存放位置,不要把里面的产物提交进仓库
|
|
129
|
+
|
|
130
|
+
## 常见问题
|
|
131
|
+
|
|
132
|
+
| 现象 | 常见原因 | 处理方式 |
|
|
133
|
+
|------|----------|----------|
|
|
134
|
+
| 鉴权失败 / 未登录 | 本地没有可用凭证 | 先执行 `arkcli auth status`,必要时转 `arkcli auth login` |
|
|
135
|
+
| 不知道该填哪个模型名 | 只有模糊关键词,没有确定模型 ID | 先执行 `arkcli models search <keyword>` |
|
|
136
|
+
| 想让代码指向现有 endpoint | `--endpoint-id` 已移除 | 生成后把代码里的 `model="..."` 手动改成你的 `ep-xxx` |
|
|
137
|
+
| 下游脚本难以解析输出 | 直接消费了默认的人类可读输出 | 追加 `--format json` |
|
|
138
|
+
| TTS / ASR 模型生成示例失败 | 语音模型当前不在 arkcli 示例代码支持范围内 | 停在 `models search` 的可发现说明,不要继续补版本或改走 `+chat` / `+gen` / `+deploy` |
|
|
139
|
+
|
|
140
|
+
## 参考
|
|
141
|
+
|
|
142
|
+
- [arkcli-code-example](../SKILL.md) — skill 概览
|
|
143
|
+
- [arkcli-models](../../arkcli-models/SKILL.md) — 查模型名与版本
|
|
144
|
+
- [arkcli-deploy](../../arkcli-deploy/SKILL.md) — 创建 Endpoint 并进入正式接入
|
|
145
|
+
- [arkcli-infer-endpoint](../../arkcli-infer-endpoint/SKILL.md) — 创建或管理已有 Endpoint
|
|
146
|
+
- [arkcli-shared](../../arkcli-shared/SKILL.md) — 认证和全局参数
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 技术教程事实回归
|
|
2
|
+
|
|
3
|
+
真实退步 Case 为 Viking 300/V10 的 163542:MD 已真实生成并提交,但其中多个 SDK import、媒体 API 和错误码写法缺少对应版本证据。失败不是“没有文件”。
|
|
4
|
+
|
|
5
|
+
| 输入/对照 | 验收 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 需要文本、图像、视频教程;仅查到一份文本示例 | 不用文本示例或模型草稿编出其他 SDK 方法;逐协议核对官方正文/版本源码,否则标注未验证或缩小内容 |
|
|
8
|
+
| 拿到 install/code,但没实际运行 | 保留语言、模型和版本,称官方模板而非实测通过;不将保存 MD 称作代码运行成功 |
|
|
9
|
+
| 样例中含合成 Key/Token/签名 URL | 附件及答复均为占位符,保留普通示例语义;不把真实凭证写入教程 |
|
|
10
|
+
| 原 CLI 不支持拟议 flag、音频示例接口不在当前能力中 | 保留实际 help/能力边界,不伪造命令补齐教程 |
|
|
11
|
+
|
|
12
|
+
不把本页的正确代码或模型选择注入线上原题。先以真实 CLI/返回样例校准,再验收实际答复和附件内容。
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkcli-config
|
|
3
|
+
version: 1.2.1
|
|
4
|
+
description: "arkcli 本地配置管理。处理 profile 配置归因、update.mode 的 automatic/disabled 策略、config reset 与历史 yaml 排障;profile 类操作优先使用 `arkcli profile <subcmd>`。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["arkcli"]
|
|
8
|
+
cliHelp: "arkcli config --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# arkcli config
|
|
12
|
+
|
|
13
|
+
**⚠️ 0.1.16 起命令树迁移**:`arkcli config init/list/show/switch/delete` 已标记 deprecated,请改用 `arkcli profile create/list/show/use/delete`(行为一致 + 新增 profile 切面字段 type/project/owner_trn/available_api_keys)。`arkcli config reset` 保留(清整个本地状态,超出单 profile)。0.2.x 删除全部已 deprecated 子命令。
|
|
14
|
+
|
|
15
|
+
**CRITICAL — 开始前 MUST 先用 Read 工具读取 [`../arkcli-shared/SKILL.md`](../arkcli-shared/SKILL.md),其中包含认证闸门、命令选择顺序与共享安全规则**
|
|
16
|
+
**CRITICAL — 配置类写操作前必须确认用户意图。`profile show/list/keys list` 可能同步远端 Key 并回写本地库存或默认 Key,不能当作无配置副作用的准入探测。**
|
|
17
|
+
|
|
18
|
+
## 唤起信号(When To Trigger)
|
|
19
|
+
|
|
20
|
+
- 用户提到:`profile`、`base-url`、`api-key` 覆盖混乱,或仍在使用已删除的全局 `--region/--project-name`
|
|
21
|
+
- 用户现象:同一条业务命令“打到了错误环境/错误 base URL/错误账号”,怀疑是配置来源不一致
|
|
22
|
+
- 用户目标:初始化/更新 profile、切换默认 profile、重置本地配置文件
|
|
23
|
+
- 用户目标:启用、关闭或恢复 arkcli 的自动更新/更新提示策略
|
|
24
|
+
|
|
25
|
+
## 反唤起信号(When NOT To Trigger)
|
|
26
|
+
|
|
27
|
+
- 用户要解决的是“未登录/401/鉴权失败/没有权限”:先走 `arkcli auth status`,必要时转 [`../arkcli-auth/SKILL.md`](../arkcli-auth/SKILL.md)
|
|
28
|
+
- 用户目标是业务功能(models/+chat/+gen/+deploy/usage 等):不要停留在 config,排除配置后回到原任务
|
|
29
|
+
|
|
30
|
+
## 适用场景
|
|
31
|
+
|
|
32
|
+
- 初始化或更新 profile
|
|
33
|
+
- 查看当前解析后的配置
|
|
34
|
+
- 切换默认 profile
|
|
35
|
+
- 删除单个 profile 或重置整个本地配置
|
|
36
|
+
- 排查为什么业务命令连到了错误环境、错误账号或错误 base URL
|
|
37
|
+
|
|
38
|
+
## Agent 快速执行顺序
|
|
39
|
+
|
|
40
|
+
1. 先遵守 shared 的认证及宿主边界。普通 CLI 的当前身份/Profile 诊断用 `arkcli auth status --format json`、`arkcli auth whoami --format json`;宿主禁止额外认证探测时,使用宿主已给的上下文,不自行探测。
|
|
41
|
+
2. Chat/Gen 的默认模型和路由用 `arkcli resources list --modality <text|image|video> --format json`,按 Resources Skill 区分发现、兼容性和真实调用验证。仅查看默认模型不等于授权发送收费请求。
|
|
42
|
+
3. 切换默认 profile:`arkcli profile use <name>`
|
|
43
|
+
4. 创建 profile:`arkcli profile create --type=...`(详见 arkcli-profile 子树,本 skill 不重复)
|
|
44
|
+
5. `arkcli config reset` 是破坏性操作(清整个本地配置文件),必须确认用户意图
|
|
45
|
+
6. 更新策略只使用 allowlist 命令:`arkcli config set update.mode automatic|disabled`
|
|
46
|
+
7. 用户明确需要 Profile 详情、清单或 Key 管理时才考虑 `arkcli profile show` / `arkcli profile list`;执行前说明可能同步并回写 Key。用户要求“不改配置/Key”时不执行它们,也不改用旧 `config show/list` 绕过限制。
|
|
47
|
+
|
|
48
|
+
## 配置归因(优先级)
|
|
49
|
+
|
|
50
|
+
`arkcli` 的解析优先级(从高到低):
|
|
51
|
+
|
|
52
|
+
- Profile 选择: `--profile` flag > `ARK_PROFILE` 环境变量 > `config.yaml` 的 `default_profile` > 第一个 `type=platform` 的 profile > `"default"` sentinel
|
|
53
|
+
- API Key: `--api-key` > `ARK_API_KEY` > profile > 同 identity store > 产品 `.env` 兼容值
|
|
54
|
+
- Base URL: `--base-url` > `ARK_BASE_URL` > profile 自定义值 > 按 Profile 的 Region/Type 派生 > 默认值
|
|
55
|
+
- Region/Project: 由所选 Profile 持有;`ARK_REGION` / `ARK_PROJECT_NAME` 不再覆盖运行时
|
|
56
|
+
|
|
57
|
+
`--api-key/--base-url` 仅供数据面命令使用。无 Profile 时必须成对提供;覆盖 Base URL 时也必须显式提供 API Key。控制面/本地命令显式收到这两个 flag 会 fail-fast。
|
|
58
|
+
|
|
59
|
+
排障时要明确”是谁覆盖了谁”,不要直接猜测。
|
|
60
|
+
|
|
61
|
+
> **0.1.16 修正**:`--profile` 现在优先于 `ARK_PROFILE`(对齐 CLI 行业惯例 flag > env > config)。0.1.15 及更早版本是 env > flag,与本规则相反。
|
|
62
|
+
|
|
63
|
+
### 证据与结论
|
|
64
|
+
|
|
65
|
+
说明本轮实际检查了什么、哪些来源覆盖仍未验证,不要求复述固定评测词句。`auth whoami` 的 Profile 字段是持久切面摘要,不能据此声称临时 API Key/Base URL override 已验证或数据面调用一定成功。缺少证据时明确保留未知,不为补字段执行可能回写配置的命令。路径展示使用 `$HOME/...`,不读取凭证文件。
|
|
66
|
+
|
|
67
|
+
## 核心规则
|
|
68
|
+
|
|
69
|
+
- 本 skill 负责解释“为什么命令打到了错误环境/错误账号/错误 base URL”,并兼容历史 `config init/list/show/switch/delete` 命令排障语义
|
|
70
|
+
- 常规准入沿 `auth status/whoami` → `resources`,不把 Profile 管理命令当无副作用查询
|
|
71
|
+
- profile 写操作(create / use / set-default / delete)走 `arkcli profile` 子树
|
|
72
|
+
- `arkcli config reset` 负责全量清理;`arkcli config set update.mode <mode>` 只写更新策略。不要用它写任意 YAML 路径。
|
|
73
|
+
|
|
74
|
+
## Guard Checklist(必做)
|
|
75
|
+
|
|
76
|
+
- 只读意图:不执行可能回写 Key 的 `profile show/list/keys list`;脱敏不等于无副作用,命令名为 show/list 也不等于只读
|
|
77
|
+
- 写操作确认:`profile use/delete` 与 `config reset` 执行前必须复述影响范围并征得确认
|
|
78
|
+
- 全量清理提醒:`arkcli config reset` 删除 `config.yaml/config.json`,不会清理 `$HOME/.arkcli/.env`(token)或 identity store;要清理凭证请用 `arkcli auth logout`
|
|
79
|
+
|
|
80
|
+
## 与其他 skill 的串联
|
|
81
|
+
|
|
82
|
+
- profile 创建 / 切换 / 资源 default 设置 / API Key 管理 → 转 `arkcli-profile`(推荐)或继续看本 skill 的兼容映射
|
|
83
|
+
- 业务命令失败且怀疑是 `--profile`、`--base-url`、API Key 来源或 Profile 的 Region/Project 不一致时,先转到这里
|
|
84
|
+
- 配置问题排除后,再回到原始业务 skill 继续
|
|
85
|
+
- 配置仍无法解释问题时,再考虑转 [`../arkcli-auth/SKILL.md`](../arkcli-auth/SKILL.md) 或 [`../arkcli-api-explorer/SKILL.md`](../arkcli-api-explorer/SKILL.md)
|
|
86
|
+
|
|
87
|
+
## 命令一览
|
|
88
|
+
|
|
89
|
+
| 命令 | 说明 | 状态 |
|
|
90
|
+
|------|------|------|
|
|
91
|
+
| `arkcli config reset` | 删除整个本地配置文件(保留) | ✅ 活跃 |
|
|
92
|
+
| `arkcli config set update.mode automatic` | 显式为当前 exact install 启用 automatic;从非 latest 版本恢复时先安装 latest 再执行 | ✅ 活跃 |
|
|
93
|
+
| `arkcli config set update.mode disabled` | 关闭静默自动安装,保留隐式版本检查、更新提示和手工 update | ✅ 活跃 |
|
|
94
|
+
| `arkcli profile show [--profile <name>]` | 查看 Profile;可能同步并回写 Key | ✅ Profile 管理,替代 `config show` |
|
|
95
|
+
| `arkcli profile list` | 列出 Profile;可能同步并回写各 Profile 的 Key | ✅ Profile 管理,替代 `config list` |
|
|
96
|
+
| `arkcli profile use <name>` | 切换默认 profile | ✅ 替代 `config switch` |
|
|
97
|
+
| `arkcli profile delete <name>` | 删除单个 profile | ✅ 替代 `config delete` |
|
|
98
|
+
| `arkcli profile create --type=...` | 创建 profile(替代旧 `config init`) | ✅ 替代 `config init` |
|
|
99
|
+
| `arkcli config init/list/show/switch/delete` | 旧子命令,0.2.x 移除 | ⚠️ deprecated |
|
|
100
|
+
|
|
101
|
+
公开模式只有 `automatic` 和 `disabled`。`disabled` 保留隐式版本检查和更新提示,但绝不静默安装;显式 `arkcli update` 和 `arkcli update --check` 也始终可用。缺失 `update.mode` 和历史配置中的 `notify` 对外都按 `disabled` 处理,历史配置中的 `notify` 继续按 `disabled` 兼容读取,但不得再建议用户设置 `notify`。
|
|
102
|
+
|
|
103
|
+
Windows、macOS、Linux 的 fail-closed transaction 与六个产品/平台生产 gate 均已开启。stable 全局 npm postinstall 会将安装后版本与 registry 当前 `latest` 比较:非 latest 持久化 `disabled`;当前 latest 不改 mode,已有 `automatic` 时为新 exact install 换发授权。postinstall 不立即执行版本替换。
|
|
104
|
+
|
|
105
|
+
### 新安装 enrollment
|
|
106
|
+
|
|
107
|
+
只有能证明“此前没有产品状态目录”且安装版本等于 registry `latest` 的 stable 全局 npm 新安装,才默认写入 `automatic` 并创建绑定当前 exact install 的惰性 pending evidence:
|
|
108
|
+
|
|
109
|
+
1. 第一次成功的、符合安全条件的人工业务命令在一个策略事务中完成 pending → grace → active。
|
|
110
|
+
2. 重新检查确认 exact-install consent 已 active 后,该 invocation 即可调度 automatic patch 更新。
|
|
111
|
+
|
|
112
|
+
由 npm `postinstall` 启动的全部 CLI 进程(包括其中的 `+connect`)以及用户手工执行的 `+connect` 都不消耗 enrollment、不做隐式版本检查,也不调度 automatic。AI Skill、CI、非 TTY、Client Preview、`config`、`update` 和内部维护命令同样不消耗 enrollment,也不调度 automatic。更新成功后,下一次成功的人工业务命令只在 stderr 显示一次 `旧版本 -> 新版本` 结果,不修改 stdout 或业务退出码。
|
|
113
|
+
|
|
114
|
+
当前生产 automatic 按明确产品策略关闭 24/48/72 小时与 10%/50%/100% cohort admission;原 rollout 实现与回归测试仍保留,在线 Probe 仍要求两次独立观测。普通 automatic 仍须满足 exact consent、实时 registry target/SRI/tarball 校验、reservation、退避和全部 staged-apply 安全边界。
|
|
115
|
+
|
|
116
|
+
每次 npm 重装都不得沿用旧 exact-install receipt。若安装版本等于当前 `latest`,不改既有 mode:`automatic` 换发新 receipt,`disabled` / 历史 `notify` 仍保持关闭。若安装版本不等于 `latest`,持久化 `disabled`。registry 失败时不改 mode、不发新 receipt;`--ignore-scripts` 也不会完成对齐。从非 latest 版本恢复时,先安装 latest,再明确执行 `arkcli config set update.mode automatic`。长期锁定版本使用:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
arkcli config set update.mode disabled
|
|
120
|
+
npm i @volcengine/ark-cli@<exact-version> -g --registry https://registry.npmjs.org
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
为避免 registry 不可用时的不确定,需要确定锁版时仍建议先执行 `arkcli config set update.mode disabled` 再安装精确版本。`disabled` 位于 `$HOME/.arkcli/config.yaml`,安装 `@latest` 也不会自动改回 `automatic`。`arkcli config reset` 会尽力撤销 exact consent 后再清配置。npm 解析 `@latest` 与 postinstall 查询之间恰好发新版时,存在极小概率误判为非 latest 的竞态。
|
|
124
|
+
|
|
125
|
+
## 参考
|
|
126
|
+
|
|
127
|
+
- [`references/arkcli-config-init.md`](references/arkcli-config-init.md)
|
|
128
|
+
- [`references/arkcli-config-profile.md`](references/arkcli-config-profile.md)
|
|
129
|
+
- [`references/evals.md`](references/evals.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# config init
|
|
2
|
+
|
|
3
|
+
## 创建或更新 profile
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
arkcli config init \
|
|
7
|
+
--profile default \
|
|
8
|
+
--tenant volc \
|
|
9
|
+
--api-key <ark_api_key> \
|
|
10
|
+
--base-url https://ark.cn-beijing.volces.com/api/v3 \
|
|
11
|
+
--region cn-beijing \
|
|
12
|
+
--default-model doubao-seed-1-6 \
|
|
13
|
+
--format json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
可选控制面凭证:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
arkcli config init --profile default --access-key <ak> --secret-key <sk> --format json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 关键字段
|
|
23
|
+
|
|
24
|
+
- `--profile`
|
|
25
|
+
- `--tenant`(`volc`,决定控制面路由与身份体系)
|
|
26
|
+
- `--api-key`
|
|
27
|
+
- `--base-url`
|
|
28
|
+
- `--region`
|
|
29
|
+
- `--env`(全局 flag,非 `config init` 专属;`prod` / `stg` 仅火山有意义)
|
|
30
|
+
- `--default-model`
|
|
31
|
+
- `--set-default`
|
|
32
|
+
|
|
33
|
+
## Profile schema v1 (0.1.16+) 改动
|
|
34
|
+
|
|
35
|
+
- **Project Name 在 0.1.16 起进 profile 切面**:`arkcli profile create --project X` 会把 `Project: X` 写入 `config.yaml` 当前 profile。
|
|
36
|
+
- 根命令已删除 `--project-name`,`ARK_PROJECT_NAME` 也不再覆盖运行时。解析顺序为 active profile `Project` > identity store / 火山 `.env` 旧状态兼容 > `default`。
|
|
37
|
+
- Region 同样由 Profile 持有;根命令已删除 `--region`,`ARK_REGION` 不再覆盖运行时。
|
|
38
|
+
|
|
39
|
+
## 推荐迁移到 `arkcli profile create`
|
|
40
|
+
|
|
41
|
+
`config init` 已 deprecated,新代码请用 `arkcli profile create`:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
arkcli profile create --type platform --region cn-beijing --project default --set-default
|
|
45
|
+
arkcli profile create --type agent-plan --plan-tier medium --set-default
|
|
46
|
+
arkcli profile create --type coding-plan --plan-tier lite --set-default
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`profile create` 强制要求显式 `--type`,对应"platform / agent-plan / coding-plan" 三档;其余字段(region / project / owner-trn / default-api-key / plan-tier)跟旧 `config init` 语义一致。
|