Function Calling: Empower Your AI with Custom Actions

Function Calling: Empower Your AI with Custom Actions

Functions represent a powerful tool for extending the capabilities of your AI, allowing it to perform specific actions and interact with external systems. With AIsuru, you can easily create custom functions to meet the unique needs of your project.

What are functions?

Functions are instructions that allow the AI to perform operations outside its normal conversational scope - this is known as “function calling.” They can be used to:

By using functions, you can transform your AI from a simple conversational assistant to a powerful tool capable of automating processes and providing real-time data-driven responses.

How to create a function in AIsuru

Where is the functions section?

To create a new function in AIsuru, you need to:

  1. Access the platform;
  2. Create a twin or open the management panel of an existing twin;
  3. Select “Dynamic Intents” from the side menu;
  4. Click on the “Functions” tab at the top of the page;
  5. Press "New Function" and fill out all the fields.

Creating a new function

At this point, a new screen will open where you can define the details of your function:

In the "Parameters" section, you can define the parameters accepted by your function, specifying name, description, and type for each. These are dynamic values (name, email, a message) that the AI can ask the user or deduce from the conversation.

You can use the "Test" section to verify that your function works correctly before implementing it.

Integrating functions into your project

Once created, functions can be easily integrated into your AI twins. The generative AI will be able to recognize when it’s appropriate to use a function and will invoke it automatically, thereby enriching its responses with customized data and actions.

With functions, you can create more dynamic and interactive AI experiences, perfectly tailored to the needs of your project or organization.

Note: Functions are executed directly by the AIsuru platform, not by the underlying language model (LLM). This way, AIsuru maximizes the AI’s capabilities, allowing it to interact with external systems and perform complex actions safely and securely.

Example of a Function Configuration

Scenario: Let’s create an AI assistant that provides the current weather conditions for any city, using the free OpenWeatherMap API.

Function Configuration

  1. Log in to AIsuru and open your twin’s panel;
  2. Go to "Dynamic Intents" > "Functions" tab;
  3. Click "New Function".

Fill in the fields:

Important Security Note: The API key is included directly in the query string as "appid." Replace {API_KEY} with your OpenWeatherMap API key. For optimal security in a production environment, consider using environment variables or secret management systems to store and access your API key.

To obtain an OpenWeatherMap API key:

Add the parameter to the function:

Test

In the "Test" section, enter a city (e.g., "Rome"); Click "Run Test"; Verify that the response contains the correct weather data.

Instructions

Remember to explain the function’s usage to the AI twin in Settings > Prompt.Instructions for the AI Twin (Settings > Prompt).

Instructions for your AI Twin (Settings > Prompt)

Example Interaction