跳到正文
PromptBeat · 模型与 Prompt

开始使用 PromptBeat

下载完整包,无需 API Key 预览本地用例,再接入模型并查看评测报告。

先用本地示例试一下。校验 bootstrap 项目和预览测试用例,不需要模型账号或 API Key。

按操作系统选择。以下 v0.5.0 完整包包含 CLI、示例、Skills、Node.js 和评测运行时,完成本文步骤不需要另装运行时。

版本说明与文件校验值 · GitHub 仓库

在下载文件所在的文件夹打开终端,选择对应的操作系统。

macOS · Apple Silicon

终端窗口
tar -xzf promptbeat-0.5.0-darwin-arm64.tar.gz
cd promptbeat-0.5.0-darwin-arm64
./bin/promptbeat --version

macOS · Intel

终端窗口
tar -xzf promptbeat-0.5.0-darwin-x64.tar.gz
cd promptbeat-0.5.0-darwin-x64
./bin/promptbeat --version

Linux

终端窗口
tar -xzf promptbeat-0.5.0-linux-x64.tar.gz
cd promptbeat-0.5.0-linux-x64
./bin/promptbeat --version

Windows PowerShell

终端窗口
Expand-Archive .\promptbeat-0.5.0-windows-x64.zip -DestinationPath .\promptbeat-unpacked
cd .\promptbeat-unpacked\promptbeat-0.5.0-windows-x64
.\bin\promptbeat.cmd --version

后续命令都在这个包目录运行。目录内应有 bin/、examples/、runtime/ 和 promptbeat-skills/。如果 macOS 阻止运行下载的程序,请先查看系统安全提示及组织要求,不要关闭系统级保护。

macOS / Linux

终端窗口
mkdir -p artifacts
./bin/promptbeat validate --config examples/bootstrap/promptbeat.yaml
./bin/promptbeat generate --config examples/bootstrap/promptbeat.yaml --count 5 --output artifacts/cases.json

Windows PowerShell

终端窗口
New-Item -ItemType Directory -Force artifacts | Out-Null
.\bin\promptbeat.cmd validate --config examples\bootstrap\promptbeat.yaml
.\bin\promptbeat.cmd generate --config examples\bootstrap\promptbeat.yaml --count 5 --output artifacts\cases.json

用编辑器打开 artifacts/cases.json。这里是测试输入,不是模型回答或评测分数。--count 5 表示最多五条;种子较少时,实际用例也会更少。本地 generate 不调用被测模型、生成模型或 Judge。

你可以先停在这里。想让编码助手带你完成这些步骤,可以加载 PromptBeat Skill。

实际评测使用 examples/llm-basic/promptbeat.yaml。先阅读该示例的 README、场景和 Provider 配置。项目包含三个角色:攻击生成模型、评判模型,以及你的被测模型。

将下面的占位值替换为自己的本地配置。与 bootstrap 不同,llm-basic 在校验时就需要这些变量;校验通过不代表远端服务或凭据可用。

macOS / Linux

终端窗口
export ATTACKER_MODEL_NAME='<provider:model>'
export ATTACKER_BASE_URL='https://your-provider.example/v1'
export ATTACKER_API_KEY='<set-locally>'
export JUDGE_MODEL_NAME='<provider:model>'
export JUDGE_BASE_URL='https://your-provider.example/v1'
export JUDGE_API_KEY='<set-locally>'
export TARGET_MODEL_NAME='<provider:model>'
export TARGET_BASE_URL='https://your-provider.example/v1'
export TARGET_API_KEY='<set-locally>'
./bin/promptbeat validate --config examples/llm-basic/promptbeat.yaml
./bin/promptbeat run --config examples/llm-basic/promptbeat.yaml --output-dir artifacts/llm-basic/run

Windows PowerShell

终端窗口
$env:ATTACKER_MODEL_NAME='<provider:model>'
$env:ATTACKER_BASE_URL='https://your-provider.example/v1'
$env:ATTACKER_API_KEY='<set-locally>'
$env:JUDGE_MODEL_NAME='<provider:model>'
$env:JUDGE_BASE_URL='https://your-provider.example/v1'
$env:JUDGE_API_KEY='<set-locally>'
$env:TARGET_MODEL_NAME='<provider:model>'
$env:TARGET_BASE_URL='https://your-provider.example/v1'
$env:TARGET_API_KEY='<set-locally>'
.\bin\promptbeat.cmd validate --config examples\llm-basic\promptbeat.yaml
.\bin\promptbeat.cmd run --config examples\llm-basic\promptbeat.yaml --output-dir artifacts\llm-basic\run

run 会按完整流程生成并评测用例,不会把第 3 步的预览 JSON 当作输入。

完整运行成功后,用浏览器打开 artifacts/llm-basic/run/report.html。同目录的 evaluation_result.json 是归一化结果。该目录也会保留评测后端配置与原始产物,具体文件名取决于项目配置的路径。

需要根据已有结果重新生成 HTML 报告时:

macOS / Linux

终端窗口
./bin/promptbeat report --input artifacts/llm-basic/run/evaluation_result.json --output artifacts/llm-basic/run/report.html

Windows PowerShell

终端窗口
.\bin\promptbeat.cmd report --input artifacts\llm-basic\run\evaluation_result.json --output artifacts\llm-basic\run\report.html

仅运行本地预览不会生成报告。如果命令报错,先检查包目录、配置类型和所需环境变量,再决定是否重跑评测。