如果您使用过Siri、Alexa或Google 助理(Google Assistant),您已经熟悉聊天机器人的工作方式。(chatbot works.)它是一款软件,可让您通过与计算机进行对话来与其进行交互。至少,它会尝试(tries )与您对话。从历史上看,聊天机器人相当笨重,也不是那么有用。
现在情况发生了很大变化。我们一直在使用我们的语音助手,他们几乎总是能理解我们的意思。登录(Log)到几乎任何商业网站,弹出的小消息应用程序(messaging app)背后可能没有真人,提供帮助。
聊天机器人正在彻底改变我们使用计算机的方式,但现代聊天机器人编码复杂且训练困难。这(Which)就是为什么我们现在有很多公司提供聊天机器人构建器来简化这个过程(相对)。
运行世界上最好的聊天机器人的AI 技术(AI technology)领导者IBM实际上提供了一个聊天机器人构建工具(chatbot building tool),您可以免费试用。它被称为IBM Watson Assistant,让任何人都可以利用(anyone leverage one)现有的最重要的人工智能系统之一。
您可能以前听说过Watson ,特别是当它在(Watson)Jeopardy!游戏中击败人类对手时!它也不仅仅是一个玩具,您可以使用他们的技术构建一个可行的聊天机器人,然后将其与您自己的业务或个人用例集成。
免费帐户每月最多允许对Watson Assistant进行 10,000 次(Watson Assistant)API调用。对于大多数个人用户来说,这已经足够了。对于我们将在这里做的事情来说,这当然足够了!
将其分解为基础
在深入了解使用Watson Assistant构建聊天机器人的具体细节之前,让我们先谈谈我们想要实现的目标。
聊天机器人的基本目的是解释用户在说什么,然后弄清楚该怎么做。在Watson Assistant中,有一种称为意图(intent )的东西,它基本上是用户想要实现的操作。
例如,某人的意图可能是查明您是否有特定商品的库存。在这种情况下,Watson Assistant可以与您的数据库集成,然后从那里提取确切的库存水平。
意图在实体(entities)上执行,其中包含Watson将用来回复的相关信息。
在构建您的聊天机器人时,您需要经过三个步骤的循环:
在本指南中,我们将经历此循环的一次迭代,向您展示Watson 聊天机器人(Watson chatbot)的核心构建块(core building block)。
入门
您要做的第一件事是前往Watson Assistant页面并注册(page and sign)。我们使用了免费的“Lite”包,它可以让您免费构建任何您想要的聊天机器人。只需单击(Just click) “免费入门”(Get Started for Free) 并按照说明进行操作。
完成所有数字文书工作后,您将进入IBM Watson Assistant 简介(Introducing IBM Watson Assistant )页面。现在单击创建工作区(Create a Workspace)。
现在单击创建。( Create.)
现在只需命名您的工作区并添加描述(name your workspace and add a description)。
在我们添加自定义意图之前,您应该做的第一件事是添加一些IBM已经为我们准备好的通用意图。这使您不必每次都从头开始教您的机器人基本(bot basic) 对话内容。(conversation stuff)
为此,在 Intents 下单击Content Catalog(Content Catalogue),然后单击 General类别旁边的Add to Workspace 。
机器人现在能够理解一般对话,例如问候语。要查看其工作原理,请单击Dialog选项卡,然后单击Create Dialog。将自动生成两个对话节点 - Welcome 和Anything else。
单击欢迎(Welcome )以展开它。
在这里可以看到对话节点(dialog node)的基本结构。如果机器人识别出某个条件(例如意图),那么它将以您定义的方式做出响应。
虽然在这种情况下我们没有创建自定义意图,但让我们转到Intents 选项卡(Intents tab)并查看名为 # General_Greetings的意图。只需单击(Just click)意图列表中的#General_Greetings即可打开它。
这正是您制定自己意图的方式。给它起个名字,给它一个描述,并添加尽可能多的方式来让用户表明这个意图。在这里, IBM已经为我们完成了这项工作,但它的工作原理非常清楚。您还可以通过添加更多示例来修改此现有意图。也许用你自己的地方方言。
我们将使用此意图作为聊天机器人对话框的一部分,因此返回对话框选项卡(head back to the dialog tab)并单击创建对话框(Create Dialog)。我们的自定义对话框(custom dialog)将发生在Welcome 和 Anything(Welcome and Anything) else 节点之间。您所要做的就是单击添加节点。(Add node.)
我们将称这个节点为 Friendly Greetings ,并使用#General_Greetings意图为其提供动力。所以在如果机器人识别(If bot recognizes)下 ,只需输入意图的名称并从下拉菜单中选择它。
现在我们将我们的响应保留为“文本”,并写下我们希望机器人说什么来响应我们的问候。
您可以通过单击X按钮关闭对话框节点。(dialog node)现在我们应该有一个可以响应基本问候语的机器人。单击页面右上角的 Try It 按钮以测试我们目前构建的机器人。在弹出 的聊天栏中(chat bar)输入 Hello ,看看会发生什么。( Hello )
哇!Watson认识到我们的意图是迎接它,然后使用我们在对话构建器(dialog builder)中指定的规则进行响应。恭喜,您刚刚完成了构建聊天机器人的完整周期!
高级功能
虽然您可以使用这个基本的步骤循环来构建一个非常棒的聊天机器人,但Watson Assistant当然还有更多的功能。使用此工具的所有功能,您可以构建一个机器人来处理预订或为用户提供库存产品列表。
天空是极限,你不必成为一些高科技天才就可以开始。IBM有大量的教程视频和文档可以帮助您成为聊天机器人大师。既然你已经尝到了味道,没有什么能阻止你!
Build a Chatbot with IBM Watson Assistant
If you’ve used Siri, Alexa or the Google Assistаnt you’re already familiаr with how a chatbot works. It’s a piece of software that lets you interact with your computer by having a conversation with it. At least, it tries to have a conversation with you. Historically chatbots have been rather clunky and not all that useful.
Now things have changed considerably. We use our voice assistants all the time and they almost always understand what we mean. Log on to virtually any commercial site and the little messaging app that pops up probably doesn’t have a real person behind it, offering to help you.
Chatbots are revolutionizing the way we use computers, but modern chatbots are complex to code and laborious to train. Which is why we now have plenty of companies offering chatbot builders to make the process (relatively) easy.
The leader in the AI technology running the world’s best chatbots, IBM, actually offers a chatbot building tool you can try for free. It’s called IBM Watson Assistant and lets anyone leverage one of the foremost AI systems in existence.
You may have heard of Watson before, specifically when it beat human opponents in games of Jeopardy! It’s not just a toy either, you can build a viable chatbot using their technology and then integrate it with your own business or personal use cases.
The free account allows for up to 10,000 API calls to Watson Assistant per month. For most personal users this will be more than enough. It’s certainly enough for what we’ll be doing here!
Breaking It Down to the Basics
Before we get into the nuts and bolts of building a chatbot with Watson Assistant, let’s talk about what we want to achieve.
The basic purpose of a chatbot is to interpret what the user is saying and then figure out what to do about it. In Watson Assistant there’s something called an intent which is basically the action that the user wants to achieve.
For example, someone’s intent may be to find out if you have stock of a particular item. In which case Watson Assistant could be integrated with your database and then pull the exact stock levels from there.
Intents are performed upon entities, which contain the relevant information Watson will use to reply.
When building your chatbot you go through a loop of three steps:
- Creating intents and entities
- Building the dialog tree
- Trying out your chatbot!
In this guide we’ll be going through one iteration of this loop, to show you the core building block of a Watson chatbot.
Getting Started
The first thing you’ll want to do is head over to the Watson Assistant page and sign up. We used the free “Lite” package which lets you build any chatbot you want without obligation. Just click Get Started for Free and follow the instructions.
Once you’ve done all the digital paperwork, you’ll end up on the Introducing IBM Watson Assistant page. Now click Create a Workspace.
Now click Create.
Now just name your workspace and add a description.
Before we add our custom intent, the first thing you should do is add some common intents that IBM has already prepared for us. This saves you from having to teach your bot basic conversation stuff from scratch every time.
To do this, under Intents click on Content Catalogue and then click Add to Workspace next to the General category.
The bot now has the ability to understand general dialog, such as greetings. To see how this works, click on the Dialog tab and then click Create Dialog. Two conversation nodes will be automatically generated – Welcome and Anything else.
Click on Welcome to expand it.
Here you can see the basic structure of the dialog node. If the bot recognizes a certain condition (such as an intent) then it will respond in the way you define.
While we didn’t create a custom intent in this case, let’s head over to the Intents tab and have a look at the intent called #General_Greetings. Just click on #General_Greetings in the list of intents to open it.
This is exactly how you would make your own intent. Give it a name, give it a description and add as many ways as you can think of that the user would indicate this intent. Here IBM has already done the work for us, but it’s perfectly clear how it works. You can also modify this existing intent by adding more examples. Perhaps in your own local dialect.
We are going to use this intent as part of our chatbot’s dialog, so head back to the dialog tab and click Create Dialog. Our custom dialog is going to happen between the Welcome and Anything else nodes. All you have to do, is click Add node.
We are going to call this node Friendly Greetings and are going to use the #General_Greetings intent to power it. So under If bot recognizes just type the name of the intent and choose it from the dropdown menu.
Now we leave our response as “text” and write what we want the bot to say in response to our greeting.
You can close the dialog node by clicking on the X button. Now we should have a bot that can respond to a basic greeting. Click the Try It button at the top right of the page to test the bot we’ve built so far. Type Hello in the chat bar that pops up and see what happens.
Wow! Watson recognizes our intent is to greet it and then uses the rules we specified in the dialog builder to respond. Congratulations, you’ve just gone through one full cycle of building a chatbot!
Advanced Features
While you could build a pretty awesome chatbot using this basic loop of steps, there is of course much more to Watson Assistant than this. Using all the features of this tool you could build a bot that takes care of bookings or gives the user a list of products that are in stock.
The sky’s the limit and you don’t have to be some highly-technical genius to get going. IBM has plenty of tutorial videos and documents to turn you into a chatbot master. Now that you’ve had a taste, nothing should hold you back!