开始使用 PromptBeat
下载完整包,无需 API Key 预览本地用例,再接入模型并查看评测报告。
先用本地示例试一下。校验 bootstrap 项目和预览测试用例,不需要模型账号或 API Key。
1. 下载完整包
Section titled “1. 下载完整包”按操作系统选择。以下 v0.5.0 完整包包含 CLI、示例、Skills、Node.js 和评测运行时,完成本文步骤不需要另装运行时。
2. 解压并进入包目录
Section titled “2. 解压并进入包目录”在下载文件所在的文件夹打开终端,选择对应的操作系统。
macOS · Apple Silicon
tar -xzf promptbeat-0.5.0-darwin-arm64.tar.gzcd promptbeat-0.5.0-darwin-arm64./bin/promptbeat --versionmacOS · Intel
tar -xzf promptbeat-0.5.0-darwin-x64.tar.gzcd promptbeat-0.5.0-darwin-x64./bin/promptbeat --versionLinux
tar -xzf promptbeat-0.5.0-linux-x64.tar.gzcd promptbeat-0.5.0-linux-x64./bin/promptbeat --versionWindows PowerShell
Expand-Archive .\promptbeat-0.5.0-windows-x64.zip -DestinationPath .\promptbeat-unpackedcd .\promptbeat-unpacked\promptbeat-0.5.0-windows-x64.\bin\promptbeat.cmd --version后续命令都在这个包目录运行。目录内应有 bin/、examples/、runtime/ 和 promptbeat-skills/。如果 macOS 阻止运行下载的程序,请先查看系统安全提示及组织要求,不要关闭系统级保护。
3. 不调用模型,先预览用例
Section titled “3. 不调用模型,先预览用例”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.jsonWindows 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。
4. 准备好后,接入自己的模型
Section titled “4. 准备好后,接入自己的模型”实际评测使用 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/runWindows 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\runrun 会按完整流程生成并评测用例,不会把第 3 步的预览 JSON 当作输入。
5. 查看结果
Section titled “5. 查看结果”完整运行成功后,用浏览器打开 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.htmlWindows PowerShell
.\bin\promptbeat.cmd report --input artifacts\llm-basic\run\evaluation_result.json --output artifacts\llm-basic\run\report.html仅运行本地预览不会生成报告。如果命令报错,先检查包目录、配置类型和所需环境变量,再决定是否重跑评测。