Version 0.7.0 #989
mandel
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
New Features
The main new features are the following and are detailed bellow:
retry
attribute to any block,index
field to introduce a loop index inrepeat
blocksf
withf.signature
,The
retry
fieldAny 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:The loop
index
fieldA 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
andid
would be written as follows:With the new
index
field that introduced a variable name as loop index, this code can now be simplified as follows: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
orenum
field. For example, we can write a model block that checks that the output starts with the letter "A" as follows: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 offloat
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 executingf.signature
. Here is an example:The output is:
An example of tool use is given in
search.pdl
.Independent contexts
Blocks containing lists of blocks (
text
,array
,object
, andlastOf
) as well as loops can now be annotated withcontext: 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 messageHello
: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:
Breaking Changes
This version of PDL is coming with a large number of breaking changes:
max_iterations
intomaxIterations
,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:
must be rewritten:
Finally, the type
null
now corresponds to a value of any type. For example, the identity function can be written as follows: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:is now defined like this:
Loop iteration bound
The syntax to bound the number of iterations of a loop changed. It is now
maxIteration
. Here is an exampleTrace format
The format of the traces generated with the
--trace
(-t
) option has changed. Some internal fields likedefsite
have changed topdl__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
parse_dict
function topdl_parser
by @mandel in feat: add aparse_dict
function topdl_parser
#943block
by @hirokuni-kitahara in Add a new retry feature toblock
#824signature
field to closures containing the function signature by @mandel in feat: add asignature
field to closures containing the function signature #948index
field torepeat
blocks to name loop index by @mandel in feat: addindex
field torepeat
blocks to name loop index #950f.signature
by @mandel in docs: add example off.signature
#955defsite
from messages in model inputs by @mandel in fix: removedefsite
from messages in model inputs #956max_iterations
intomaxIterations
by @mandel in feat: renamemax_iterations
intomaxIterations
#961returns
intoreturn_
by @mandel in refactor: rename internal fieldreturns
intoreturn_
#964write_trace
inpdl.pdl
by @mandel in feat: exportwrite_trace
inpdl.pdl
#966defsite
intopdl__defsite
by @mandel in refactor: rename message fielddefsite
intopdl__defsite
#965New Contributors
block
#824Full Changelog: v0.6.1...v0.7.0
This discussion was created from the release Version 0.7.0.
Beta Was this translation helpful? Give feedback.
All reactions