Suvvy User Guide
На русском
  • INTRODUCTION
  • QUICK START
  • MAIN SETTINGS
    • System Instruction
      • Best Practices
        • Guidelines for writing instructions
        • Ways to improve accuracy and response quality
        • Instruction debugging
        • Cost optimization
      • Variables
      • Functions
      • Multilingualism
      • Reading URLs
      • Typical reasons for stopping a dialoguePage
    • Additional settings
    • Notifications from Suvvy
  • Knowledge Base
    • Knowledge Base
      • Direct questions
      • Large files
  • Working with Tables
    • Tables (CSV-XLS / Google)
      • Data retrieval
      • Data recording
  • ACTIONS
    • Webhooks
    • Multiagent Systems
      • Calling a subordinate bot
      • Switch active bot
  • CHANNELS
    • CRM Systems
      • amoCRM
      • Kommo
      • Bitrix24
    • Website Chats
      • Jivo
    • Messengers
      • WhatsApp
      • Telegram
    • Social Networks
      • Instagram
      • VK
    • Marketplaces
      • Wildberries
      • OZON
      • Yandex.Market
      • Avito
    • Helpdesk Systems
      • UseDesk
      • PlanFix
    • Custom Channel
      • Working with webhook
      • Sending messages
  • INTEGRATIONS
    • YCLIENTS
    • ALTEGIO
    • Google Calendar
  • Analytics
    • Chart Analysis
  • FOR PARTNERS
    • Partner Program
    • Training
  • Legal Information
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • How do functions work?
  • Function Calls in Instructions
  • Pre-installed Functions
  • Custom Functions
  1. MAIN SETTINGS
  2. System Instruction

Functions

In this section, we will explain the principles of how functions work in detail.

PreviousVariablesNextMultilingualism

Last updated 5 months ago

Functions are a very useful and important tool when configuring Suvvy, allowing Suvvy to perform specific actions (invoke a knowledge base file, table, web-hook, etc.).

How do functions work?

At the core of each Suvvy mechanism, where some action is required (in addition to responses), whether it's a knowledge base, tables, web-hooks, or something else, there lies a "function" responsible for its operation. Within a function, there are two parameters:

  • function name

  • function description

The name provides a general meaning, while the description is more detailed.

For example, for a table serving as a price list, which Suvvy needs to read to respond to a client, the function name and description might be:

  • Name: price_table

  • Description: Used for providing product costs

This information gives Suvvy an idea of where the cost information is stored, so when a client asks, "How much does it cost?" Suvvy understands that this information is stored in the given table.

Note

There are more complex situations when calculations are done in multiple steps or when using information from different sources.

For example, when data first needs to be obtained from the first table, and then this information is passed to a second table to retrieve data according to this combination.

In this case, each table is assigned its own name and description.

For example, in the first table, we obtain the product category and its identifier (ID), and then, using the category ID, calculate the cost in another table, where the volume and cost of the product are specified. In this case, the parameters for the first table would be:

  • Name: categories_table

  • Description: Used for obtaining product category IDs

For the second table:

  • Name: price_table

  • Description: Used for obtaining product costs by ID.

At this point, one might wonder why not specify everything in one table right away? Here, it's divided simply as an example.

In this case, with such a scheme, we can specify a prompt in the instructions like this:

#COST CALCULATION

If the client requests the product cost, perform the following steps in order:

  1. Obtain the product ID by calling the categories_table function and passing the required product to it

  2. Retrieve the product cost by calling the price_table function and passing the product ID obtained in the previous step.

In English, the function call is phrased as call function .

Why are we calling two functions here? Doesn't the bot understand it from the description?

It does, but it's a matter of precision. If we want to increase it, it's better to explicitly state the sequence of steps in the instructions.

Function Calls in Instructions

For calling functions in Suvvy's system instructions, the construction is used:

call function , where is the specific function.

Below are types of functions and examples of their use.

Pre-installed Functions

Pre-installed functions include the function for working with the knowledge base. When it's necessary to forcibly invoke a specific file in the knowledge base, the function is used:

get_file_text(""), where is the file name to search for in the Knowledge Base section.

For instance, if a client doesn't explicitly write that they want to connect with an operator, but in some cases, we want to reduce the chance that Suvvy won't call the correct file, we can use the following method:

Если клиент злится, у него есть претензия или повышенный тон, по которому мы можем понять его негативный настрой вызови функцию get_file_text("Переключить на менеджера").
If the client is angry, he has a complaint or a raised tone, by which we can understand his negative attitude, call function get_file_text("Switch to manager").

In this case, Suvvy will call the file even though the client did not request to switch to a manager.

Custom Functions

Each table or action has its own unique function name and description. It is assigned individually for each separate table or action.

Functions themselves have descriptions, and Suvvy understands when they need to be called on its own.

Including functions in the instructions is not mandatory on its own, but we consider cases where the function call may be not obvious to the bot, or the sequence of actions has its branches that need to be described.

By analogy with the previous point, we can call necessary functions using the construction:

call function , where is the specific function.

For tables, having the word "table" in the name is mandatory (added automatically).

When calling a table or action, we must specify what we're passing to it to ensure Suvvy doesn't pass unnecessary information.

For example, if we want to call a web-hook that will contact the CRM and obtain information about a product, considering delivery to a specific city, we can create the instruction as follows:

Если клиент запрашивает информацию о товаре вызови функцию item_information и передай туда название товара и город доставки.
If the customer requests information about the product, call the item_information function and pass the product name and the delivery city there.

At present, custom functions include functions from the and sections.

Tables
Actions