Skill trainer use cases

Prev Next

Available in Classic and VPC

This example describes how to create a conversational AI service that responds to requests for recommending various businesses using NAVER's local search API. Through this example, you can understand the overall process of creating a service using Skill trainer.

To create a conversational AI service, follow these steps:

Preparations

The API used in this example uses the search APIs provided by NAVER Developers Center. To call the search APIs in skill trainer, you need to register your application on the NAVER developers center and obtain the necessary authentication information for API calls. The authentication information obtained in this step will be applied to the call options during data collection.

To obtain authentication information to use the NAVER APIs, follow these steps:

  1. Register your application on the NAVER developers center.
    • For more information on how to register an application, see register application.
    • When registering an application, select the search APIs as the API to use.
  2. Check the client ID and client secret information for API calls.
Note
  • When using the NAVER APIs, you must comply with the terms of service for the NAVER developers center. Any legal responsibilities arising from violations of these terms fall solely on you.
  • For more information on how to use the NAVER APIs, see the NAVER developers center API common guides.

Step 1. Create skill set

To create a skill set, follow these steps:

  1. From the NAVER Cloud Platform console, click i_menu > Services > AI Services > CLOVA Studio in order.
  2. From the my product menu, click the [Go to CLOVA Studio] button.
  3. In CLOVA Studio, click the Skill trainer menu.
  4. Click the [Create skill set] button.
  5. When the Create skill set window appears, enter the following information.
    • Skill set: local search.
    • Skill set description: provides relevant local search results based on the search terms entered by the user. You can query various businesses and institutions registered in NAVER location service and request sorting options for search results (e.g., by the number of blog reviews or accuracy).
    • Service area: place.
  6. To check for duplicates within skill set names, click the [Check duplicates] button.
  7. Click the [Save] button.
  8. To add a skill to the skill set, click the [Create skill] button.

Step 2. Create skill

To create a skill, follow these steps:

  1. Create a skill set by following Step 1. Create a skill set.

  2. Click the [Create skill] button.

  3. Once you see the skill information screen, enter "local search" for the skill name, and click the [Check duplicates] button.

  4. After writing content in the API spec area, click the [Validate] button.

    {
      "info": {
        "title": "NAVER local search",
        "version": "1.0.0",
        "description": "skill to search for businesses and institutions registered in the NAVER location service"
      },
      "paths": {
        "/v1/search/local.json": {
          "get": {
            "summary": "show the search results of local information in Korea.",
            "responses": {
              "200": {
                "content": {
                  "application/json": {
                    "schema": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "link": {
                                "type": "string"
                              },
                              "mapx": {
                                "type": "string"
                              },
                              "mapy": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "category": {
                                "type": "string"
                              },
                              "telephone": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "roadAddress": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "start": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "display": {
                          "type": "integer"
                        },
                        "lastBuildDate": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "description": "- **title**: business name\\n- **address**: lot number address (e.g., 229-1, Euljiro3ga, Jung-gu, Seoul)\\n- **roadAddress**: road address (e.g., 6-5, Euljiro15-gil, Jung-gu, Seoul)\\n- **category**: category (e.g., restaurant, cafe, hospital, beauty salon, company, public institution)\\n- **description**: description of business (e.g., charcoal-grilled Korean beef ribs restaurant, coffee shop with good vibes near Gangnam Station)\\n- **link**: website link"
              }
            },
            "parameters": [
              {
                "in": "query",
                "name": "query",
                "schema": {
                  "type": "string"
                },
                "required": true,
                "description": "**query**: description of business the user is searching for (e.g., popular restaurant near Jeongja-dong, coffee shop with good vibes near Gangnam station)\\n"
              },
              {
                "in": "query",
                "name": "display",
                "schema": {
                  "type": "integer",
                  "default": "2"
                },
                "required": true,
                "description": "this is the number of search results for the requested query. If this is the only store or business, show just 1 result."
              },
              {
                "in": "query",
                "name": "sort",
                "schema": {
                  "type": "string"
                },
                "required": false,
                "description": "search result sorting method\\n- **random**: descending order based on accuracy (default)\\n- **comment**: use this value when sorting by the number of reviews on cafe or blog in descending order. (e.g., Sort by most reviews. Recommend famous places. Recommend popular places.)\\n"
              }
            ],
            "description": "search for local businesses or institutions.",
            "operationId": "getLocalInfo"
          }
        }
      },
      "openapi": "3.0.2",
      "servers": [
        {
          "url": "https://openapi.naver.com"
        }
      ]
    }
    
  5. Enter the information in the Manifest area as follows:

    • Name for model: LocalSearch
    • Description for human: return the search results for businesses and institutions registered in the NAVER location service.
    • Description for model: to search for businesses and institutions registered in the NAVER location service, use the local search skill. /v1/search/local.json works when you input the name and address (e.g., road address, lot number address) of the business or institution as the search keyword. You can request search results with your preferred sorting method (e.g., by the number of blog reviews, accuracy).
  6. Click the [Check duplicates] button of the name for model.

  7. Enter all the required information, and then click the [Create] button.

    • To save the work done so far, click the [Save draft] button.
    • Even if all fields have been filled out, if you click the [Save draft] button, the task status will be saved as "In progress."
  8. When the Skill creation completion window appears, click the [OK] button.

  9. Check if the version is properly created.

Note

For more information on how to write API spec and manifest, see skill.

Step 3. Collect data

During the data collection step, appropriate skills are called after analyzing your query. The number of skill calls corresponds to the number of queries classified in the query analysis results. If your question is classified into 2 queries, the skill will be called twice. In this example, since the data is collected for the query "Tell me the address of NAVER 1784 and recommend coffee shops nearby," the skill will be called twice.

Follow these steps to call a skill.
Step 1. Load the information of the skill to call.
Step 2. Based on the skill information, generate the URL and parameters for API call, and receive the actual call results (API response).
Step 3. Based on the call result, it generates the content summarized in natural language.

If the action input item for calling the API is not properly generated during the data collection, the call result will not be generated correctly. In such cases, edit the action input item to ensure that the model understands the query well. This review process varies depending on the complexity and characteristics of the API.

To collect data, follow these steps:

  1. From the NAVER Cloud Platform console, click i_menu > Services > AI Services > CLOVA Studio in order.

  2. From the my product menu, click the [Go to CLOVA Studio] button.

  3. In CLOVA Studio, click the Skill trainer menu.

  4. Click the skill set you want to collect data for.

  5. Click the Data collection menu.

  6. Enter the API information issued in the preparations in the call option by referring to the example format.

  7. Enter "Tell me the address of NAVER 1784 and recommend coffee shops nearby" in the user query and click the [Run] button.

  8. Review the query analysis and skill call results on the left side of the screen.

    • If there are any edits needed during the process, click the [Suspend] button, make the necessary changes, and then click the [Apply] button.
    Note

    In this example, the local search API being used requires concise input values for the query parameters to function properly. Based on the parameter values generated by the model, "coffee shops near NAVER 1784" may not generate accurate API search results. Therefore, edit the query in the action input field to "NAVER 1784 coffee shop" and then click the [Apply] button to regenerate the API search results.

  9. Once the edit and review in the skill call step are completed, click the [Task completed] button to finish the data collection.

    • In the final response stage, a combined response containing the results of the 2 skill calls is generated.
  10. If you have a specific response format in mind, collect multiple cases formatted accordingly as follows:

    Here is the answer to {user request}.
    1. {Place 1 name}
    - Address: {Place 1 address}
    2. {Place 2 name}
    - Address: {Place 2 address}
    
    Let us know if you need more location information. 
    
  11. To enable the model to learn from various cases, collect data using a variety of user queries.

    • It is recommended to collect at least 20 pieces of data before starting training.
    • You can collect queries such as the following:
      • Popular hair salons in Jeongja-dong
      • Find coffee shops near Gangnam Station
      • Find popular restaurants in Seongsu-dong. List the results by most reviews.
      • Tell me about Bundang-gu Office

Step 4. Train data

After collecting data using various user queries, train the skill set to enable the model to generate more accurate and refined responses. To train the data, at least 1 "completed" skill set and collected data are required.

To train the data, follow these steps:

  1. From the NAVER Cloud Platform console, click i_menu > Services > AI Services > CLOVA Studio in order.
  2. From the my product menu, click the [Go to CLOVA Studio] button.
  3. In CLOVA Studio, click the Skill trainer menu.
  4. Click the skill set you want to collect data for.
  5. Click the Data training menu.
  6. Click the [Start training] button.

Step 5. Call skill set API

In the version management menu, you can conduct a test for the trained version on the data collection screen. If the results are unsatisfactory, collect additional data and proceed with retraining.
To call the skill set API for service deployment, follow these steps:

  1. From the NAVER Cloud Platform console, click i_menu > Services > AI Services > CLOVA Studio in order.
  2. From the my product menu, click the [Go to CLOVA Studio] button.
  3. In CLOVA Studio, click the Skill trainer menu.
  4. Click a skill set.
  5. Click the Version management menu.
  6. Click the [View code] button for the final version applied to the service to check the skill set API call information.
    • For instructions on calling the skill set API, see the API guides.

To call the skill set API, follow these steps: For more information on calling, see the API guides.

curl --location --request POST 'https://clovastudio.stream.ntruss.com/testapp/v1/skillsets/{SKILLSET_ID}/versions/{VERSION}/final-answer' \
--header 'Authorization: Bearer {API_KEY}' \
--header 'X-NCP-CLOVASTUDIO-REQUEST-ID: {REQUEST_ID}' \
--header 'Content-Type: application/json' \
--data '{  
    "query": "Tell me the address of NAVER",
    "tokenStream": true,
    "requestOverride": {
        "baseOperation": {
            "header": {
                "X-Naver-Client-Id": "{CLIENT_ID}", // client ID value issued upon registering the application
                "X-Naver-Client-Secret": "{CLIENT_SECRET}" // client secret value issued upon registering the application
            }
        }
    }
}'