Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
PDL_universal.app.tar.gz | 2025-06-25 | 57.4 MB | |
PDL_0.7.0_universal.dmg | 2025-06-25 | 57.4 MB | |
PDL_0.7.0_amd64.AppImage | 2025-06-25 | 115.1 MB | |
PDL-0.7.0-1.x86_64.rpm | 2025-06-25 | 30.8 MB | |
PDL_0.7.0_amd64.deb | 2025-06-25 | 30.8 MB | |
PDL_0.7.0_aarch64.AppImage | 2025-06-25 | 113.5 MB | |
PDL-0.7.0-1.aarch64.rpm | 2025-06-25 | 31.1 MB | |
PDL_0.7.0_arm64.deb | 2025-06-25 | 31.1 MB | |
README.md | 2025-06-25 | 12.0 kB | |
Version 0.7.0 source code.tar.gz | 2025-06-25 | 4.8 MB | |
Version 0.7.0 source code.zip | 2025-06-25 | 5.1 MB | |
Totals: 11 Items | 477.1 MB | 1 |
New Features
The main new features are the following and are detailed bellow:
- new retry
attribute to any block,
- new index
field to introduce a loop index in repeat
blocks
- new syntax for types with suport for JSON Schema,
- extract the signature of a function f
with f.signature
,
- loop and sequences with independent contexts,
- support for granite-io processors created in Python.
The retry
field
Any block can now have a retry
field indicating how many times a block should be executed if it encounters a runtime error. For example, a model call can be retried 5 times as follows:
:::yaml
model: replicate/ibm-granite/granite-3.3-8b-instruct
input: How to program "Hello World!"?
retry: 5
The loop index
field
A common pattern in PDL programs is to introduce a variable to index the loop iterations. For example, a loop that turns a list of strings into a list of object with a field name
and id
would be written as follows:
:::yaml
defs:
id: -1
for:
name: [ "Alice", "Nicolas", "Rosa", "Remi" ]
repeat:
defs:
id: ${ id + 1}
data:
name: ${name}
id: ${id}
join:
as: array
With the new index
field that introduced a variable name as loop index, this code can now be simplified as follows:
:::yaml
for:
name: [ "Alice", "Nicolas", "Rosa", "Remi" ]
index: id
repeat:
data:
name: ${name}
id: ${id}
join:
as: array
New type syntax
We extended the type syntax to be able to write directly some JSON Schema as block specification. To do so, the type must contain the type
or enum
field. For example, we can write a model block that checks that the output starts with the letter "A" as follows:
:::yaml
model: ollama/granite3.3:2b
input: Generate a word that starts with the letter "A". Just output the single word.
spec:
type: string
pattern: "^[Aa]"
To make the syntax more uniform, we are using the JSON Schema syntax for the base type. So for example, we are using number
instead of float
for floating point numbers. We discuss the breaking changes below.
Extract function signature
In order to make the use of PDL functions as tools by LLMs easier, we provide the ability to extract the signature of a function f
by executing f.signature
. Here is an example:
:::yaml
defs:
calc:
description: Calculator function
function:
expr:
type: string
description: Arithmetic expression to calculate
return:
lang: python
code: result = ${ expr }
text: ${ calc.signature }
The output is:
{"type": "function", "name": "calc", "description": "Calculator function", "parameters": {"type": "object", "properties": {"expr": {"type": "string", "description": "Arithmetic expression to calculate"}}, "required": ["expr"], "additionalProperties": false}}
An example of tool use is given in search.pdl
.
Independent contexts
Blocks containing lists of blocks (text
, array
, object
, and lastOf
) as well as loops can now be annotated with context: independent
. It means that each sub-block is executed in an independent copy of the context. Therefore, if we execute the following program, both model calls are executed with the same input containing the message Hello
:
:::yaml
lastOf:
- Hello
- context: independent
array:
- model: ollama/granite3.2:2b
- model: ollama/granite3.3:2b
Support for granite-io processors objects
In addition to the ability to call granite-io processors using the lookup mechanism using backend and processors names, it is possible now to use granite-io processors or backends created in Python. Here is an example:
:::yaml
defs:
io_proc:
lang: python
code: |
from granite_io import make_backend, make_io_processor
model_name = "granite3.2:2b"
backend = make_backend("openai", { "model_name": model_name })
result = make_io_processor(model_name, backend=backend)
processor: ${ io_proc }
input: Write an Hello World program in Python.
Breaking Changes
This version of PDL is coming with a large number of breaking changes:
- types syntax,
- granite-io syntax,
- rename max_iterations
into maxIterations
,
- trace format.
Types syntax
As mentioned above, to be consistent with JSON Schema, we renamed the basic types as follows:
- str
-> string
- bool
-> boolean
- int
-> integer
- float
-> number
- obj
-> object
- list
-> array
Moreover, since we can use JSON schema, we removed the old way to put constraints on types. So for example, the following type:
:::yaml
spec: { int: { minimum: 0 } }
must be rewritten:
:::yaml
spec: { type: integer, minimum: 0 }
Finally, the type null
now corresponds to a value of any type. For example, the identity function can be written as follows:
:::yaml
function:
x:
return: ${ x }
Granite-io processors
The structure of the granite-io block changed. Now, the processor
field is required and the definition of io-processor is given has sub-fields of this field. So a block that was defined as follows:
:::yaml
processor:
model: "granite3.2:2b"
backend: openai
input: Hello
is now defined like this:
:::yaml
processor:
type: Granite 3.2
model: "granite3.2:2b"
backend: openai
input: Hello
Loop iteration bound
The syntax to bound the number of iterations of a loop changed. It is now maxIteration
. Here is an example
:::yaml
index: i
repeat: ${ i }
maxIterations: 3
Trace format
The format of the traces generated with the --trace
(-t
) option has changed. Some internal fields like defsite
have changed to pdl__defsite
. It means that traces generated with old version of the interpreter are not compatible with the new version of the UI.
What's Changed
- Fix rag example by fully qualifying import by @esnible in https://github.com/IBM/prompt-declaration-language/pull/930
- Change to sys.path for python code block by @vazirim in https://github.com/IBM/prompt-declaration-language/pull/931
- granite-io hallucination demo example and notebook by @vazirim in https://github.com/IBM/prompt-declaration-language/pull/932
- Add contrib. prompt library by @claudiosv in https://github.com/IBM/prompt-declaration-language/pull/927
- Fixed the bug where pdl.version was not set by @vite-falcon in https://github.com/IBM/prompt-declaration-language/pull/882
- Use granite-io async interface by @mandel in https://github.com/IBM/prompt-declaration-language/pull/936
- chore: bump ui dependences by @starpit in https://github.com/IBM/prompt-declaration-language/pull/939
- independent implementation by @vazirim in https://github.com/IBM/prompt-declaration-language/pull/934
- feat: add a
parse_dict
function topdl_parser
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/943 - feat: specify PDL types in the AST by @mandel in https://github.com/IBM/prompt-declaration-language/pull/942
- PDL Optimizer by @claudiosv in https://github.com/IBM/prompt-declaration-language/pull/941
- Add a new retry feature to
block
by @hirokuni-kitahara in https://github.com/IBM/prompt-declaration-language/pull/824 - feat: extend PDL types with json schema types by @mandel in https://github.com/IBM/prompt-declaration-language/pull/947
- feat: add a
signature
field to closures containing the function signature by @mandel in https://github.com/IBM/prompt-declaration-language/pull/948 - feat: add
index
field torepeat
blocks to name loop index by @mandel in https://github.com/IBM/prompt-declaration-language/pull/950 - Fix for extra fields in messages sent to LLMs by @vazirim in https://github.com/IBM/prompt-declaration-language/pull/952
- dependent/independent context implementation by @vazirim in https://github.com/IBM/prompt-declaration-language/pull/945
- docs: add example of
f.signature
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/955 - fix: remove
defsite
from messages in model inputs by @mandel in https://github.com/IBM/prompt-declaration-language/pull/956 - Introducing Run Examples check in PRs by @jgchn in https://github.com/IBM/prompt-declaration-language/pull/908
- Capturing new results for Run Examples by @jgchn in https://github.com/IBM/prompt-declaration-language/pull/957
- fix: ensure that model inputs are always contexts by @mandel in https://github.com/IBM/prompt-declaration-language/pull/958
- feat: change type syntax by @mandel in https://github.com/IBM/prompt-declaration-language/pull/951
- feat: rename
max_iterations
intomaxIterations
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/961 - fix: unable to set OPENAI_API_BASE for litellm by @starpit in https://github.com/IBM/prompt-declaration-language/pull/962
- docs: AST documentation by @mandel in https://github.com/IBM/prompt-declaration-language/pull/963
- refactor: rename internal field
returns
intoreturn_
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/964 - feat: export
write_trace
inpdl.pdl
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/966 - chore: remove dependency on termcolor types by @mandel in https://github.com/IBM/prompt-declaration-language/pull/967
- fix: trace generation with context by @mandel in https://github.com/IBM/prompt-declaration-language/pull/968
- chore(deps): Update termcolor requirement from ~=2.0 to >=2,<4 by @mandel in https://github.com/IBM/prompt-declaration-language/pull/971
- refactor: make the use of dependent and independent context explicit by @mandel in https://github.com/IBM/prompt-declaration-language/pull/972
- feat: all to pass directly backend or processor objects to granite-io blocks by @mandel in https://github.com/IBM/prompt-declaration-language/pull/973
- fix: typing of pdl_context in notebook extension and ast by @mandel in https://github.com/IBM/prompt-declaration-language/pull/974
- refactor: change granite-io block syntax by @mandel in https://github.com/IBM/prompt-declaration-language/pull/975
- Add a new model to ollama action requirement and update config file by @jgchn in https://github.com/IBM/prompt-declaration-language/pull/959
- feat: add support for deprecated type syntax by @mandel in https://github.com/IBM/prompt-declaration-language/pull/977
- fix: import should yield the result in streaming mode by @mandel in https://github.com/IBM/prompt-declaration-language/pull/979
- refactor: rename message field
defsite
intopdl__defsite
by @mandel in https://github.com/IBM/prompt-declaration-language/pull/965 - refactor: AST and UI cleanup by @mandel in https://github.com/IBM/prompt-declaration-language/pull/984
- tests: disable non-deterministic granite-io tests by @mandel in https://github.com/IBM/prompt-declaration-language/pull/983
- fix: handling of processor type in granite-io by @mandel in https://github.com/IBM/prompt-declaration-language/pull/986
- fix: improve dumping and UI for functions by @mandel in https://github.com/IBM/prompt-declaration-language/pull/988
- docs: link the tutorial to the code by @mandel in https://github.com/IBM/prompt-declaration-language/pull/987
New Contributors
- @hirokuni-kitahara made their first contribution in https://github.com/IBM/prompt-declaration-language/pull/824
Full Changelog: https://github.com/IBM/prompt-declaration-language/compare/v0.6.1...v0.7.0