Skip to main content

🤖 AI tools

Tags: Flutter

What are AI tools?

AI tools allow you to create deep integrations between your app / website and Kai (our AI bot). A few use-cases might include:

  • A banking app allowing to initiate transactions
  • Performing a password reset directly in the messenger
  • Canceling orders
  • ...

The possibilities are almost endless. The following example shows how to add a new AI tool allowing users to initiate bank transactions directly inside Kai.

Ticket custom data

Specify AI tools

    AITool transactionTool = AITool(
name: 'send-money',
description: 'Send money to a given contact.',
response:
'The transfer got initiated but not completed yet. The user must confirm the transfer in the banking app.',
parameters: [
AIToolParams(
name: 'amount',
description:
'The amount of money to send. Must be positive and provided by the user.',
type: AIParamType.NUMBER,
required: true,
),
AIToolParams(
name: 'contact',
description: 'The contact to send money to.',
type: AIParamType.STRING,
required: true,
enums: ["Alice", "Bob"],
),
],
);

// Set the AI tools.
Gleap.setAiTools(tools: [transactionTool]);

Perform actions

    Gleap.registerListener(
actionName: 'toolExecution',
callbackHandler: (data) {
print('Tool execution: $data');
},
);