Skip to content

Commit 7467314

Browse files
committed
Update main.js
1 parent 9756113 commit 7467314

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

demo/main.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,46 @@ Gleap.setWSApiUrl("ws://0.0.0.0:9000");
66

77
Gleap.initialize("ogWhNhuiZcGWrva5nlDS8l7a78OfaLlV");
88

9+
const transactionTool = {
10+
// Name the tool. Only lowecase letters and - as well as _ are allowed.
11+
name: "send-money",
12+
// Describe the tool. This can also contain further instructions for the LLM.
13+
description: "Send money to a given contact.",
14+
// Let the LLM know what the tool is doing. This will allow Kai to update the customer accordingly.
15+
response:
16+
"The transfer got initiated but not completed yet. The user must confirm the transfer in the banking app.",
17+
// Set the execution type to auto or button.
18+
executionType: "auto",
19+
// Specify the parameters (it's also possible to pass an empty array)
20+
parameters: [
21+
{
22+
name: "amount",
23+
description:
24+
"The amount of money to send. Must be positive and provided by the user.",
25+
type: "number",
26+
required: true,
27+
},
28+
{
29+
name: "contact",
30+
description: "The contact to send money to.",
31+
type: "string",
32+
enum: ["Alice", "Bob"], // Optional
33+
required: true,
34+
},
35+
],
36+
};
37+
38+
Gleap.on("tool-execution", (tool) => {
39+
console.log(tool);
40+
});
41+
42+
// Add all available tools to the array.
43+
const tools = [transactionTool];
44+
45+
// Set the AI tools.
46+
Gleap.setAiTools(tools);
47+
948
Gleap.on("outbound-sent", (data) => {
10-
const { outboundId, outbound, formData } = data;
49+
const { outboundId, outbound, formData } = data;
1150
console.log(data);
1251
});

0 commit comments

Comments
 (0)