Skip to content

Commit 7c79e73

Browse files
authored
docs: add example of f.signature (#955)
Signed-off-by: Louis Mandel <[email protected]>
1 parent 0b3dbd9 commit 7c79e73

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

examples/tools/search.pdl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
description: tool use
2+
defs:
3+
search:
4+
description: Wikipedia search
5+
function:
6+
topic:
7+
type: string
8+
description: Topic to search
9+
return:
10+
lang: python
11+
code: |
12+
import warnings, wikipedia
13+
warnings.simplefilter("ignore")
14+
try:
15+
result = wikipedia.summary("${ topic }")
16+
except wikipedia.WikipediaException as e:
17+
result = str(e)
18+
text:
19+
- role: system
20+
content: |
21+
You are a helpful AI assistant with access to the
22+
following tools. If a tool does not exist in the
23+
provided list of tools, notify the user that you
24+
do not have the ability to fulfill the request.
25+
contribute: [context]
26+
- role: tools
27+
content:
28+
text: ${ [ search.signature ] }
29+
contribute: [context]
30+
- "What is the circumference of planet Earth?\n"
31+
- def: actions
32+
model: ollama_chat/granite3.3:8b
33+
parser: json
34+
spec: [{ name: str, arguments: { topic: str }}]
35+
- "\n"
36+
- if: ${ actions[0].name == "search" }
37+
then:
38+
call: ${ search }
39+
args:
40+
topic: ${ actions[0].arguments.topic }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
What is the circumference of planet Earth?
2+
[{'name': 'search', 'arguments': {'topic': 'circumference of Earth'}}]
3+
Earth's circumference is the distance around Earth. Measured around the equator, it is 40,075.017 km (24,901.461 mi). Measured passing through the poles, the circumference is 40,007.863 km (24,859.734 mi).
4+
Treating the Earth as a sphere, its circumference would be its single most important measurement. The first known scientific measurement and calculation was done by Eratosthenes, by comparing altitudes of the mid-day sun at two places a known north–south distance apart. He achieved a great degree of precision in his computation. The Earth's shape deviates from spherical by flattening, but by only about 0.3%.
5+
6+
Measurement of Earth's circumference has been important to navigation since ancient times. In modern times, Earth's circumference has been used to define fundamental units of measurement of length: the nautical mile in the seventeenth century and the metre in the eighteenth. Earth's polar circumference is very near to 21,600 nautical miles because the nautical mile was intended to express one minute of latitude (see meridian arc), which is 21,600 partitions of the polar circumference (that is 60 minutes × 360 degrees). The polar circumference is also close to 40,000 kilometres because the metre was originally defined to be one ten millionth (i.e., a kilometre is one ten thousandth) of the arc from pole to equator (quarter meridian). The accuracy of measuring the circumference has improved since then, but the physical length of each unit of measure had remained close to what it was determined to be at the time, so the Earth's circumference is no longer a round number in metres or nautical miles.

0 commit comments

Comments
 (0)