The charm of HUAWEI CLOUD API conversational robot CBS—realize simple dialogue operations

Cloud service, API, SDK, debugging, viewing, I can do it all

After reading the short article, you can learn: artificial intelligence AI intelligent question and answer management, comprehensive dialogue management, efficient training deployment

1.IntelliJ IDEA's API plug-in introduction

The API plug-in supports platforms such as VS Code IDE, IntelliJ IDEA, and HUAWEI CLOUD self-developed CodeArts IDE. Based on the capabilities provided by HUAWEI CLOUD services, it helps developers build applications more efficiently and conveniently. The API plug-in is associated with API Explorer, DevStar, CodeLabs, SDK Center, and CLI Center products under HUAWEI CLOUD, and is committed to providing developers with a more stable, fast, and secure programming experience.

In this plugin, we provide but not limited to the following functions:

Docking with the HUAWEI CLOUD API open platform, users can search APIs, view API documents, debug APIs, and provide SDK sample codes for users to learn how to use APIs.

Provides the HUAWEI CLOUD SDK code fragment completion function, and automatically imports SDK dependency packages to accelerate users' integration of HUAWEI CLOUD APIs.

Connect with Codelabs of Huawei Cloud Development Experience Hall, provide 500+ cloud service code samples, and guide tutorials to help users learn quickly.

illustrate:

In series platforms such as IntelliJ IDEA and VS Code IDE, the name of the Huawei Cloud API plug-in is Huawei Cloud API. In CodeArts IDE, the API plug-in is natively built into the IDE, and its name is HUAWEI CLOUD API Development Kit.

The use of the API plug-in on IntelliJ IDEA and other platforms and VS Code IDE depends on the base plug-in, please install the base plug-in in advance.

2. API plug-in installation--IntelliJ IDEA

2.1 Platforms such as IntelliJ IDEA

Installation preparation: download and install JDK1.8 or later. Download and install IntelliJ IDEA 2020.2 or later.

Note: The IntellIj platform supports IDEs including Goland and Pycharm at the same time. If you develop on other related IDEs, please download and configure the compiler or interpreter of the corresponding language. Here we take IDEA as an example to introduce the installation process of the IntelliJ platform plug-in. For other IntelliJ series IDEs, please refer to IDEA.

开始安装:https://developer.huaweicloud.com/develop/toolkit.html

您可以在直接在IDE插件市场或者直接在JetBrains插件市场下载离线包安装。

IDE安装

  1. 在IntelliJ IDEA顶部菜单栏中选择File > Settings,在Settings对话框的左侧导航栏中单击Plugins。
  2. Plugins区域单击Marketplace,在搜索栏中输入Huawei Cloud API。
  3. Search Results区域会出现Huawei Cloud API,单击Install,完成后重启IDE。

离线包安装:

  1. 进入插件市场搜索Huawei Cloud API,进入插件详情页,在Versions页签下选择想要版本的API插件,点击Download下载离线的插件压缩包保存到本地。。
  2. 在IntelliJ IDEA顶部菜单栏中选择File > Settings,在Settings对话框的左侧导航栏中单击Plugins。
  3. 在Plugins区域单击 ,再单击Install Plugin from Disk...。
  4. 在Choose Plugin File对话框中选择离线安装包(不用解压),并按照IntelliJ IDEA安装页面的提示,完成后续安装步骤。

说明:若当前您想要安装插件的IntelliJ IDE已经在桌面打开,则进入插件市场搜索Huawei Cloud API,进入插件详情页,在右上角会识别到本地已经打开的IDE,点击相应按钮,在弹出的IDE窗口中点击ok,则IDE后台会开始安装相应版本的API插件。

安装验证:在IntelliJ系列平台上安装插件成功后在左侧的导航栏中可以看到Huawei Cloud Toolkit图标,点击后面板会出现Huawei Cloud API的字样,则说明安装成功。

3.使用对话流程,搭建复杂逻辑的AI对话场景

3.1华为云API

左侧展示API列表,可以查询所有API,目前云服务206,APIs9213

https://developer.huaweicloud.com/develop/toolkit.html

3.2 如何通过CBS实现简单的对话操作

What is a conversational bot service?

Conversational Bot Service (Conversational Bot Service) is a cloud service based on artificial intelligence technology and developed for enterprise application scenarios. It mainly includes functions such as intelligent question answering, intelligent quality inspection, customized dialogue bots, and task-based dialogue.

Skill management in the dialogue robot service is a tool platform for building task-based dialogue skills. By creating and managing different skills and dictionaries, it can meet different user needs and realize multi-round dialogue capabilities in different scenarios.

In this case, you will use CBS's skill management to quickly configure skills for the robot, and realize the robot's garbage sorting skills through multiple rounds of dialogue.

Intelligent question and answer management

  1. Automatic analysis and statistics of hot issues, trends, and knowledge.
  2. Supports automatic clustering of unknown questions, matching similar questions and answers, and assisting humans to continuously expand the knowledge base.
  3. Support question and answer commissioning, point-to-point monitoring of intelligent answering process.
  4. Supports domain knowledge mining and provides easy-to-use annotation tools to mine domain knowledge pairs.

Comprehensive dialog management

  1. Support natural language multi-capability fusion, intelligent dialogue central control.
  2. Flexible knowledge base management supports batch operations on knowledge.
  3. Supports embedding of multi-round dialogue skills to meet complex task-based dialogue scenarios.

Efficient Training Deployment

  1. Based on the underlying algorithm capabilities of modelarts, it provides faster model training and deployment capabilities.
  2. Support multi-algorithm model effect verification, and verify the impact of different data, parameters, and models on the effect of the query method.
  3. Support the recommendation of the optimal parameter combination of the model to ensure the effect of question answering.

Case goal: master the use of CBS skills. Master the method of using CBS to create garbage classification process configuration.

To experience the configuration of garbage sorting robots, the following preparations need to be completed:

Create a HUAWEI CLOUD account and perform real-name authentication.

Sign up for a HUAWEI CLOUD account. After completing the real-name authentication, it is recommended to use code scanning authentication. https://support.huaweicloud.com/usermanual-account/zh-cn_topic_0133456714.html

Download data:

.
├── DB_query_rubbish_type.py
└── rubbish_dict.txt

Create a trial version of the intelligent Q&A bot: Since skill management is a function of the professional version of the intelligent Q&A bot, first we need to purchase a trial version of the professional version of the Q&A bot. Click this link to enter the dialogue robot service intelligent question-and-answer robot page, click the purchase question-and-answer robot in the upper right corner to enter the question-and-answer robot purchase page. https://console.huaweicloud.com/cbs/?region=cn-north-4#/home/qa-robot

Enter the name of the Q&A robot, select the billing mode for the trial, and click Buy Now to complete the payment, that is, the creation of the trial professional version robot is completed.

After the purchase is complete, get the botid

Make sure it has been configured according to the Java environment configuration details.

Integrate CBS JAVA SDK

Through maven, introduce CBS JAVA SDK into system engineering, after introduction, it can be used in system engineering.

<dependency>

    <groupId>com.huaweicloud.sdk</groupId>

    <artifactId>huaweicloud-sdk-core</artifactId>

    <version>3.0.89</version>

</dependency>

<dependency>

   <groupId>com.huaweicloud.sdk</groupId>

   <artifactId>huaweicloud-sdk-cbs</artifactId>

   <version>3.0.89</version>

 </dependency>

示例代码

package demo;

// 对用户身份进行认证

import com.huaweicloud.sdk.cbs.v1.CbsClient;

// 导入cbs sdk

import com.huaweicloud.sdk.cbs.v1.model.ExecuteQaChatRequest;

import com.huaweicloud.sdk.cbs.v1.model.ExecuteQaChatResponse;

import com.huaweicloud.sdk.cbs.v1.model.PostRequestsReq;

import com.huaweicloud.sdk.core.auth.ICredential;

import com.huaweicloud.sdk.core.auth.BasicCredentials;

// Http配置

import com.huaweicloud.sdk.core.http.HttpConfig;

import com.huaweicloud.sdk.core.region.Region;
public class ExecuteQaChatSolution {

       public static void main(String[] args) {

              // 配置账户的AK SK 信息

              String ak = "Ak";

              String sk = "Sk";

              // 获取iam 站点 https://support.huaweicloud.com/api-iam/iam_16_0005.html

              String iamEndpoint = "iamEndpoint"; // https://iam.cn-north-4.myhuaweicloud.com

              // 获取cbs 站点信息 https://support.huaweicloud.com/api-cbs/cbs_03_0102.html

        String endpoint = "endpoint"; // https://cbs-ext.cn-north-4.myhuaweicloud.com

              // 网络配置信息

        HttpConfig config = new HttpConfig();

              config.withIgnoreSSLVerification(true);

              // 鉴权信息

              ICredential auth = new BasicCredentials()

                .withIamEndpoint(iamEndpoint)

                .withAk(ak)

                .withSk(sk);

              // 初始化cbsClient

              CbsClient client = CbsClient.newBuilder()

                .withCredential(auth)

                .withHttpConfig(config)

                .withRegion(new Region("cn-north-4", endpoint))

                .build();

              ExecuteQaChatRequest request = new ExecuteQaChatRequest();

              PostRequestsReq body = new PostRequestsReq();

              // 设置请求问题 相关参数可以参考:https://support.huaweicloud.com/api-cbs/cbs_03_0115.html

              body.setQuestion("你好");

              request.withBody(body);

              // 设置botId,可以参考前提条件的获取botid方法

              request.setQabotId("botid"); // bot id

              ExecuteQaChatResponse response = client.executeQaChat(request);

              System.out.println(response.toString());

       }

}

Return result example

4. References

https://support.huaweicloud.com/sdk-cbs/cbs_06_0001.html

https://support.huaweicloud.com/sdk-cbs/cbs_06_0002.html

5. Experience the charm of plug-ins

HUAWEI CLOUD devkit is online: https://developer.huaweicloud.com/develop/toolkit.html

Guess you like

Origin blog.csdn.net/hwxiaozhi/article/details/132685447