Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
  • Getting started
    • Overview
    • Creating a function
      • Overview
      • Node.js
      • Python
      • Go
      • PHP
      • Bash
      • Java
    • Creating a trigger
      • Overview
      • Timer
      • Trigger for Message Queue
      • Trigger for Object Storage
      • Trigger for Container Registry
      • Trigger for Cloud Logs
      • Trigger for Cloud Logging
      • Trigger for Yandex IoT Core
      • Trigger for budgets
      • Trigger for Data Streams
  • Step-by-step instructions
    • All instructions
    • Using functions to get an IAM token for a service account
    • Connecting to managed databases from functions
    • Managing rights to access functions
    • Managing functions
      • Creating a function
      • Managing function versions
      • Working in the code editor
      • Invoking a function
      • Updating a function
      • Scaling a function
      • Function monitoring
      • Viewing the execution log
      • Deleting a function
    • Managing triggers
      • Getting information about a trigger
      • Creating a timer
      • Creating a trigger for Message Queue
      • Creating a trigger for Object Storage
      • Creating a trigger for Container Registry
      • Creating a trigger for Cloud Logs
      • Creating a trigger for Cloud Logging
      • Creating a trigger for Yandex IoT Core
      • Creating a trigger for budgets
      • Creating a trigger for Data Streams
      • Updating a trigger
      • Trigger monitoring
      • Deleting a trigger
  • Concepts
    • Overview
    • Function
    • Invoking a function
    • Runtime environment
      • Overview
      • Environment
      • Execution context
      • Preloaded runtime environment
    • Builder
    • Trigger
      • Overview
      • Timer
      • Trigger for Message Queue
      • Trigger for Object Storage
      • Trigger for Container Registry
      • Trigger for Cloud Logs
      • Trigger for Cloud Logging
      • Trigger for Yandex IoT Core
      • Trigger for budgets
      • Trigger for Data Streams
    • Dead Letter Queue
    • Log groups
    • Backups
    • Quotas and limits
  • Developing in Node.js
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Developing in Python
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Developing in Go
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Developing in PHP
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
  • Developing in Bash
    • Overview
    • Request handler
    • Logging
    • Handling errors
    • Using the SDK
  • Developing in Java
    • Overview
    • Programming model
      • Overview
      • Function interface
      • YcFunction interface
      • HttpServlet class
      • Spring Boot
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Developing in R
    • Overview
    • Programming model
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
  • Developing in C#
    • Overview
    • Programming model
      • Overview
      • Function interface
      • YcFunction interface
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Practical guidelines
    • Creating skills for Alice
    • Deploying a web application
    • Developing a skill for Alice and a website with authorization
    • Writing data from a device to Managed Service for PostgreSQL
    • Developing a Slack bot
    • Developing a Telegram bot
    • Connecting to a YDB database from a Python function
    • Connecting to a YDB database from a function in Node.js
    • Converting a video to a GIF in Python
    • Creating a Node.js function using TypeScript
  • Pricing policy
  • Access management
  • API Functions reference
    • Authentication in the API
    • gRPC
      • Overview
      • FunctionService
      • OperationService
    • REST
      • Overview
      • Function
        • Overview
        • create
        • createVersion
        • delete
        • get
        • getVersion
        • getVersionByTag
        • list
        • listAccessBindings
        • listOperations
        • listRuntimes
        • listScalingPolicies
        • listTagHistory
        • listVersions
        • removeScalingPolicy
        • removeTag
        • setAccessBindings
        • setScalingPolicy
        • setTag
        • update
        • updateAccessBindings
  • API Triggers reference
    • Authentication in the API
    • gRPC
      • Overview
      • TriggerService
      • OperationService
    • REST
      • Overview
      • Trigger
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • pause
        • resume
        • update
  • Questions and answers
  1. Practical guidelines
  2. Creating skills for Alice

Creating skills for Alice

Written by
Yandex Cloud
  • Prepare the code for Alice's skill
  • Create a function
  • Create the version of the function
  • Add the function link to Alice's skill
  • Test the skill

As an example, we'll create a skill called Parrot, which repeats everything a user writes or says. We implement our example in two programming languages: Python and Node.js.

To add skills based on a function to Alice:

  1. Prepare the skill code.
  2. Create a function.
  3. Create a version of the function.
  4. Add the function link to Alice's skill.
  5. Test the skill.

More about developing Alice's skills.

Prepare the code for Alice's skill

To create versions of functions, you can use one of the code upload formats. As an example, we'll upload the code in a ZIP archive.

Python
Node.js
  1. Download a sample file from GitHub: parrot.py.
  2. Create a ZIP archive named parrot-py.zip with the parrot.py file.
  1. Download a sample file from GitHub: index.js.
  2. Create a ZIP archive named parrot-js.zip and add the index.js file.

Create a function

Once created, the function will only contain information about itself, like its name, description, and unique ID. The skill's code will be added to the function when you create a version.

  1. In management console, select the folder where you want to create your function.

  2. Click Create resource.

  3. Choose Function.

  4. Enter a function name.

    • The length can be from 3 to 63 characters.
    • It may contain lowercase Latin letters, numbers, and hyphens.
    • The first character must be a letter. The last character can't be a hyphen.
  5. Click Create.

Create the version of the function

Choose the programming language and create a version of the function.

Python
Node.js
  1. In the management console, open Cloud Functions in the folder where you want to create the function version.
  2. Select the function to create the version for.
  3. Under Latest version, click Create in editor.
  4. Set the version parameters:
    • Runtime environment: python37.
    • Timeout, seconds: 2.
    • RAM: 128 MB.
    • Service account: Not selected.
  5. Prepare the function code:
    • Method: ZIP archive.
    • File: parrot-py.zip.
    • Entry point: parrot.handler.
  6. Click Create version.
  1. In the management console, open Cloud Functions in the folder where you want to create the function version.
  2. Select the function to create the version for.
  3. Under Latest version, click Create in editor.
  4. Set the version parameters:
    • Runtime environment: nodejs12.
    • Timeout, seconds: 2.
    • RAM: 128 MB.
    • Service account: Not selected.
  5. Prepare the function code:
    • Method: ZIP archive.
    • File: parrot-js.zip.
    • Entry point: index.handler.
  6. Click Create version.

Add the function link to Alice's skill

  1. Go to Alice's skill page in your dashboard.

  2. Open the Settings tab.

  3. Under Backend, select Function in Yandex Cloud.

  4. Select the desired function from the drop-down list.

    Warning

    The list shows the functions that you're allowed to view. To attach a function to a skill, you need permission to launch the function. This permission is part of the serverless.functions.invoker, editor, and higher roles.

  5. Click Save at the bottom of the page to save changes.

Test the skill

  1. Open the Testing tab on the skill page in your dashboard.
  2. 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..
  3. Send a message and make sure the response is the same.

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • Prepare the code for Alice's skill
  • Create a function
  • Create the version of the function
  • Add the function link to Alice's skill
  • Test the skill