Skip to content

Releases: IBM/prompt-declaration-language

Version 0.7.1

30 Jun 15:19
v0.7.1
0e12c98
Compare
Choose a tag to compare

What's Changed

  • refactor: make the event loop thread part of the interpreter state by @mandel in #990
  • fix: contribute directly a value to the context by @mandel in #991

Full Changelog: v0.7.0...v0.7.1

Version 0.7.0

25 Jun 13:24
v0.7.0
db6394c
Compare
Choose a tag to compare

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:

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:

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:

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:

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:

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:

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:

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:

spec: { int: { minimum: 0 } }

must be rewritten:

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:

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:

processor: 
model: "granite3.2:2b"
backend: openai
input: Hello

is now defined like this:

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

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

Read more

Version 0.6.2

03 Jun 14:39
v0.6.2
Compare
Choose a tag to compare

What's Changed

  • Fix rag example by fully qualifying import by @esnible in #930
  • Change to sys.path for python code block by @vazirim in #931
  • granite-io hallucination demo example and notebook by @vazirim in #932
  • Add contrib. prompt library by @claudiosv in #927
  • Fixed the bug where pdl.version was not set by @vite-falcon in #882
  • feat: add a parse_dict function to pdl_parser by @mandel in #943
  • feat: specify PDL types in the AST by @mandel in #942
  • chore(deps): Update granite-io requirement from <0.4,>=0.2 to >=0.2,<0.5 by @dependabot in #946
  • chore(deps): Update faiss-cpu requirement from ~=1.10.0 to >=1.10,<1.12 by @dependabot in #940
  • Fix for extra fields in messages sent to LLMs by @vazirim in #952

Full Changelog: v0.6.1...v0.6.2

Version 0.6.1

18 Apr 19:13
7f2246b
Compare
Choose a tag to compare

What's Changed

  • feat: update rust python support to pull in python stdlib by @starpit in #877
  • feat: port rust model pull logic to use rust AST by @starpit in #875
  • fix: avoid openssl in rust app for now by @starpit in #880
  • gsm8k multi-plan, tree-of-thought, tree-of-thought with few shots by @vazirim in #881
  • feat: rust interpreter support for modelResponse, ollama-rs tooling calling, and no-stream by @starpit in #883
  • chore: minor code cleanups to rust interpreter by @starpit in #884
  • test: update github action rust interpreter test to remove ollama pull by @starpit in #885
  • fix: add kind tags to rust ast blocks by @starpit in #887
  • fix: update rust interpreter to avoid global emit/scope state by @starpit in #888
  • fix: rust pull logic may not always pull by @starpit in #889
  • feat: remove tauri cli support for running python interpreter by @starpit in #890
  • chore: bump rust dependencies to resolve alert by @starpit in #893
  • test: tauri github actions test should apt install the deb by @starpit in #892
  • feat: support for --data and --data-file in rust interpreter by @starpit in #894
  • fix: begin phasing in Metadata (common defs, etc. attrs) into rust AST by @starpit in #895
  • chore: update granite-io dependency by @mandel in #896
  • refactor: move def attr into Metadata (rust interpreter) by @starpit in #897
  • feat: introduce Expr typing and apply it to IfBlock.condition by @starpit in #899
  • feat: update rust Call AST to use Expr for condition attr by @starpit in #901
  • chore: bump to rust 2024 edition by @starpit in #902
  • feat: continue to flesh out block metadata structure in rust by @starpit in #898
  • refactor: add metadata attr to remaining rust block asts by @starpit in #903
  • feat: update rust Repeat AST to use Expr for for attr by @mandel in #904
  • refactor: introduce Advanced enum to rust AST by @starpit in #906
  • refactor: refactor rust ast to place metadata in common struct by @starpit in #909
  • fix: improve deserialization of python-generated model block traces by @starpit in #910
  • fix: in rust ast, allow ModelBlock model to be an expr by @starpit in #911
  • feat: initial pdl__id and --trace support for rust interpreter by @starpit in #912
  • fix: update rust interpreter to create Data blocks for expr eval, and model_input trace field by @starpit in #914
  • fix: populate trace context field in rust interpreter by @starpit in #915
  • Update stop sequences in parameters by @jgchn in #861
  • refactor: extract platform-generic logic from run_ollama_model() handler by @starpit in #916
  • fix: rust interpreter was not handling pdl__context for re-runs of traces by @starpit in #917
  • feat: improve support for importing stdlib in python code blocks by @starpit in #918
  • skeleton-of-thought example by @vazirim in #919
  • Bump litellm and openai versions by @vazirim in #920
  • fix: improve support for rust interpreter python imports from venv by @starpit in #922
  • chore: bump tauri and npm dependencies by @starpit in #923
  • chore: bump ui to 0.6.1 by @starpit in #921

Full Changelog: v0.6.0...v0.6.1

Version 0.6.0

08 Apr 14:23
v0.6.0
79b9bf7
Compare
Choose a tag to compare

This new release has two major changes:

  • pdl-lint, a linter for PDL programs (thanks to @vite-falcon!)
  • mesages in the context with the same role are not automatically merged anymore.

For example, the following program generates 3 messages:

lastOf:
  - role: user
    text:
      - hello
      - "\n"
      - world
  - ${pdl_context}

result:

[{"role": "user", "content": "hello", "defsite": "lastOf.text.0"}, {"role": "user", "content": "\n", "defsite": "lastOf.text.1"}, {"role": "user", "content": "world", "defsite": "lastOf.text.2"}]

To generate only one message, you have to use a message block:

lastOf:
  - role: user
    content:
      text:
        - hello
        - "\n"
        - world
  - ${pdl_context}

result

[{"role": "user", "content": "hello\nworld", "defsite": "lastOf.message"}]

What's Changed

  • Switch to granite-io version 0.2 by @mandel in #818
  • feat: update beeai compiler to support compiling directly from python source by @starpit in #834
  • Examples restructuring, tutorial changes by @vazirim in #836
  • Bug fixes for setting default parameters by @vazirim in #838
  • fix: pdl view trace.json fixes by @starpit in #843
  • fix: Bug in pdl_schema_error_analyzer that raises exception during analysis by @vite-falcon in #851
  • Clean up run examples and automate result updating via GH Actions by @jgchn in #853
  • feat: do not merge messages with same role by @mandel in #846
  • fixes to react examples by @vazirim in #859
  • feat: message blocks contribute the message instead of the content to the context by @mandel in #862
  • feat: do not stringify messages content by @mandel in #858
  • feat: rust interpreter by @starpit in #857
  • gsm8k plan with few-shots by @vazirim in #870
  • feat: add pdl-lint tool that can be configured via pyproject.toml by @vite-falcon in #864

New Contributors

Full Changelog: v0.5.1...v0.6.0

Version 0.5.1

26 Mar 03:26
v0.5.1
abd6233
Compare
Choose a tag to compare

What's Changed

  • Fix parsing of localized expressions by @mandel in #804
  • fix: update ui to support pulling interpreter from local dir by @starpit in #807
  • fix: interpreter squashes PdlRuntimeErrors by @starpit in #800
  • fix: interpreter fails when passed parameters with null/None values by @starpit in #809
  • Rename expr field of LocalizedExpression into pdl__expr by @mandel in #806
  • feat: compile bee to pdl by @starpit in #817
  • fix: rerun in ui bombs by @starpit in #819
  • fix: async model call prints should only occur if PDL_VERBOSE_ASYNC env is set by @starpit in #820
  • fix: skip litellm 1.63.14 by @starpit in #827
  • fix: pin openai==1.61.0 pip due to breaking change on their side by @starpit in #829

Full Changelog: v0.5.0...v0.5.1

Version 0.5.0

19 Mar 03:26
v0.5.0
d7ea0bb
Compare
Choose a tag to compare

What's Changed

  • feat: add model token usage stats to trace by @starpit in #762
  • feat: add support for CodeBlocks with argv by @starpit in #756
  • feat: add Usage tab to detail drawer for model blocks by @starpit in #778
  • Systematically used localized expressions in the trace and add pdl__result in them by @mandel in #760
  • feat: add Result tab to detail drawer by @starpit in #782
  • doc: update readme ui screenshot to show usage metrics by @starpit in #793
  • Copy the schema on the website by @mandel in #797

Full Changelog: v0.4.2...v0.5.0

Version 0.4.2

16 Mar 02:37
v0.4.2
3fb8e8b
Compare
Choose a tag to compare

What's Changed

  • feat: in UI allow pty execution to be canceled by @starpit in #673
  • feat: switch ui tile run menu to split action dropdown by @starpit in #675
  • default parameters for ollama_chat models by @vazirim in #689
  • Change examples to ollama_chat by @jgchn in #691
  • Grade School Math example by @esnible in #694
  • Docstrings and examples for PDL concepts by @esnible in #693
  • feat: ui temperature stability by @starpit in #697
  • feat: add Pagination to UI by @starpit in #704
  • demo hallucination trace by @vazirim in #705
  • Structured decoding bug fix for watsonx, ollama + traceback for python code blocks by @vazirim in #708
  • feat: interpreter should report (stderr) call start/end and timing by @starpit in #711
  • feat: update interpreter to print out model response messages in async mode by @starpit in #717
  • Update parse_str interface by @mandel in #741
  • Support dev version of granite-io by @mandel in #742
  • feat: pull models in rust by @starpit in #743
  • feat: update auto-pull logic to run in parallel with pip install by @starpit in #744
  • feat: use shasum as cache key for venv by @starpit in #748
  • feat: add gsm8k demo to ui (demo9) by @starpit in #753
  • Contributed values are expressions by @mandel in #754
  • Use ${ pdl_context } as default value for the input field of a model block by @mandel in #757
  • added litellm param to ignore structure decoding param in tools example by @vazirim in #750
  • gsm8k with planning by @vazirim in #761

Full Changelog: v0.4.1...v0.4.2

Version 0.4.1

01 Mar 05:16
cb8e289
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.4.0...v0.4.1

Version 0.4.0

01 Mar 04:51
e2e4efb
Compare
Choose a tag to compare

What's Changed

  • gsm8k examples and results by @vazirim in #322
  • feat: in react ui Context tab, use breadcrumb ui to link to def site by @starpit in #380
  • Add json-repair by @claudiosv in #279
  • feat: in react ui, add Masonry view to replace Transcript view by @starpit in #395
  • Asynchronous LLMs calls by @mandel in #284
  • feat: in react UI, add Run button to support re-running program by @starpit in #431
  • Add a max_iterations field to the repeat/until loop (and make until optional) and remove repeat/num_iterations loops. by @mandel in #434
  • Granite 3.1 chat template fix by @vazirim in #433
  • feat: add homebrew formula by @starpit in #447
  • Unify repeat and for loops and add while by @mandel in #444
  • feat: in react ui re-enable Replay/Run button and functionality by @starpit in #451
  • intrinsics hallucination example by @vazirim in #464
  • doc: update react ui build for production documentation by @starpit in #476
  • feat: syntax highlight code in markdown blocks by @starpit in #480
  • feat: in react ui, use pty for Run by @starpit in #492
  • feat: add final result 'output of program' to react ui masonry by @starpit in #497
  • removed old viewer by @vazirim in #510
  • feat: add Platform field to model detail Summary tab by @starpit in #516
  • modules implementation by @vazirim in #507
  • New RAG example by @esnible in #427
  • feat: initial support for showing structured model responses in detail ui by @starpit in #527
  • updated PDL quick reference by @hirzel in #545
  • feat: add opengraph meta info to ui by @starpit in #549
  • Migrate some examples from Replicate to Ollama by @jgchn in #522
  • Added Granite 3.2 chat template, template that works with ollama by @vazirim in #557
  • model blocks can use the granite-io platform by @mandel in #529
  • Join loop iterations as objects by @mandel in #580
  • Add flexibility on the case of the values for the fields lang, parser, and mode by @mandel in #612
  • Incorrect endpoint in Telemetry doc by @esnible in #619
  • Deploy Ollama to run examples by @jgchn in #629

New Contributors

Full Changelog: v0.3.0...v0.4.0