Creating a skill for Alice
As an example, we will create a skill called Parrot
, which repeats everything a user writes or says. The example is available in two programming languages: Python and Node.js.
To add an Alice skill based on a function:
- Get your cloud ready.
- Prepare the skill code.
- Create a function and a function version.
- Add the function link to Alice's skill.
- Test the skill.
If you no longer need the resources you created, delete them.
You can find more information about developing skills for Alice here
Getting started
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can navigate to the cloud page
Learn more about clouds and folders here.
Prepare the code for Alice's skill
To create a version of a function, you can use one of the code upload formats. As an example, we will upload the code as a ZIP archive.
- Download a sample file from GitHub: parrot.py
. - Create a ZIP archive named
parrot-py.zip
with theparrot.py
file.
- Download a sample file from GitHub: index.js
. - Create a ZIP archive named
parrot-js.zip
with theindex.js
file.
Create a function and a function version
Once created, the function will contain only information about itself: name, description, unique ID, etc. The actual skill code will be added to the function version.
-
In the management console
, select the folder to create the function in. -
Click Create resource and select
Function. -
Enter a function name. The naming requirements are as follows:
- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Click Create.
-
Create a function version:
PythonNode.js-
From the list of programming languages, select
Python 3.12
. -
Disable Add files with code examples and click Continue.
-
Prepare the function code:
- In the Method field, select
ZIP archive
and attach theparrot-py.zip
archive you created earlier. - In the Entry point field, specify
parrot.handler
.
- In the Method field, select
-
Set the version parameters:
- Timeout:
2
. - Memory:
128 MB
. - Leave the rest of the parameters at their defaults.
- Timeout:
-
Click Save changes.
-
From the list of programming languages, select
Node.js 18
. -
Disable Add files with code examples and click Continue.
-
Prepare the function code:
- In the Method field, select
ZIP archive
and attach theparrot-js.zip
archive you created earlier. - In the Entry point field, specify
index.handler
.
- In the Method field, select
-
Set the version parameters:
- Timeout:
2
. - Memory:
128 MB
. - Leave the rest of the parameters at their defaults.
- Timeout:
-
Click Save changes.
-
Add the function link to Alice's skill
-
Go to the Alice skill page in your dashboard
. -
Click Create dialog. In the window that opens, select Skill.
-
On the Settings tab:
- In the Skill name field, specify a unique name for the skill you are creating.
- In the Backend field, select Function in Yandex Cloud. Select the function you created earlier from the drop-down list.
Warning
The list shows the functions that you are allowed to view. To attach a function to a skill, you need permission to launch the function. This permission is included in the functions.functionInvoker and editor roles or higher.
- At the bottom of the page, click Save.
Test the skill
- Open the Testing tab on the skill page in your dashboard
. - If everything is set up correctly, the Chat section will display a message inviting you to start a conversation:
Hello! I'll repeat anything you say to me.
. - Send a message and make sure the response is the same.
How to delete the resources you created
To stop the skill, delete the function.