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/9-react.pdl
+37-37Lines changed: 37 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,33 @@
1
1
description: Demonstrating a React program
2
2
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 }
12
+
Search:
13
+
description: Wikipedia search
14
+
function:
15
+
topic:
16
+
type: string
17
+
description: Topic to search
18
+
return:
19
+
lang: python
20
+
code: |
21
+
import warnings, wikipedia
22
+
warnings.simplefilter("ignore")
23
+
try:
24
+
result = wikipedia.summary("${ topic }")
25
+
except wikipedia.WikipediaException as e:
26
+
result = str(e)
3
27
tools:
4
28
data:
5
-
- type: function
6
-
function:
7
-
name: Calc
8
-
description: Calculator function
9
-
parameters:
10
-
type: object
11
-
properties:
12
-
expr:
13
-
type: string
14
-
description: Arithmetic expression to calculate
15
-
required:
16
-
- expr
17
-
- type: function
18
-
function:
19
-
name: Search
20
-
description: Wikipedia search
21
-
parameters:
22
-
type: object
23
-
properties:
24
-
topic:
25
-
type: string
26
-
description: Topic to search
27
-
required:
28
-
- topic
29
+
- ${ Calc.signature }
30
+
- ${ Search.signature }
29
31
text:
30
32
- role: system
31
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.
@@ -77,19 +79,17 @@ text:
77
79
- "\nObservation: "
78
80
- match: ${ action[0].name }
79
81
with:
80
-
- case: 'Search'
82
+
- case: Search
81
83
then:
82
-
lang: python
83
-
code: |
84
-
import warnings, wikipedia
85
-
warnings.simplefilter("ignore")
86
-
try:
87
-
result = wikipedia.summary("${ action[0].arguments.topic }")
Copy file name to clipboardExpand all lines: examples/demos/react.pdl
+38-37Lines changed: 38 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,33 @@
1
+
description: Demonstrating a React program
1
2
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 }
12
+
Search:
13
+
description: Wikipedia search
14
+
function:
15
+
topic:
16
+
type: string
17
+
description: Topic to search
18
+
return:
19
+
lang: python
20
+
code: |
21
+
import warnings, wikipedia
22
+
warnings.simplefilter("ignore")
23
+
try:
24
+
result = wikipedia.summary("${ topic }")
25
+
except wikipedia.WikipediaException as e:
26
+
result = str(e)
2
27
tools:
3
28
data:
4
-
- type: function
5
-
function:
6
-
name: Calc
7
-
description: Calculator function
8
-
parameters:
9
-
type: object
10
-
properties:
11
-
expr:
12
-
type: string
13
-
description: Arithmetic expression to calculate
14
-
required:
15
-
- expr
16
-
- type: function
17
-
function:
18
-
name: Search
19
-
description: Wikipedia search
20
-
parameters:
21
-
type: object
22
-
properties:
23
-
topic:
24
-
type: string
25
-
description: Topic to search
26
-
required:
27
-
- topic
29
+
- ${ Calc.signature }
30
+
- ${ Search.signature }
28
31
text:
29
32
- role: system
30
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.
@@ -76,19 +79,17 @@ text:
76
79
- "\nObservation: "
77
80
- match: ${ action[0].name }
78
81
with:
79
-
- case: 'Search'
82
+
- case: Search
80
83
then:
81
-
lang: python
82
-
code: |
83
-
import warnings, wikipedia
84
-
warnings.simplefilter("ignore")
85
-
try:
86
-
result = wikipedia.summary("${ action[0].arguments.topic }")
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.
2
+
Thought: I need to find out who discovered the Hudson River and then calculate how many years ago they were born based on the current year, 2025.
Observation: Henry Hudson (c. 1565 – disappeared 23 June 1611) was an English sea explorer and navigator during the early 17th century, best known for his explorations of present-day Canada and parts of the Northeastern United States.
6
+
In 1607 and 1608, Hudson made two attempts on behalf of English merchants to find a rumoured Northeast Passage to Cathay via a route above the Arctic Circle. In 1609, he landed in North America on behalf of the Dutch East India Company and explored the region around the modern New York metropolitan area. Looking for a Northwest Passage to Asia on his ship Halve Maen ("Half Moon"), he sailed up the Hudson River, which was later named after him, and thereby laid the foundation for Dutch colonization of the region. His contributions to the exploration of the New World were significant and lasting. His voyages helped to establish European contact with the native peoples of North America and contributed to the development of trade and commerce.
7
+
On his final expedition, while still searching for the Northwest Passage, Hudson became the first European to see Hudson Strait and the immense Hudson Bay. In 1611, after wintering on the shore of James Bay, Hudson wanted to press on to the west, but most of his crew mutinied. The mutineers cast Hudson, his son, and six others adrift; what then happened to the Hudsons and their companions is unknown.
8
+
Henry Hudson was born around 1565. As of 2025, it has been approximately 470 years since Henry Hudson's birth.Action:
0 commit comments