Build an AI Travel Guide Conversational Chatbot with Mantium & Twilio

The Mantium Platform supports deploying your application via the Twilio messaging service, which means that you can send input and get responses using your text messaging devices. This tutorial will build a conversational travel guide chatbot that you can interact with via SMS text messages. You can ask interesting questions about your trip or place of visit and the AI will respond.

Use Case

Traveling to a new location sometimes poses a challenge. As a Tourist, you need to have good information about popular tourist attractions, the history of tourist sites, how to connect between cities, to mention a few. AI can offer that information any time of day over text message.

324

Connect your Mantium App to Twilio

Here is a detailed guide on how to perform the integration; this is an initial step in building your application and deploying it via Twilio.

Take a minute to complete this step, after which you can continue reading this tutorial.

The following will explain the steps to build your conversational travel guide AI application. Are you familiar with building AI applications on Mantium? You can skip to the Twilio deployment section here. Otherwise, read along as we talk about the prompt creation and deployment processes.

Create your Prompt

Let’s create the prompt. Click AI Manager > Prompts > Add New Prompt, and fill out the following:

  • Name of Prompt: Travel Guide
  • Description: A conversational chatbot for traveling

Tags and Intelets can be left blank.

Provider Settings

In the Mantium App, there are several model providers; select the provider shown below, and populate the rest of the setting values.

  • Provider: OpenAI
  • Endpoint: Completion
  • Engine: Davinci

This tutorial is a completion use case, which means that the model will generate text to match the provided patterns in the Prompt. The OpenAI models are described and accessed using engines. For this example, we selected the "Davinci" Engine. It is the largest engine. If you want to use a smaller engine, you may choose Ada, Babbage, or Curie.

Prompt Body

Here we provide example patterns that fit this use case: conversations with an AI about traveling. It’s our way of telling the model clearly what we want in the application. Copy the example below and paste it into the Prompt Line input field.

Human: Hello, who are you?
AI: I am an AI created by Blessing. How can I help you today?
###
Human: Where is Spain located ?
AI: I wish I knew, but Google tells me it is in Southwestern Europe.
###
Human: What are the popular tourist attraction in London?
AI: There are a lot of places to visit in London , for instance, Tower Bridge, the London Eye and 10 Downing Street. You can also visit the Queen at Buckingham Palace, or take the perfect picture with Big Ben.
###
Human: Any Island that I can visit for vacation?
AI: Hawaii is one of the most popular islands to visit.
###
Human: How do I book cheap hotels ?
AI: Here is what I can come up with; hotels.com, Expedia, Hotelsclick.com or Booking.com are popular places where you can book cheap hotels. You can search for travel deals to your destination too.
###
Human: Where can I go climbing ?
AI: You can visit Kalymnos, Greece. The weather makes year-round climbing possible, and the best two times to visit Kalymnos are in the spring (April and May) and the autumn (September and October).
###
Human: Where is the cheapest warm place to vacation?
AI: You can visit Bali, Thailand, Canary Islands in Spain. The Canary Islands offer over 80 beaches for spending the holiday on.
###
Human:

Prompt Settings

After a few iterations, here are the input values for the basic settings section.

  • Response Length: 150
  • Temperature: 0.8
  • Top P: 1
  • Frequency Penalty: 0.5
  • Presence Penalty: 0.6
  • Stop Sequences: ###

Notes on Prompt Settings

Response Length controls the length of the output response. For example, the response length is 150 tokens because the answer is a detailed reply from the AI containing descriptive information about the question asked or input query.

Temperature controls "creativity" - higher temperatures will produce more creative outputs but are less likely to adhere to structure. Conversely, a lower temperature is advised for a prompt that requires a well-defined response, as the model will choose words with a higher probability of occurrence. For this use case, a temperature value of 0.8 generates a suitable response after a few iterations.

Top P is another way to control "creativity" using a different probability method.

Stop sequences are another method of controlling output - they allow you to define any text sequences that force the model to stop. For example, if you don't have a stop sequence, the model might generate a stream of the requested response length or stop in the middle of a sentence.

Frequency Penalty prevents word repetition. If you notice the output of a model is repeating the same word, and you want it to stop repeating the same word, increase the frequency_penalty.

Presence Penalty prevents topic repetition; when the output of a model is stuck on a particular topic, try increasing the presence_penalty to have the model talk about something else.

Test Run Prompt

It's time to check our application's response before deploying via Twilio. It is also good to spend time here to check the consistency of the application and adjust the prompt settings until the desired result is achieved. The image below shows the AI's response to the question asked in the input field.

2880

You can also try it for yourself. Copy and paste the example below. You can hit the Test Run button a few times until you are satisfied with the results and click the Save button to save the application.

I want to take my fiancée to Paris, where should I take her to?

Deploying Via Twilio

Mantium enables sharing your application using the One-Click Deploy feature, which supports deploying your application via Twilio - a messaging service provider - to interact with your application through SMS text messages. For this tutorial, you can communicate with your AI Travel Guide by sending text messages to a phone number provided by Twilio and get a response back on your messaging device, e.g. a mobile phone.

Let’s deploy the application.

Ensure that you’ve integrated your Mantium account with Twilio by following the steps in this tutorial.

Next, on your Prompt page, click on your travel guide Prompt and then the Deploy button.

2880

Fill the form with your application’s information.

  • Name: Travel Guide
  • Description: A conversational chatbot for traveling
  • Author Name: Your Name
  • ✅ Add Input Field
  • ✅ Public
  • ✅ Live
  • ✅ I have followed my provider's go live requirements.

Click on Deploying via Twilio? button, see image below.

2880

Click on Copy Twilio Webhook URL and Navigate to your Twilio account. In your Twilio account, navigate to an active phone number, and paste the copied webhook URL in the A MESSAGE COMES IN field as shown below. Click the Save button.

2880

Back to the Mantium App, hit the Deploy button to complete the process.

Interacting with your AI application

Using any messaging device, preferably a mobile phone, send your input as text message to your active phone number provided by Twilio.

See example below.

324

Travel Guide Conversational Chatbot

Debugging Errors

Your application might not return a response. Here are a few pointers to help fix any issues.

A. Check the Twilio Messaging Logs. Navigate to the Monitor tab > Logs > Messaging . You can select the current log to see the result of your messaging via Twilio.

B. Check the Mantium Logs. The Mantium logs can provide information about your Prompt activities, this can be useful for debugging. To see the Mantium logs, Navigate to the Mantium App. Click on Monitoring > Logs .