docs: make Chinese README the default
CI / CI Config (push) Waiting to run
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Blocked by required conditions
CI / Build on Node ${{ matrix.node }} (push) Blocked by required conditions
CI / Style Check (push) Waiting to run
CI / Code Scan Action (push) Waiting to run
CI / Run Integration Tests (push) Waiting to run
CI / Run Smoke Tests (push) Waiting to run
CI / Shell Format Check (push) Waiting to run
CI / Go Tests (push) Waiting to run
CI / Generate Assets (push) Waiting to run
CI / Check Python (3.14) (push) Waiting to run
CI / Check Python (3.9) (push) Waiting to run
CI / Build Docs (push) Waiting to run
CI / Site tests (push) Waiting to run
CI / webui tests (push) Waiting to run
CI / GitHub Actions Lint (push) Waiting to run
CI / Check Ruby (3.0) (push) Waiting to run
release-please / release-please (push) Waiting to run
release-please / build (push) Blocked by required conditions
CI / Check Ruby (3.4) (push) Waiting to run
CI / Share Test (push) Waiting to run
CI / Redteam (Production API) (push) Waiting to run
CI / Redteam (Staging API) (push) Waiting to run
release-please / publish-npm (push) Blocked by required conditions
release-please / publish-npm-backfill (push) Waiting to run
release-please / docker (push) Blocked by required conditions
release-please / publish-code-scan-action (push) Blocked by required conditions
release-please / attest-code-scan-action (push) Blocked by required conditions

This commit is contained in:
wehub-resource-sync
2026-07-13 10:35:19 +00:00
parent 955943dd3d
commit 4b66d896fe
+50 -44
View File
@@ -1,4 +1,10 @@
# Promptfoo: LLM evals & red teaming
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/promptfoo/promptfoo) · [上游 README](https://github.com/promptfoo/promptfoo/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
# PromptfooLLM 评估与红队测试
<p align="center">
<a href="https://npmjs.com/package/promptfoo"><img src="https://img.shields.io/npm/v/promptfoo" alt="npm"></a>
@@ -9,38 +15,38 @@
</p>
<p align="center">
<code>promptfoo</code> is a CLI and library for evaluating and red-teaming LLM apps. Stop the trial-and-error approach - start shipping secure, reliable AI apps.
<code>promptfoo</code> 是一款用于评估 LLM 应用并进行红队测试(red teaming)的 CLI 与库。告别试错式开发——开始交付安全、可靠的 AI 应用。
</p>
<p align="center">
<a href="https://www.promptfoo.dev">Website</a> ·
<a href="https://www.promptfoo.dev/docs/getting-started/">Getting Started</a> ·
<a href="https://www.promptfoo.dev/docs/red-team/">Red Teaming</a> ·
<a href="https://www.promptfoo.dev/docs/">Documentation</a> ·
<a href="https://www.promptfoo.dev">官网</a> ·
<a href="https://www.promptfoo.dev/docs/getting-started/">快速入门</a> ·
<a href="https://www.promptfoo.dev/docs/red-team/">红队测试</a> ·
<a href="https://www.promptfoo.dev/docs/">文档</a> ·
<a href="https://discord.gg/promptfoo">Discord</a>
</p>
> Promptfoo is now part of OpenAI. Promptfoo remains open source and MIT licensed. Read the [company update](https://www.promptfoo.dev/blog/promptfoo-joining-openai/).
> Promptfoo 现已加入 OpenAIPromptfoo 仍保持开源并以 MIT 许可证发布。阅读[公司公告](https://www.promptfoo.dev/blog/promptfoo-joining-openai/).
## Quick Start
## 快速入门
Requires [Node.js](https://nodejs.org/en/download) `^20.20.0` or `>=22.22.0` for npm and npx usage.
[Node.js 20 support ends July 30, 2026 at 00:00 UTC](https://www.promptfoo.dev/docs/installation/#nodejs-runtime-support); upgrade to Node.js 24 LTS before updating promptfoo at or after the cutoff.
需要 [Node.js](https://nodejs.org/en/download) `^20.20.0` `>=22.22.0` 才能使用 npm npx
[Node.js 20 支持将于 UTC 时间 2026 年 7 月 30 日 00:00 结束](https://www.promptfoo.dev/docs/installation/#nodejs-runtime-support); 在截止日期当日或之后更新 promptfoo 之前,请升级到 Node.js 24 LTS。
```sh
npm install -g promptfoo
promptfoo init --example getting-started
```
Also available via `brew install promptfoo` and `pip install promptfoo`. You can also use `npx promptfoo@latest` to run any command without installing.
也可通过 `brew install promptfoo` `pip install promptfoo` 安装。你还可以使用 `npx promptfoo@latest` 在不安装的情况下运行任意命令。
Most LLM providers require an API key. Set yours as an environment variable:
大多数 LLM 提供商都需要 API 密钥。请将你的密钥设置为环境变量:
```sh
export OPENAI_API_KEY=sk-abc123
```
Once you're in the example directory, run an eval and view results:
进入示例目录后,运行评估并查看结果:
```sh
cd getting-started
@@ -48,53 +54,53 @@ promptfoo eval
promptfoo view
```
See [Getting Started](https://www.promptfoo.dev/docs/getting-started/) (evals) or [Red Teaming](https://www.promptfoo.dev/docs/red-team/) (vulnerability scanning) for more.
详见[快速入门](https://www.promptfoo.dev/docs/getting-started/)(评估)或[红队测试](https://www.promptfoo.dev/docs/red-team/)(漏洞扫描)。
## What can you do with Promptfoo?
## 你可以用 Promptfoo 做什么?
- **Test your prompts and models** with [automated evaluations](https://www.promptfoo.dev/docs/getting-started/)
- **Secure your LLM apps** with [red teaming](https://www.promptfoo.dev/docs/red-team/) and vulnerability scanning
- **Compare models** side-by-side (OpenAI, Anthropic, Azure, Bedrock, Ollama, and [more](https://www.promptfoo.dev/docs/providers/))
- **Automate checks** in [CI/CD](https://www.promptfoo.dev/docs/integrations/ci-cd/)
- **Review pull requests** for LLM-related security and compliance issues with [code scanning](https://www.promptfoo.dev/docs/code-scanning/)
- **Share results** with your team
- 通过[自动化评估](https://www.promptfoo.dev/docs/getting-started/) **测试你的提示词和模型**
- 通过[红队测试](https://www.promptfoo.dev/docs/red-team/) 与漏洞扫描**保护你的 LLM 应用**
- **并排比较模型**OpenAIAnthropicAzureBedrockOllama 及[更多](https://www.promptfoo.dev/docs/providers/))
- [CI/CD](https://www.promptfoo.dev/docs/integrations/ci-cd/) 中**自动化检查**
- 通过[代码扫描](https://www.promptfoo.dev/docs/code-scanning/) **审查拉取请求**中的 LLM 相关安全与合规问题
- 与团队**共享结果**
Here's what it looks like in action:
实际效果如下:
<img src="site/static/img/claude-vs-gpt-example@2x.png" alt="prompt evaluation matrix - web viewer" width="700">
<img src="site/static/img/claude-vs-gpt-example@2x.png" alt="提示词评估矩阵 - Web 查看器" width="700">
It works on the command line too:
命令行中同样可用:
<img src="https://www.promptfoo.dev/img/docs/self-grading.gif" alt="promptfoo command line" width="700">
<img src="https://www.promptfoo.dev/img/docs/self-grading.gif" alt="promptfoo 命令行" width="700">
It also can generate [security vulnerability reports](https://www.promptfoo.dev/docs/red-team/):
它还可以生成[安全漏洞报告](https://www.promptfoo.dev/docs/red-team/):
<img src="https://www.promptfoo.dev/img/redteam-dashboard@2x.jpg" alt="gen ai red team" width="700">
## Why Promptfoo?
## 为什么选择 Promptfoo
- **Developer-first**: Fast, with features like live reload and caching
- **Private**: LLM evals run 100% locally - your prompts never leave your machine
- **Flexible**: Works with any LLM API or programming language
- **Battle-tested**: Powers LLM apps serving 10M+ users in production
- **Data-driven**: Make decisions based on metrics, not gut feel
- **Open source**: MIT licensed, with an active community
- **开发者优先**:速度快,支持实时重载(live reload)和缓存等功能
- **私密**:LLM 评估 100% 在本地运行——你的提示词永远不会离开你的机器
- **灵活**:适用于任何 LLM API 或编程语言
- **久经实战**:为生产环境中服务 1000 万+ 用户的 LLM 应用提供支持
- **数据驱动**:基于指标而非直觉做决策
- **开源**:MIT 许可证,拥有活跃的社区
## Learn More
## 了解更多
- [Getting Started](https://www.promptfoo.dev/docs/getting-started/)
- [Full Documentation](https://www.promptfoo.dev/docs/intro/)
- [Red Teaming Guide](https://www.promptfoo.dev/docs/red-team/)
- [CLI Usage](https://www.promptfoo.dev/docs/usage/command-line/)
- [Node.js Package](https://www.promptfoo.dev/docs/usage/node-package/)
- [Supported Models](https://www.promptfoo.dev/docs/providers/)
- [Code Scanning Guide](https://www.promptfoo.dev/docs/code-scanning/)
- [快速入门](https://www.promptfoo.dev/docs/getting-started/)
- [完整文档](https://www.promptfoo.dev/docs/intro/)
- [红队测试指南](https://www.promptfoo.dev/docs/red-team/)
- [CLI 用法](https://www.promptfoo.dev/docs/usage/command-line/)
- [Node.js ](https://www.promptfoo.dev/docs/usage/node-package/)
- [支持的模型](https://www.promptfoo.dev/docs/providers/)
- [代码扫描指南](https://www.promptfoo.dev/docs/code-scanning/)
## Contributing
## 贡献
We welcome contributions! Check out our [contributing guide](https://www.promptfoo.dev/docs/contributing/) to get started.
欢迎贡献!请查看我们的[贡献指南](https://www.promptfoo.dev/docs/contributing/) 以开始参与。
Join our [Discord community](https://discord.gg/promptfoo) for help and discussion.
加入我们的 [Discord 社区](https://discord.gg/promptfoo) 获取帮助与参与讨论。
<a href="https://github.com/promptfoo/promptfoo/graphs/contributors">
<img src="https://contrib.rocks/image?repo=promptfoo/promptfoo" />