Musical Discovery

Everything is so easily acquired these days. Well maybe not these current specific days, but these times in general. For 3.0 Phish everything is available; soundboard audio, webcast, webcast rips…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Conclusion

I am just finished with the AI Chatbot implementation for one of my project, its integrated with IBM Watson. Nowadays every client wants to see AI in their product. So today I’ll be explaining you a very simple Chat bot integration with the help of IBM Watson!.

The + point of Watson is that you can easily train the chat bot (like adding the chats) on Bluemix admin panel(we will discuss this in the second part of article).

For this part we will be starting off with Assistant SDK.

2. After successful login by default you will be landed on the Dashboard page, from there click on “Create Resource

3. on the catalog page search for “watson assistant” and open it.

4. now you will be redirected to Watson Assistant page, where you have to create service instance. Name your service and create.

on success, you will be presented with the Assistant screen where you have your credentials, also copy the username and password in different file, we need to configure these in our iOS project.

Now on the same screen click on the “Launch tool

5. In the new tab, IBM Watson Assistant page gets loaded, now select the “Workspaces” tab. In the workspace window you will have the default virtual assistant sample; named Customer Service.

Select the “Customer Service” virtual assistant

6. This is the screen where we can add or customize the conversation.

also copy the Workspace ID form “Deploy” tab in same screen.

­­For the convenience, I’ve already setup a project, integrated with basic chat functionality and model class (Source: QuickChat).

Download the source code from below link:

In the project directory you will have two files Podfile and Cartfile, before opening the project we have to configure these files in terminal.

3. Install “Cartfile” using below command.

First you need to install Carthage in your terminal if not already installed.

Double-click Carthage.pkg to run the installer. Click Continue, select a location to install to, click Continueagain, and finally click Install.

And you’re done! To check that Carthage installed correctly, open Terminal and run the following command:

If all has gone to plan, you’ll see the version number of Carthage that was installed.

Now run the following command:

2. now click on “Add other…”, open Carthage folder -> Build -> iOS -> and Open “AssistantV1.framwork

3. after completing the process you should see frameworks added in you “Embedded Binaries” and “Linked Framework and Libraries” like this

4. open the BMSCredentials.plist file and add you’re Assistant API credential (copied earlier)

What this function does is that, it takes the Assistant credentials(username, password, workspaceId) and establish a connection with it. On successful connection it retrieves the first message from Watson.

2. now retrieve the first(default) message from Watson and update the “context” object

This method is already declared in “instantiateAssistant” function.

There is a reason to update the context and we have to update this object on every call from Watson. The “context” object keep the track of conversation through out the session. This method is already declared in “instantiateAssistant” function.

Let’s test it!

If you got the first message from Watson then we are good to go.

3. now we need to implement the last method, so that user can continue the conversastion.

Declare this method in sendMessage function and pass the text var.

Now your code should look like this:

Now run the app and start the conversation with bot.

In this article we learned how we can make a simple chat bot iOS app within some time using Watson. Moving forward; soon I’ll be publishing next article in which we will see how we can integrate Watson’s other SDK’s like Discovery and Text-To-Speech and configure a new chat bot in Watson.

Add a comment

Related posts:

About Me

Have some experience merchandising dust worldwide. Crossed the country short selling race cars in Africa. Lead a team consulting about Side Effects Of Vashikaran foreign currency in Libya. My current…

How to Communicate Effectively at Workplace?

We sit in meetings and intend to convey our opinions righteously with the people on board but with our busy schedules, it is easy to lose sight of the importance of effective communication in the…

The Final Code

I need to know which tag to call before I can use it later using python. After hours of inspection, i found that: Those codes above are quite messy, not professionally coded. Usually on the…