You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/demo/8-tools.pdl
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -10,22 +10,22 @@ defs:
10
10
description: Arithmetic expression to calculate
11
11
text:
12
12
- 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.
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 a JSON of the tool to use. 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.
14
14
contribute: [context]
15
15
- role: tools
16
16
content:
17
17
text: ${ tools }
18
18
contribute: [context]
19
19
- "Out of 1400 participants, 400 passed the test. What percentage is that?\n"
How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.
5
+
calc:
4
6
description: Calculator function
5
7
function:
6
-
expr:
7
-
type: string
8
-
description: Arithmetic expression to calculate
8
+
expr:
9
+
type: string
10
+
description: Arithmetic expression to calculate
9
11
return:
10
12
lang: python
11
13
code: result = ${ expr }
12
-
Search:
14
+
search:
13
15
description: Wikipedia search
14
16
function:
15
17
topic:
@@ -24,72 +26,104 @@ defs:
24
26
result = wikipedia.summary("${ topic }")
25
27
except wikipedia.WikipediaException as e:
26
28
result = str(e)
29
+
finish:
30
+
description: Respond with the answer
31
+
function:
32
+
answer:
33
+
type: string
34
+
description: The answer
35
+
return: ${ answer }
27
36
tools:
28
37
data:
29
-
- ${ Calc.signature }
30
-
- ${ Search.signature }
38
+
- ${ calc.signature }
39
+
- ${ search.signature }
40
+
- ${ finish.signature }
31
41
text:
32
-
- role: system
33
-
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.
34
-
contribute: [context]
35
42
- role: tools
36
43
content:
37
44
text: ${ tools }
38
45
contribute: [context]
39
-
- text:
40
-
|
46
+
- role: system
47
+
content:
48
+
text:
49
+
- |
50
+
You are a helpful assistant that uses the following tools:
Observation: Nicholas Ray (born Raymond Nicholas Kienzle Jr., August 7, 1911 - June 16, 1979) was an American film director, screenwriter, and actor best known for the 1955 film Rebel Without a Cause.
46
87
Thought: Professions of Nicholas Ray are director, screenwriter, and actor. I need to search Elia Kazan next and find his professions.
Observation: Elia Kazan was an American film and theatre director, producer, screenwriter and actor.
50
90
Thought: Professions of Elia Kazan are director, producer, screenwriter, and actor. So profession Nicholas Ray and Elia Kazan have in common is director, screenwriter, and actor.
- "How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.\n"
How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.
5
+
calc:
4
6
description: Calculator function
5
7
function:
6
-
expr:
7
-
type: string
8
-
description: Arithmetic expression to calculate
8
+
expr:
9
+
type: string
10
+
description: Arithmetic expression to calculate
9
11
return:
10
12
lang: python
11
13
code: result = ${ expr }
12
-
Search:
14
+
search:
13
15
description: Wikipedia search
14
16
function:
15
17
topic:
@@ -24,72 +26,104 @@ defs:
24
26
result = wikipedia.summary("${ topic }")
25
27
except wikipedia.WikipediaException as e:
26
28
result = str(e)
29
+
finish:
30
+
description: Respond with the answer
31
+
function:
32
+
answer:
33
+
type: string
34
+
description: The answer
35
+
return: ${ answer }
27
36
tools:
28
37
data:
29
-
- ${ Calc.signature }
30
-
- ${ Search.signature }
38
+
- ${ calc.signature }
39
+
- ${ search.signature }
40
+
- ${ finish.signature }
31
41
text:
32
-
- role: system
33
-
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.
34
-
contribute: [context]
35
42
- role: tools
36
43
content:
37
44
text: ${ tools }
38
45
contribute: [context]
39
-
- text:
40
-
|
46
+
- role: system
47
+
content:
48
+
text:
49
+
- |
50
+
You are a helpful assistant that uses the following tools:
Observation: Nicholas Ray (born Raymond Nicholas Kienzle Jr., August 7, 1911 - June 16, 1979) was an American film director, screenwriter, and actor best known for the 1955 film Rebel Without a Cause.
46
87
Thought: Professions of Nicholas Ray are director, screenwriter, and actor. I need to search Elia Kazan next and find his professions.
Observation: Elia Kazan was an American film and theatre director, producer, screenwriter and actor.
50
90
Thought: Professions of Elia Kazan are director, producer, screenwriter, and actor. So profession Nicholas Ray and Elia Kazan have in common is director, screenwriter, and actor.
- "How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.\n"
0 commit comments