Skip to content

Commit 0289e4a

Browse files
committed
Merge branch 'main' into pdl-aggregators
2 parents 7411884 + 9d9cbda commit 0289e4a

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

examples/demo/8-tools.pdl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ text:
1313
text: You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
1414
contribute: [context]
1515
- role: tools
16-
text: ${ tools }
16+
content:
17+
text: ${ tools }
1718
contribute: [context]
1819
- "Out of 1400 participants, 400 passed the test. What percentage is that?\n"
1920
- def: actions

examples/demo/9-react.pdl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ text:
3030
text: You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
3131
contribute: [context]
3232
- role: tools
33-
text: ${ tools }
33+
content:
34+
text: ${ tools }
3435
contribute: [context]
3536
- text:
3637
|

examples/react/demo.pdl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ text:
3030
text: You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
3131
contribute: [context]
3232
- role: tools
33-
text: ${ tools }
33+
content:
34+
text: ${ tools }
3435
contribute: [context]
3536
- text:
3637
|

examples/tools/calc.pdl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ text:
1313
text: You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
1414
contribute: [context]
1515
- role: tools
16-
text: ${ tools }
16+
content:
17+
text: ${ tools }
1718
contribute: [context]
1819
- "Out of 1400 participants, 400 passed the test. What percentage is that?\n"
1920
- def: actions

src/pdl/pdl_interpreter.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,12 @@ def process_block(
258258
trace=ErrorBlock(msg=exc.message, pdl__location=loc, program=block),
259259
) from exc
260260
result = PdlConst(v)
261-
stringified_result = lazy_apply(stringify, result)
262261
background = PdlList(
263262
[
264263
PdlDict( # type: ignore
265264
{
266265
"role": state.role,
267-
"content": stringified_result,
266+
"content": result,
268267
"defsite": ".".join(
269268
state.id_stack
270269
), # Warning: defsite for a literal value
@@ -274,7 +273,7 @@ def process_block(
274273
)
275274
trace = DataBlock(
276275
data=expr,
277-
pdl__result=stringified_result,
276+
pdl__result=result,
278277
pdl__timing=PdlTiming(start_nanos=start, end_nanos=time.time_ns()),
279278
pdl__id=".".join(state.id_stack),
280279
)
@@ -482,9 +481,8 @@ def process_block_body(
482481
loc=exc.loc or loc,
483482
trace=ErrorBlock(msg=exc.message, pdl__location=loc, program=block),
484483
) from exc
485-
stringified_result = lazy_apply(stringify, result)
486484
background = PdlList(
487-
[PdlDict({"role": state.role, "content": stringified_result})] # type: ignore
485+
[PdlDict({"role": state.role, "content": result})] # type: ignore
488486
)
489487
trace = block.model_copy()
490488
if state.yield_result:
@@ -499,9 +497,8 @@ def process_block_body(
499497
else:
500498
v, trace = process_expr_of(block, "data", scope, loc)
501499
result = PdlConst(v)
502-
stringified_result = stringify(v)
503500
background = PdlList(
504-
[PdlDict({"role": state.role, "content": stringified_result})] # type: ignore
501+
[PdlDict({"role": state.role, "content": result})] # type: ignore
505502
)
506503
if state.yield_result:
507504
yield_result(result.result(), block.kind)
@@ -1688,9 +1685,8 @@ def process_call_code(
16881685
case "pdl":
16891686
try:
16901687
result = call_pdl(code_s, scope)
1691-
stringified_result = lazy_apply(stringify, result)
16921688
background = PdlList(
1693-
[PdlDict({"role": state.role, "content": stringified_result, "defsite": block.pdl__id})] # type: ignore
1689+
[PdlDict({"role": state.role, "content": result, "defsite": block.pdl__id})] # type: ignore
16941690
)
16951691
except Exception as exc:
16961692
raise PDLRuntimeError(

0 commit comments

Comments
 (0)