Skip to content

Commit c30472e

Browse files
authored
Bug fix for lazy value when passing a pdl_context to a function (#546)
Signed-off-by: Mandana Vaziri <[email protected]>
1 parent c935e18 commit c30472e

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
description: Hello world with function definition and call
2+
text:
3+
- def: hello
4+
function:
5+
name: str
6+
return:
7+
text:
8+
- Hello ${ name }!
9+
- model: ollama_chat/granite3-dense:8b
10+
- call: ${ hello }
11+
args:
12+
name: World
13+
pdl_context: []

examples/react/react_call.pdl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
description: Wikipedia example using the react_fun function definition
22
text:
3-
- include: ./react_fun.pdl
4-
- call: ${ react }
3+
- import: react_fun
4+
def: lib
5+
- call: ${ lib.react }
56
args:
67
question: How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025.
78
model: replicate/ibm-granite/granite-3.1-8b-instruct

src/pdl/pdl_interpreter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,8 @@ def process_call(
15361536
loc=args_loc,
15371537
trace=block.model_copy(),
15381538
)
1539+
if "pdl_context" in args:
1540+
args["pdl_context"] = PdlList(args["pdl_context"])
15391541
f_body = closure.returns
15401542
f_scope = (
15411543
(closure.scope or PdlDict({}))

0 commit comments

Comments
 (0)