-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfnCallTest.js
61 lines (55 loc) · 1.8 KB
/
fnCallTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Ollama } from 'ollama';
async function main() {
const messages = [
{
role: 'system',
content: `
You are a helpful assistant with access to the following functions.
Use them if required -
{
"name": "order_pizza",
"description": "Order a pizza with custom toppings",
"parameters": {
"type": "object",
"properties": {
"size": {
"type": "string",
"description": "Size of the pizza (small, medium, large)"
},
"crust": {
"type": "string",
"description": "Type of crust (thin, regular, thick)"
},
"toppings": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of toppings for the pizza"
},
"delivery_address": {
"type": "string",
"description": "Address where the pizza should be delivered"
}
},
"required": [
"size",
"crust",
"toppings",
"delivery_address"
]
}
}
"""
`
},
{ role: 'user', content: `Can you deliver a 10" regular margherita pizza with extra olives and onions at 29, Chowrangee Street?` }
];
const ollama = new Ollama({ host: 'http://localhost:11434' })
const response = await ollama.chat({
model: 'calebfahlgren/natural-functions',
messages: messages
})
console.log(response);
}
main();