# PDL

一款 macOS 应用和命令行工具，用于探索和运行以 YAML 编写、可组合 LLM 提示、代码与数据的程序。

> 这是 OpenNavo 上 PDL 页面的 Markdown 版本，内容与网页相同： <https://opennavo.com/zh/apps/pdl>

- **最新版本**: `0.9.3`
- **开发者**: Mandana Vaziri; Louis Mandel; Claudio Spiess; Martin Hirzel
- **主页**: <https://ibm.github.io/prompt-declaration-language/>
- **分类**: [开发工具](https://opennavo.com/zh/categories/developer-tools)
- **安装**: `brew install --cask pdl`
- **近 30 天安装**: 1
- **Homebrew**: Homebrew 仍提供，OpenNavo 已暂停推荐
- **下载地址**: <https://github.com/IBM/prompt-declaration-language/releases/download/v0.9.3/PDL_0.9.3_universal.dmg>
- **SHA-256**: `e01c41cb198f05dec7c3fb08b479ae50ee90e385406c1b95561f55d400bf76d9`
- **附带命令**: pdl

SHA-256 只用来核对下载的文件是否完整，不代表安全认证。

## 安装与卸载内容

```json
[
  {
    "declaration": {
      "app": [
        "PDL.app"
      ],
      "target": "/Applications/PDL.app"
    },
    "phase": "install",
    "sources": [
      "PDL.app"
    ],
    "target": "/Applications/PDL.app",
    "type": "app"
  },
  {
    "declaration": {
      "binary": [
        "$APPDIR/PDL.app/Contents/MacOS/PDL",
        {
          "target": "pdl"
        }
      ],
      "target": "$HOMEBREW_PREFIX/bin/pdl"
    },
    "phase": "install",
    "sources": [
      "$APPDIR/PDL.app/Contents/MacOS/PDL"
    ],
    "target": "$HOMEBREW_PREFIX/bin/pdl",
    "type": "binary"
  },
  {
    "declaration": {
      "zap": [
        {
          "trash": "~/Library/Application Support/PDL"
        }
      ]
    },
    "phase": "cleanup",
    "sources": [],
    "type": "zap"
  }
]
```

## 介绍

PDL（Prompt Declaration Language）提供一种基于声明式 YAML 的方式，用于定义提示的结构，并组合与大型语言模型（LLM）的交互。此 Homebrew cask 会安装 macOS 应用 `PDL.app`，并提供命令行可执行程序 `pdl`。官方项目将该应用称为 Live Explorer，它是用于探索执行轨迹和实时编程的界面。

PDL 程序可以将模型调用与代码及基于规则的逻辑组合起来。该语言支持变量、模板、条件、循环和函数，也支持读取文件或标准输入（包括 JSON 数据）。此外，它支持 Python 代码和 REST API 调用、模型调用输入与输出的类型检查，以及聊天 API 和聊天模板。解释器可以输出程序结果或流式输出对话上下文，也可以生成供 Live Explorer 使用的执行轨迹文件。

运行 `brew install --cask pdl` 可安装 macOS 应用和命令行可执行程序。使用 `pdl <path/to/example.pdl>` 运行程序。项目建议使用支持 YAML 和 JSON Schema 验证的编辑器编写 PDL 文件。项目的解释器安装说明另行使用 `pip install prompt-declaration-language`；文档称已在 macOS 和 Linux 上使用 Python 3.11、3.12 和 3.14 进行测试。调用模型时，PDL 可通过 LiteLLM 使用本地或远程 LLM；所需模型服务以及可能需要的账户或凭据取决于所选服务。除非使用 `--sandbox` 启动解释器，Python 代码会在本地运行；使用该选项需要运行中的 Docker 兼容守护进程。

来源：[PDL 文档](https://ibm.github.io/prompt-declaration-language/) · [Homebrew cask](https://raw.githubusercontent.com/Homebrew/homebrew-cask/HEAD/Casks/p/pdl.rb)

## 系统要求

- 适用于 macOS 27, 26, 15, 14, 13, 12, 11 的版本 · 应用版本: 0.9.3 · Intel · <https://github.com/homebrew/homebrew-cask/blob/HEAD/Casks/p/pdl.rb> · 核查于 2026-12-06
  - <https://github.com/IBM/prompt-declaration-language/releases/download/v0.9.3/PDL_0.9.3_universal.dmg>
  - SHA-256: `e01c41cb198f05dec7c3fb08b479ae50ee90e385406c1b95561f55d400bf76d9`
- 适用于 macOS 27, 26, 15, 14, 13, 12, 11 的版本 · 应用版本: 0.9.3 · Apple 芯片 · <https://github.com/homebrew/homebrew-cask/blob/HEAD/Casks/p/pdl.rb> · 核查于 2026-12-06
  - <https://github.com/IBM/prompt-declaration-language/releases/download/v0.9.3/PDL_0.9.3_universal.dmg>
  - SHA-256: `e01c41cb198f05dec7c3fb08b479ae50ee90e385406c1b95561f55d400bf76d9`

## PDL 的安全事实

这里只列可以核验的事实，并注明来源和日期，不是安全认证。要检查你下载的文件，可以用 OpenNavo 在本机扫描。

- <https://github.com/IBM/prompt-declaration-language> · 是否开源: 是 — <https://github.com/IBM/prompt-declaration-language> · 核查于 2026-11-13

## 卸载

- `brew uninstall --cask pdl`

普通卸载会删除应用本身，设置和缓存会保留。

### 深度清理（可选）

- `brew uninstall --zap --cask pdl`

`--zap` 还会删除 Homebrew 定义里列出的设置、缓存等文件，其中可能有其他应用共用的数据，删除后无法恢复；它也不保证没有任何残留。请先备份需要保留的数据；如要保留设置和缓存，请不要加 `--zap`。

普通卸载会删除应用本身，设置和缓存会保留。

- 文件和文件夹: `~/Library/Application Support/PDL` — <https://github.com/homebrew/homebrew-cask/blob/HEAD/Casks/p/pdl.rb> · 以上条目来自 Homebrew 定义，核查于 2026-12-06；它们只说明定义声明会删除什么，不代表你的 Mac 上都有。

## 最新版本说明

### 0.9.3 (2026-02-26)

新增模型用量和作用域变量、代码块变量选择，以及 Jinja 模板参数。发布说明列出两项不向后兼容的变更。

**功能**

- 将 pdl_usage 和 pdl_scope 加入 PDL 作用域。
- 为 Python 和 Jinja 代码块添加 scope。
- 为 Jinja 代码块添加 parameters。

**兼容性**

- 更改 .signature 生成的函数签名语法。
- 更改聚合器声明和函数的规则重新求值方式。

## 资料与来源

- <https://opennavo.com/zh/apps/pdl>
- <https://opennavo.com/zh/apps/pdl/versions>
- <https://github.com/homebrew/homebrew-cask/blob/HEAD/Casks/p/pdl.rb> · 核查于 2026-12-06
- <https://formulae.brew.sh/cask/pdl>
- <https://github.com/IBM/prompt-declaration-language> · 核查于 2026-11-13
