Skip to content

Commit 5ac25d7

Browse files
authored
tests: update calc example to use .signature (#1067)
Signed-off-by: Louis Mandel <[email protected]>
1 parent 842cb1e commit 5ac25d7

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

examples/tools/calc.pdl

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
description: tool use
22
defs:
3+
calc:
4+
description: Calculator function
5+
function:
6+
expr:
7+
type: string
8+
description: Arithmetic expression to calculate
9+
return:
10+
lang: python
11+
code: result = ${ expr }
312
tools:
4-
data:
5-
- name: calc
6-
description: Calculator function
7-
arguments:
8-
expr:
9-
type: string
10-
description: Arithmetic expression to calculate
13+
array:
14+
- ${ calc.signature }
1115
text:
1216
- role: system
13-
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.
17+
text: You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools.
1418
contribute: [context]
1519
- role: tools
1620
content:
@@ -21,11 +25,11 @@ text:
2125
model: ollama_chat/granite3.2:8b
2226
parser: json
2327
spec: [{ name: string, arguments: { expr: string }}]
24-
parameters:
25-
drop_params: true # This is needed because the model does not support structured decoding. It directs LiteLLM to ignore parameters sent for structured decoding.
2628
- "\n"
27-
- if: ${ actions[0].name == "calc" }
28-
then:
29-
text:
30-
- lang: python
31-
code: result = ${ actions[0].arguments.expr }
29+
- match: ${ actions[0].name }
30+
with:
31+
- case: calc
32+
then:
33+
call: ${ calc }
34+
args:
35+
expr: ${ actions[0].arguments.expr }

0 commit comments

Comments
 (0)