arize-experiment
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseArize Experiment Skill
Arize实验Skill
Concepts
核心概念
- Experiment = a named evaluation run against a specific dataset version, containing one run per example
- Experiment Run = the result of processing one dataset example -- includes the model output, optional evaluations, and optional metadata
- Dataset = a versioned collection of examples; every experiment is tied to a dataset and a specific dataset version
- Evaluation = a named metric attached to a run (e.g., ,
correctness), with optional label, score, and explanationrelevance
The typical flow: export a dataset → process each example → collect outputs and evaluations → create an experiment with the runs.
- Experiment = 针对特定数据集版本的命名评估运行,每个示例对应一个运行记录
- Experiment Run = 处理单个数据集示例的结果——包含模型输出、可选的评估结果和可选元数据
- Dataset = 带版本的示例集合;每个实验都关联一个数据集和特定的数据集版本
- Evaluation = 附加到运行记录的命名指标(例如、
correctness),包含可选的标签、分数和解释relevance
典型流程:导出数据集 → 处理每个示例 → 收集输出和评估结果 → 使用运行记录创建实验。
Prerequisites
前提条件
Three things are needed: CLI, an API key (env var or profile), and a space ID. A project name is also needed but usually comes from the user's message.
ax需要准备三样东西: CLI、API密钥(环境变量或配置文件),以及空间ID。还需要项目名称,通常可从用户的消息中获取。
axInstall ax
安装ax
Verify is installed and working before proceeding:
ax- Check if is on PATH:
ax(Unix) orcommand -v ax(Windows)where ax - If not found, check common install locations:
- macOS/Linux:
test -x ~/.local/bin/ax && export PATH="$HOME/.local/bin:$PATH" - Windows: check or
%APPDATA%\Python\Scripts\ax.exe%LOCALAPPDATA%\Programs\Python\Scripts\ax.exe
- macOS/Linux:
- If still not found, install it (requires shell access to install packages):
- Preferred:
uv tool install arize-ax-cli - Alternative:
pipx install arize-ax-cli - Fallback:
pip install arize-ax-cli
- Preferred:
- After install, if is not on PATH:
ax- macOS/Linux:
export PATH="$HOME/.local/bin:$PATH" - Windows (PowerShell):
$env:PATH = "$env:APPDATA\Python\Scripts;$env:PATH"
- macOS/Linux:
- If fails with an SSL/certificate error:
ax --version- macOS:
export SSL_CERT_FILE=/etc/ssl/cert.pem - Linux:
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt - Windows (PowerShell): (or use
$env:SSL_CERT_FILE = "C:\Program Files\Common Files\SSL\cert.pem"to find the cert bundle)python -c "import certifi; print(certifi.where())"
- macOS:
- must succeed before proceeding. If it doesn't, stop and ask the user for help.
ax --version
在继续操作前,请先验证已安装且可正常使用:
ax- 检查是否在PATH中:
ax(Unix系统)或command -v ax(Windows系统)where ax - 如果未找到,检查常见安装位置:
- macOS/Linux:
test -x ~/.local/bin/ax && export PATH="$HOME/.local/bin:$PATH" - Windows:检查或
%APPDATA%\Python\Scripts\ax.exe%LOCALAPPDATA%\Programs\Python\Scripts\ax.exe
- macOS/Linux:
- 如果仍未找到,请安装它(需要Shell权限来安装软件包):
- 推荐方式:
uv tool install arize-ax-cli - 替代方式:
pipx install arize-ax-cli - 备用方式:
pip install arize-ax-cli
- 推荐方式:
- 安装后,如果不在PATH中:
ax- macOS/Linux:
export PATH="$HOME/.local/bin:$PATH" - Windows(PowerShell):
$env:PATH = "$env:APPDATA\Python\Scripts;$env:PATH"
- macOS/Linux:
- 如果因SSL/证书错误失败:
ax --version- macOS:
export SSL_CERT_FILE=/etc/ssl/cert.pem - Linux:
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt - Windows(PowerShell):(或使用
$env:SSL_CERT_FILE = "C:\Program Files\Common Files\SSL\cert.pem"查找证书包路径)python -c "import certifi; print(certifi.where())"
- macOS:
- 必须确保执行成功才能继续。如果失败,请停止操作并向用户寻求帮助。
ax --version
Verify environment
验证环境
Run a quick check for credentials:
macOS/Linux (bash):
bash
ax --version && echo "--- env ---" && echo "ARIZE_API_KEY: ${ARIZE_API_KEY:-(not set)}" && echo "ARIZE_SPACE_ID: ${ARIZE_SPACE_ID:-(not set)}" && echo "--- profiles ---" && ax profiles show 2>&1Windows (PowerShell):
powershell
ax --version; Write-Host "--- env ---"; Write-Host "ARIZE_API_KEY: $env:ARIZE_API_KEY"; Write-Host "ARIZE_SPACE_ID: $env:ARIZE_SPACE_ID"; Write-Host "--- profiles ---"; ax profiles show 2>&1Read the output and proceed immediately if either the env var or the profile has an API key. Only ask the user if both are missing. Resolve failures:
- No API key in env and no profile → AskQuestion: "Arize API key (https://app.arize.com/admin > API Keys)"
- Space ID unknown → AskQuestion, or run and search for a match
ax projects list -o json --limit 100 - Project unclear → ask, or run and present as selectable options
ax projects list -o json --limit 100
快速检查凭证是否配置正确:
macOS/Linux(bash):
bash
ax --version && echo "--- 环境变量 ---" && echo "ARIZE_API_KEY: ${ARIZE_API_KEY:-(未设置)}" && echo "ARIZE_SPACE_ID: ${ARIZE_SPACE_ID:-(未设置)}" && echo "--- 配置文件 ---" && ax profiles show 2>&1Windows(PowerShell):
powershell
ax --version; Write-Host "--- 环境变量 ---"; Write-Host "ARIZE_API_KEY: $env:ARIZE_API_KEY"; Write-Host "ARIZE_SPACE_ID: $env:ARIZE_SPACE_ID"; Write-Host "--- 配置文件 ---"; ax profiles show 2>&1立即根据输出结果操作:如果环境变量或配置文件中存在API密钥,可直接继续。只有当两者都缺失时,才需要询问用户。解决失败情况:
- 环境变量中无API密钥且无配置文件 → 询问用户:"请提供Arize API密钥(获取地址:https://app.arize.com/admin > API Keys)"
- 空间ID未知 → 询问用户,或运行并搜索匹配项
ax projects list -o json --limit 100 - 项目不明确 → 询问用户,或运行并提供可选选项
ax projects list -o json --limit 100
Space ID and Project
空间ID与项目
Both are needed for most commands. Resolve each:
- User provides it in the conversation -- use directly via /
--space-idflags.--project - Env var is set (,
ARIZE_SPACE_ID) -- use silently.ARIZE_DEFAULT_PROJECT - If missing, AskQuestion once. Tell the user:
- Space ID is in the Arize URL:
/spaces/{SPACE_ID}/... - Project is the project name as shown in the Arize UI.
- For convenience, recommend setting env vars so they don't get asked again:
and
export ARIZE_SPACE_ID="U3BhY2U6..."export ARIZE_DEFAULT_PROJECT="my-project"
- Space ID is in the Arize URL:
Prefer asking the user over searching or iterating through projects and API keys.
If you get a , tell the user their API key may not have access to
that space and ask them to verify.
401 Unauthorized大多数命令都需要这两个参数。获取方式如下:
- 用户在对话中提供——直接通过/
--space-id参数使用。--project - 已设置环境变量(、
ARIZE_SPACE_ID)——静默使用。ARIZE_DEFAULT_PROJECT - 如果缺失,询问用户一次。告知用户:
- 空间ID可在Arize的URL中找到:
/spaces/{SPACE_ID}/... - 项目是Arize UI中显示的项目名称。
- 为方便后续使用,建议设置环境变量:
和
export ARIZE_SPACE_ID="U3BhY2U6..."export ARIZE_DEFAULT_PROJECT="my-project"
- 空间ID可在Arize的URL中找到:
优先询问用户,而非遍历搜索项目和API密钥。
如果收到错误,告知用户其API密钥可能无权访问该空间,请他们验证。
401 UnauthorizedList Experiments: ax experiments list
ax experiments list列出实验:ax experiments list
ax experiments listBrowse experiments, optionally filtered by dataset. Output goes to stdout.
bash
ax experiments list
ax experiments list --dataset-id DATASET_ID --limit 20
ax experiments list --cursor CURSOR_TOKEN
ax experiments list -o json浏览实验,可按数据集筛选。输出结果将打印到标准输出。
bash
ax experiments list
ax experiments list --dataset-id DATASET_ID --limit 20
ax experiments list --cursor CURSOR_TOKEN
ax experiments list -o jsonFlags
参数说明
| Flag | Type | Default | Description |
|---|---|---|---|
| string | none | Filter by dataset |
| int | 15 | Max results (1-100) |
| string | none | Pagination cursor from previous response |
| string | table | Output format: table, json, csv, parquet, or file path |
| string | default | Configuration profile |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| 字符串 | 无 | 按数据集筛选 |
| 整数 | 15 | 最大结果数(1-100) |
| 字符串 | 无 | 上一次响应返回的分页游标 |
| 字符串 | table | 输出格式:table、json、csv、parquet或文件路径 |
| 字符串 | default | 配置文件 |
Get Experiment: ax experiments get
ax experiments get获取实验详情:ax experiments get
ax experiments getQuick metadata lookup -- returns experiment name, linked dataset/version, and timestamps.
bash
ax experiments get EXPERIMENT_ID
ax experiments get EXPERIMENT_ID -o json快速查询元数据——返回实验名称、关联的数据集/版本以及时间戳。
bash
ax experiments get EXPERIMENT_ID
ax experiments get EXPERIMENT_ID -o jsonFlags
参数说明
| Flag | Type | Default | Description |
|---|---|---|---|
| string | required | Positional argument |
| string | table | Output format |
| string | default | Configuration profile |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| 字符串 | 必填 | 位置参数 |
| 字符串 | table | 输出格式 |
| 字符串 | default | 配置文件 |
Response fields
响应字段
| Field | Type | Description |
|---|---|---|
| string | Experiment ID |
| string | Experiment name |
| string | Linked dataset ID |
| string | Specific dataset version used |
| string | Project where experiment traces are stored |
| datetime | When the experiment was created |
| datetime | Last modification time |
| 字段 | 类型 | 描述 |
|---|---|---|
| 字符串 | 实验ID |
| 字符串 | 实验名称 |
| 字符串 | 关联的数据集ID |
| 字符串 | 使用的特定数据集版本ID |
| 字符串 | 存储实验追踪数据的项目ID |
| 日期时间 | 实验创建时间 |
| 日期时间 | 最后修改时间 |
Export Experiment: ax experiments export
ax experiments export导出实验:ax experiments export
ax experiments exportDownload all runs to a file. By default uses the REST API; pass to use Arrow Flight for bulk transfer.
--allbash
ax experiments export EXPERIMENT_ID将所有运行记录下载到文件中。默认使用REST API;添加参数可使用Arrow Flight进行批量传输。
--allbash
ax experiments export EXPERIMENT_ID-> experiment_abc123_20260305_141500/runs.json
-> experiment_abc123_20260305_141500/runs.json
ax experiments export EXPERIMENT_ID --all
ax experiments export EXPERIMENT_ID --output-dir ./results
ax experiments export EXPERIMENT_ID --stdout
ax experiments export EXPERIMENT_ID --stdout | jq '.[0]'
undefinedax experiments export EXPERIMENT_ID --all
ax experiments export EXPERIMENT_ID --output-dir ./results
ax experiments export EXPERIMENT_ID --stdout
ax experiments export EXPERIMENT_ID --stdout | jq '.[0]'
undefinedFlags
参数说明
| Flag | Type | Default | Description |
|---|---|---|---|
| string | required | Positional argument |
| bool | false | Use Arrow Flight for bulk export (see below) |
| string | | Output directory |
| bool | false | Print JSON to stdout instead of file |
| string | default | Configuration profile |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| 字符串 | 必填 | 位置参数 |
| 布尔值 | false | 使用Arrow Flight进行批量导出(见下文) |
| 字符串 | | 输出目录 |
| 布尔值 | false | 将JSON打印到标准输出而非保存到文件 |
| 字符串 | default | 配置文件 |
REST vs Flight (--all
)
--allREST与Flight(--all
)对比
--all- REST (default): Lower friction -- no Arrow/Flight dependency, standard HTTPS ports, works through any corporate proxy or firewall. Limited to 500 runs per page.
- Flight (): Required for experiments with more than 500 runs. Uses gRPC+TLS on a separate host/port (
--all) which some corporate networks may block.flight.arize.com:443
Agent auto-escalation rule: If a REST export returns exactly 500 runs, the result is likely truncated. Re-run with to get the full dataset.
--allOutput is a JSON array of run objects:
json
[
{
"id": "run_001",
"example_id": "ex_001",
"output": "The answer is 4.",
"evaluations": {
"correctness": { "label": "correct", "score": 1.0 },
"relevance": { "score": 0.95, "explanation": "Directly answers the question" }
},
"metadata": { "model": "gpt-4o", "latency_ms": 1234 }
}
]- REST(默认):门槛更低——无需依赖Arrow/Flight,使用标准HTTPS端口,可通过任何企业代理或防火墙。每页最多返回500条运行记录。
- Flight():实验运行记录超过500条时必须使用。使用gRPC+TLS协议,独立的主机/端口(
--all),部分企业网络可能会阻止此连接。flight.arize.com:443
Agent自动升级规则:如果REST导出恰好返回500条运行记录,结果可能被截断。需重新运行并添加参数以获取完整数据集。
--all输出为运行记录对象的JSON数组:
json
[
{
"id": "run_001",
"example_id": "ex_001",
"output": "答案是4。",
"evaluations": {
"correctness": { "label": "correct", "score": 1.0 },
"relevance": { "score": 0.95, "explanation": "直接回答了问题" }
},
"metadata": { "model": "gpt-4o", "latency_ms": 1234 }
}
]Create Experiment: ax experiments create
ax experiments create创建实验:ax experiments create
ax experiments createCreate a new experiment with runs from a data file.
bash
ax experiments create --name "gpt-4o-baseline" --dataset-id DATASET_ID --file runs.json
ax experiments create --name "claude-test" --dataset-id DATASET_ID --file runs.csv使用数据文件中的运行记录创建新实验。
bash
ax experiments create --name "gpt-4o-baseline" --dataset-id DATASET_ID --file runs.json
ax experiments create --name "claude-test" --dataset-id DATASET_ID --file runs.csvFlags
参数说明
| Flag | Type | Required | Description |
|---|---|---|---|
| string | yes (prompted) | Experiment name |
| string | yes (prompted) | Dataset to run the experiment against |
| path | yes (prompted) | Data file with runs: CSV, JSON, JSONL, or Parquet |
| string | no | Output format |
| string | no | Configuration profile |
| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| 字符串 | 是(会提示输入) | 实验名称 |
| 字符串 | 是(会提示输入) | 实验关联的数据集ID |
| 文件路径 | 是(会提示输入) | 包含运行记录的数据文件:CSV、JSON、JSONL或Parquet格式 |
| 字符串 | 否 | 输出格式 |
| 字符串 | 否 | 配置文件 |
Required columns in the runs file
运行记录文件的必填列
| Column | Type | Required | Description |
|---|---|---|---|
| string | yes | ID of the dataset example this run corresponds to |
| string | yes | The model/system output for this example |
Additional columns are passed through as on the run.
additionalProperties| 列 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| 字符串 | 是 | 此运行记录对应的数据集示例ID |
| 字符串 | 是 | 此示例对应的模型/系统输出 |
其他列将作为运行记录的传递。
additionalPropertiesDelete Experiment: ax experiments delete
ax experiments delete删除实验:ax experiments delete
ax experiments deletebash
ax experiments delete EXPERIMENT_ID
ax experiments delete EXPERIMENT_ID --force # skip confirmation promptbash
ax experiments delete EXPERIMENT_ID
ax experiments delete EXPERIMENT_ID --force # 跳过确认提示Flags
参数说明
| Flag | Type | Default | Description |
|---|---|---|---|
| string | required | Positional argument |
| bool | false | Skip confirmation prompt |
| string | default | Configuration profile |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| 字符串 | 必填 | 位置参数 |
| 布尔值 | false | 跳过确认提示 |
| 字符串 | default | 配置文件 |
Experiment Run Schema
实验运行记录 Schema
Each run corresponds to one dataset example:
json
{
"example_id": "required -- links to dataset example",
"output": "required -- the model/system output for this example",
"evaluations": {
"metric_name": {
"label": "optional string label (e.g., 'correct', 'incorrect')",
"score": "optional numeric score (e.g., 0.95)",
"explanation": "optional freeform text"
}
},
"metadata": {
"model": "gpt-4o",
"temperature": 0.7,
"latency_ms": 1234
}
}每个运行记录对应一个数据集示例:
json
{
"example_id": "必填——关联到数据集示例",
"output": "必填——此示例对应的模型/系统输出",
"evaluations": {
"metric_name": {
"label": "可选字符串标签(例如'correct'、'incorrect')",
"score": "可选数值分数(例如0.95)",
"explanation": "可选自由文本"
}
},
"metadata": {
"model": "gpt-4o",
"temperature": 0.7,
"latency_ms": 1234
}
}Evaluation fields
评估字段
| Field | Type | Required | Description |
|---|---|---|---|
| string | no | Categorical classification (e.g., |
| number | no | Numeric quality score (e.g., 0.0 - 1.0) |
| string | no | Freeform reasoning for the evaluation |
At least one of , , or should be present per evaluation.
labelscoreexplanation| 字段 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| 字符串 | 否 | 分类标签(例如 |
| 数字 | 否 | 数值质量分数(例如0.0 - 1.0) |
| 字符串 | 否 | 评估的自由文本推理说明 |
每个评估至少应包含、或中的一个。
labelscoreexplanationWorkflows
工作流
Run an experiment against a dataset
针对数据集运行实验
- Find or create a dataset:
bash
ax datasets list ax datasets export DATASET_ID --stdout | jq 'length' - Export the dataset examples:
bash
ax datasets export DATASET_ID - Process each example through your system, collecting outputs and evaluations
- Build a runs file (JSON array) with ,
example_id, and optionaloutput:evaluationsjson[ {"example_id": "ex_001", "output": "4", "evaluations": {"correctness": {"label": "correct", "score": 1.0}}}, {"example_id": "ex_002", "output": "Paris", "evaluations": {"correctness": {"label": "correct", "score": 1.0}}} ] - Create the experiment:
bash
ax experiments create --name "gpt-4o-baseline" --dataset-id DATASET_ID --file runs.json - Verify:
ax experiments get EXPERIMENT_ID
- 查找或创建数据集:
bash
ax datasets list ax datasets export DATASET_ID --stdout | jq 'length' - 导出数据集示例:
bash
ax datasets export DATASET_ID - 通过你的系统处理每个示例,收集输出和评估结果
- 构建运行记录文件(JSON数组),包含、
example_id和可选的output:evaluationsjson[ {"example_id": "ex_001", "output": "4", "evaluations": {"correctness": {"label": "correct", "score": 1.0}}}, {"example_id": "ex_002", "output": "Paris", "evaluations": {"correctness": {"label": "correct", "score": 1.0}}} ] - 创建实验:
bash
ax experiments create --name "gpt-4o-baseline" --dataset-id DATASET_ID --file runs.json - 验证:
ax experiments get EXPERIMENT_ID
Compare two experiments
对比两个实验
- Export both experiments:
bash
ax experiments export EXPERIMENT_ID_A --stdout > a.json ax experiments export EXPERIMENT_ID_B --stdout > b.json - Compare evaluation scores by :
example_idbash# Average correctness score for experiment A jq '[.[] | .evaluations.correctness.score] | add / length' a.json # Same for experiment B jq '[.[] | .evaluations.correctness.score] | add / length' b.json - Find examples where results differ:
bash
jq -s '.[0] as $a | .[1][] | {example_id, b_score: .evaluations.correctness.score, a_score: ($a[] | select(.example_id == .example_id) | .evaluations.correctness.score)}' a.json b.json
- 导出两个实验的运行记录:
bash
ax experiments export EXPERIMENT_ID_A --stdout > a.json ax experiments export EXPERIMENT_ID_B --stdout > b.json - 按对比评估分数:
example_idbash# 实验A的平均正确性分数 jq '[.[] | .evaluations.correctness.score] | add / length' a.json # 实验B的平均正确性分数 jq '[.[] | .evaluations.correctness.score] | add / length' b.json - 找出结果不同的示例:
bash
jq -s '.[0] as $a | .[1][] | {example_id, b_score: .evaluations.correctness.score, a_score: ($a[] | select(.example_id == .example_id) | .evaluations.correctness.score)}' a.json b.json
Download experiment results for analysis
下载实验结果用于分析
- -- find experiments
ax experiments list --dataset-id DATASET_ID - -- download to file
ax experiments export EXPERIMENT_ID - Parse:
jq '.[] | {example_id, score: .evaluations.correctness.score}' experiment_*/runs.json
- —— 查找实验
ax experiments list --dataset-id DATASET_ID - —— 下载到文件
ax experiments export EXPERIMENT_ID - 解析:
jq '.[] | {example_id, score: .evaluations.correctness.score}' experiment_*/runs.json
Pipe export to other tools
将导出结果管道到其他工具
bash
undefinedbash
undefinedCount runs
统计运行记录数量
ax experiments export EXPERIMENT_ID --stdout | jq 'length'
ax experiments export EXPERIMENT_ID --stdout | jq 'length'
Extract all outputs
提取所有输出内容
ax experiments export EXPERIMENT_ID --stdout | jq '.[].output'
ax experiments export EXPERIMENT_ID --stdout | jq '.[].output'
Get runs with low scores
获取分数较低的运行记录
ax experiments export EXPERIMENT_ID --stdout | jq '[.[] | select(.evaluations.correctness.score < 0.5)]'
ax experiments export EXPERIMENT_ID --stdout | jq '[.[] | select(.evaluations.correctness.score < 0.5)]'
Convert to CSV
转换为CSV格式
ax experiments export EXPERIMENT_ID --stdout | jq -r '.[] | [.example_id, .output, .evaluations.correctness.score] | @csv'
undefinedax experiments export EXPERIMENT_ID --stdout | jq -r '.[] | [.example_id, .output, .evaluations.correctness.score] | @csv'
undefinedTroubleshooting
故障排除
| Problem | Solution |
|---|---|
| Check |
| API key may not have access to this space. Verify the key and space ID are correct. Keys are scoped per space -- get the right one from https://app.arize.com/admin > API Keys. |
| Run |
| Verify experiment ID with |
| Each run must have |
| Ensure |
| Export returned empty -- verify experiment has runs via |
| The linked dataset may have been deleted; check with |
| 问题 | 解决方案 |
|---|---|
| 检查 |
| API密钥可能无权访问该空间。验证密钥和空间ID是否正确。密钥按空间划分权限——请从https://app.arize.com/admin > API Keys获取正确的密钥。 |
| 运行 |
| 使用 |
| 每个运行记录必须包含 |
| 确保 |
| 导出结果为空——通过 |
| 关联的数据集可能已被删除;使用 |
Save Credentials for Future Use
保存凭证供后续使用
At the end of the session, if the user manually provided any of the following during this conversation (via AskQuestion response, pasted text, or inline values) and those values were NOT already loaded from a saved profile or environment variable, offer to save them for future use.
| Credential | Where it gets saved |
|---|---|
| API key | |
| Space ID | macOS/Linux: shell config ( |
Skip this entirely if:
- The API key was already loaded from an existing profile or env var
ARIZE_API_KEY - The space ID was already set via env var
ARIZE_SPACE_ID - The user only used base64 project IDs (no space ID was needed)
How to offer: Use AskQuestion: "Would you like to save your Arize credentials so you don't have to enter them next time?" with options / .
"Yes, save them""No thanks"If the user says yes:
-
API key — Check ifexists. If it does, read it and update the
~/.arize/config.tomlsection. If not, create it with this minimal content:[auth]toml[profile] name = "default" [auth] api_key = "THE_API_KEY" [output] format = "table"Verify with:ax profiles show -
Space ID — Persist the space ID as an environment variable:macOS/Linux — Detect the user's shell config file (for zsh,
~/.zshrcfor bash). Append:~/.bashrcbashexport ARIZE_SPACE_ID="THE_SPACE_ID"Tell the user to run(or restart their terminal) for it to take effect.source ~/.zshrcWindows (PowerShell) — Set a persistent user environment variable:powershell[System.Environment]::SetEnvironmentVariable('ARIZE_SPACE_ID', 'THE_SPACE_ID', 'User')Tell the user to restart their terminal for it to take effect.
在会话结束时,如果用户在此期间手动提供了以下任何信息(通过询问响应、粘贴文本或内联值)且这些值并非从已保存的配置文件或环境变量中加载,请主动提供保存选项。
| 凭证 | 保存位置 |
|---|---|
| API密钥 | |
| 空间ID | macOS/Linux:Shell配置文件( |
完全跳过此步骤的情况:
- API密钥已从现有配置文件或环境变量加载
ARIZE_API_KEY - 空间ID已通过环境变量设置
ARIZE_SPACE_ID - 用户仅使用base64格式的项目ID(无需空间ID)
如何询问:使用询问用户:"是否需要保存你的Arize凭证,以便下次无需重复输入?" 提供选项 / 。
"是,保存""不用了,谢谢"如果用户选择是:
-
API密钥 —— 检查是否存在。如果存在,读取并更新
~/.arize/config.toml部分。如果不存在,创建包含以下内容的最小配置文件:[auth]toml[profile] name = "default" [auth] api_key = "你的API密钥" [output] format = "table"验证:ax profiles show -
空间ID —— 将空间ID持久化为环境变量:macOS/Linux —— 检测用户的Shell配置文件(zsh使用,bash使用
~/.zshrc)。添加:~/.bashrcbashexport ARIZE_SPACE_ID="你的空间ID"告知用户运行(或重启终端)以使设置生效。source ~/.zshrcWindows(PowerShell) —— 设置持久化用户环境变量:powershell[System.Environment]::SetEnvironmentVariable('ARIZE_SPACE_ID', '你的空间ID', 'User')告知用户重启终端以使设置生效。