Function Calling / Tools

What is Function Calling?

Function calling allows your assistant to execute specific operations by invoking external functions. These functions can perform tasks such as retrieving information, updating data, or executing business logic based on user requests.


What happens when a function needs to be called

What happens when a function needs to be called




Creating a Function

With the new interface, there are two ways to create a function. First, open the Function Calling page:

  1. In the left-hand menu, navigate to Assistants > Function Calling.
  2. Click the "Add a Function" button.

A modal window will open, offering you two options:

  • Pre-built Integrations: The easiest way to connect your assistant to specific services without writing a single line of code. Ideal for getting started quickly.
  • Custom Function: The advanced option that gives you full flexibility to connect to any API or write your own logic using JavaScript (Node.js).

Method 1: Using a Pre-built Integration (Example: Orange Find)

This method is recommended for quickly connecting your assistant to supported services.

  1. In the "Add a Function" window, select "Orange Find".
  2. A configuration form will appear. This form allows you to securely connect your assistant to your specific Orange Find instance by providing your unique credentials and API details. You will need to fill in essential information such as your tenant credentials, the GCIP request URL, authentication keys, and the private key file provided by your Orange Find service administrator. Once completed, this configuration enables the assistant to directly query your knowledge base without any custom code.
  1. Once all fields are filled, click "Save". Your function is ready to use!

Method 2: Creating a Custom Function (Advanced)

Choose this option if you need to connect to an API that is not available as a pre-built integration, or if you need to run custom code.

  • In the "Add a Function" window, select "Custom Function".
  • The custom creation interface will appear. You need to provide two main components:

Note: You can learn more about our Node.js environment here.

  1. Function Definition: A JSON object that describes the role of the function and specifies the required fields (e.g., parameters and their expected types).
  2. Function Logic: The JavaScript (Node.js) code that will be executed when the function is called.

Attaching Functions to Your Assistant

Once you’ve created your function, attach it to your assistant. The function will be invoked automatically whenever the assistant determines it’s needed based on user inputs. This integration ensures seamless and dynamic handling of user requests.

Your assistant is now able to call this function whenever it determines it is necessary to respond to a user's request.