You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://pypi.python.org/pypi/prompt-declaration-language/)
[](https://bestpractices.coreinfrastructure.org/projects/9672)
14
-
15
3
PDL is a declarative language designed for developers to create reliable, composable LLM prompts and integrate them into software systems. It provides a structured way to specify prompt templates, enforce validation, and compose LLM calls with traditional rule-based systems.
Copy file name to clipboardExpand all lines: docs/README.md
+17-24Lines changed: 17 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ PDL is based on the premise that interactions with an LLM are mainly for the pur
11
11
12
12
PDL provides the following features:
13
13
14
-
- Ability to use any LLM locally or remotely via [LiteLLM](https://www.litellm.ai/), including [IBM's watsonx](https://www.ibm.com/watsonx), as well as the [Granite IO Processor](https://github.com/ibm-granite/granite-io) framework
14
+
- Ability to use any LLM locally or remotely via [LiteLLM](https://www.litellm.ai/)
15
15
- Ability to templatize not only prompts for one LLM call, but also composition of LLMs with tools (code and APIs). Templates can encompass tasks of larger granularity than a single LLM call
16
16
- Control structures: variable definitions and use, conditionals, loops, functions
17
17
- Ability to read from files and stdin, including JSON data
@@ -23,14 +23,14 @@ PDL provides the following features:
23
23
24
24
The PDL interpreter takes a PDL program as input and generates data by executing its instructions (calling out to models, code, etc...).
25
25
26
-
See below for a quick reference, followed by [installation notes](#interpreter_installation) and an [overview](#overview) of the language. A more detailed description of the language features can be found in this [tutorial](https://ibm.github.io/prompt-declaration-language/tutorial).
26
+
See below for a quick reference, followed by [installation notes](#interpreter_installation) and an [overview](#overview) of the language. A more detailed description of the language features can be found in this [tutorial](./tutorial.md).
(See also [PDF version](https://github.com/IBM/prompt-declaration-language/blob/main/docs/assets/pdl_quick_reference.pdf).)
33
+
(See also [PDF version](./assets/pdl_quick_reference.pdf).)
34
34
35
35
36
36
## Interpreter Installation
@@ -56,7 +56,7 @@ brew install pdl
56
56
For other platforms, see installation notes.
57
57
58
58
You can run PDL with LLM models in local using [Ollama](https://ollama.com), or other cloud service.
59
-
See [here](https://ibm.github.io/prompt-declaration-language/tutorial/#using-ollama-models) for
59
+
See [here](./tutorial.md#using-ollama-models) for
60
60
instructions on how to install an Ollama model locally.
61
61
62
62
Most examples in this repository use IBM Granite models on [Ollama](https://ollama.com) and some are on [Replicate](https://replicate.com/). In order to run these examples, you need to create a free account
@@ -80,13 +80,13 @@ pdl <path/to/example.pdl>
80
80
81
81
The folder `examples` contains many examples of PDL programs. They cover a variety of prompting patterns such as CoT, RAG, ReAct, and tool use.
82
82
83
-
We highly recommend to edit PDL programs using an editor that support YAML with JSON Schema validation. For example, you can use VSCode with the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and configure it to use the [PDL schema](https://github.com/IBM/prompt-declaration-language/blob/main/src/pdl/pdl-schema.json). This enables the editor to display error messages when the yaml deviates from the PDL syntax and grammar. It also provides code completion.
84
-
The PDL repository has been configured so that every `*.pdl` file is associated with the PDL grammar JSONSchema (see [settings](https://github.com/IBM/prompt-declaration-language/blob/main/.vscode/settings.json)). You can set up your own VSCode PDL projects similarly using the following `.vscode/settings.json` file:
83
+
We highly recommend to edit PDL programs using an editor that support YAML with JSON Schema validation. For example, you can use VSCode with the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and configure it to use the [PDL schema](https://github.com/anonymous/prompt-declaration-language/blob/main/src/pdl/pdl-schema.json). This enables the editor to display error messages when the yaml deviates from the PDL syntax and grammar. It also provides code completion.
84
+
The PDL repository has been configured so that every `*.pdl` file is associated with the PDL grammar JSONSchema. You can set up your own VSCode PDL projects similarly using the following `.vscode/settings.json` file:
@@ -106,7 +106,7 @@ We can pass initial data to the interpreter to populate variables used in a PDL
106
106
pdl --data <JSON-or-YAML-data> <my-example>
107
107
```
108
108
109
-
For an example, see [file](https://github.com/IBM/prompt-declaration-language//blob/main/examples/tutorial/free_variables.pdl).
109
+
For an example, see [file](../examples/tutorial/free_variables.pdl).
110
110
111
111
This can also be done by passing a JSON or YAML file:
112
112
@@ -209,13 +209,13 @@ The PDL interpreter can also stream the background conversation instead of the r
209
209
pdl --stream context examples/hello/hello.pdl
210
210
```
211
211
212
-
See the [tutorial](https://ibm.github.io/prompt-declaration-language/tutorial) for more information about the conversational background context and how to use roles and chat templates.
212
+
See the [tutorial](./tutorial.md) for more information about the conversational background context and how to use roles and chat templates.
213
213
214
214
215
215
Consider now an example from AI for code, where we want to build a prompt template for code explanation. We have a JSON file as input
216
216
containing the source code and some information regarding the repository where it came from.
217
217
218
-
For example, given the data in this JSON [file](https://github.com/IBM/prompt-declaration-language/blob/main/examples/code/data.yaml):
218
+
For example, given the data in this JSON [file](../examples/code/data.yaml):
219
219
```yaml
220
220
source_code:
221
221
|
@@ -259,7 +259,7 @@ public static Map<String, String> deserializeOffsetMap(String lastSourceOffset)
259
259
}
260
260
```
261
261
262
-
In PDL, this would be expressed as follows (see [file](https://github.com/IBM/prompt-declaration-language/blob/main/examples/code/code.pdl)):
262
+
In PDL, this would be expressed as follows (see [file](../examples/code/code.pdl)):
263
263
264
264
```yaml
265
265
description: Code explanation example
@@ -310,7 +310,7 @@ public static Map<String, String> deserializeOffsetMap(String lastSourceOffset)
310
310
The code is a Java method that takes a string `lastSourceOffset` as input and returns a `Map<String, String>`. The method uses the Jackson library to deserialize the JSON-formatted string into a map. If the input string is null or empty, an empty HashMap is returned. Otherwise, the string is deserialized into a Map using the `JSON_MAPPER.readValue()` method.
311
311
```
312
312
313
-
Notice that in PDL variables are used to templatize any entity in the document, not just textual prompts to LLMs. We can add a block to this document to evaluate the quality of the output using a similarity metric with respect to our [ground truth](https://github.com/IBM/prompt-declaration-language/blob/main/examples/code/ground_truth.txt). See [file](https://github.com/IBM/prompt-declaration-language/blob/main/examples/code/code-eval.pdl):
313
+
Notice that in PDL variables are used to templatize any entity in the document, not just textual prompts to LLMs. We can add a block to this document to evaluate the quality of the output using a similarity metric with respect to our [ground truth](../examples/code/ground_truth.txt). See [file](../examples/code/code-eval.pdl):
314
314
315
315
```yaml
316
316
description: Code explanation example
@@ -438,7 +438,7 @@ The output of this program is the corresponding serialized JSON object, with the
438
438
439
439
## PDL Language Tutorial
440
440
441
-
See [PDL Language Tutorial](https://ibm.github.io/prompt-declaration-language/tutorial)
441
+
See [PDL Language Tutorial](./tutorial.md)
442
442
443
443
## Debugging Tools
444
444
@@ -451,7 +451,7 @@ To produce an execution trace consumable by the Live Explorer, you can run the i
451
451
pdl <my-example> --trace <my-example_trace.json>
452
452
```
453
453
454
-
This produces an additional file named `my-example_trace.json` that can be uploaded to the [Live Explorer](https://ibm.github.io/prompt-declaration-language/viewer/) visualizer tool. The Live Explorer shows a timeline of execution and a tile for every block. By clicking on a tile, the user can discover more information such as input/context/output for LLM calls. It also provides the ability to re-run a block for eventual live programming.
454
+
This produces an additional file named `my-example_trace.json` that can be uploaded to the [Live Explorer](./viewer.md) visualizer tool. The Live Explorer shows a timeline of execution and a tile for every block. By clicking on a tile, the user can discover more information such as input/context/output for LLM calls. It also provides the ability to re-run a block for eventual live programming.
455
455
456
456
This is similar to a spreadsheet for tabular data, where data is in the forefront and the user can inspect the formula that generates the data in each cell. In the Live Explorer, cells are not uniform but can take arbitrary extents. Clicking on them similarly reveals the part of the code that produced them.
457
457
@@ -460,9 +460,9 @@ This is similar to a spreadsheet for tabular data, where data is in the forefron
460
460
PDL includes experimental support for gathering trace telemetry. This can
461
461
be used for debugging or performance analysis, and to see the shape of prompts sent by LiteLLM to models.
462
462
463
-
For more information see [here](https://github.com/IBM/prompt-declaration-language/blob/main/docs/telemetry.md).
Copy file name to clipboardExpand all lines: docs/contrib.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@ You can report issues or open a pull request (PR) to suggest changes.
6
6
7
7
To report an issue, or to suggest an idea for a change that you haven't had time to write-up yet:
8
8
9
-
1.[Review existing issues](https://github.com/IBM/prompt-declaration-language/issues) to see if a similar issue has been opened or discussed.
9
+
1.[Review existing issues](https://github.com/anonymous/prompt-declaration-language/issues) to see if a similar issue has been opened or discussed.
10
10
11
11
2.[Open an
12
-
issue](https://github.com/IBM/prompt-declaration-language/issues/new). Be sure to include any helpful information, such as version used, error messages, or logs that you might have.
12
+
issue](https://github.com/anonymous/prompt-declaration-language/issues/new). Be sure to include any helpful information, such as version used, error messages, or logs that you might have.
13
13
14
14
15
-
To report vulnerabilities privately, you can contact the authors by email (see [pyproject.toml](https://github.com/IBM/prompt-declaration-language/blob/main/pyproject.toml)).
15
+
To report vulnerabilities privately, you can contact the authors by email (see [pyproject.toml](https://github.com/anonymous/prompt-declaration-language/blob/main/pyproject.toml)).
16
16
17
17
## Suggesting a change
18
18
19
-
To suggest a change to this repository, [submit a pull request](https://github.com/IBM/prompt-declaration-language/pulls) with the complete set of changes that you want to suggest. Before creating a PR, make sure that your changes pass all of the tests and add tests for new features.
19
+
To suggest a change to this repository, [submit a pull request](https://github.com/anonymous/prompt-declaration-language/pulls) with the complete set of changes that you want to suggest. Before creating a PR, make sure that your changes pass all of the tests and add tests for new features.
20
20
21
21
The test suite can be executed with the following command in the top-level folder:
22
22
```
@@ -34,7 +34,7 @@ pre-commit run --all-files
34
34
35
35
Follow the following instructions to set up a dev environment to get started with contributing to PDL.
36
36
37
-
1. Create a fork of https://github.com/IBM/prompt-declaration-language
37
+
1. Create a fork of https://github.com/anonymous/prompt-declaration-language
38
38
2. Clone your fork
39
39
3. Set up a Python virtual environment and install dependencies
0 commit comments