Prompt Design with the Mantium App
Mantium

Prompt Design with the Mantium App

Want to generate creative text? want's to use NLP and AI in simple Steps? here you go...

I use Mantium to generate any creative text which meaningful and informational text to the world.

Mantium helps you to generate nice text using natural language processing (NLP) using different providers like OpenAI, Chohear, AI21Labs, and Mantium.

Mantium makes your job easy whether you are a developer or not, you can easily create your intended prompts for disaster outputs using NLP’s.

In this example, I am going to demonstrate an example of a prompt that uses Cohear as an AI Provider and gets the Travel Tip(s).

Requirements

  • A Mantium Account
  • A Cohere API Key

Below is what we are going to build at the end of this tutorial.

Travel Tips: Know Your Bank’s Terms - Make sure you know the terms of your bank’s foreign currency exchange program.        

You can experience it live using the following Mantium deployed link, and tell me your experience in the comment.

Travel Tip(s)

Prompt Design with the Mantium?App

The first and essential step is to design the prompt (conversational text generation task) with the Mantium platform. Prompt design is our way of guiding the GPT-3 model to give a favorable and contextual response as it enables us to provide a text input and get a generative response from the model.

Think of this like you are playing the game of charades where you give the players information to figure out the secret word. Similarly, with GPT-3, we provide just enough information for the model to recognize patterns in the training prompt.

To do this, you don’t need to have prior deep learning experience, and almost anyone can do this in a No-Code approach to build a simple text application using the Mantium interactive UI .

I will break this down into more straightforward steps that you can follow.

Step 1 — Register for a Mantium Account

Visit the app.mantium.com website to create a free account.

Step 2 — Connect your v API key.

To access the Large model through the Cohere API, you must connect your Cohere API key on the Mantium platform.

Click on AI Providers, paste your Cohere Key in the Cohear input box and click Add API Key. Notice that Mantium supports other AI providers such as Cohere , OpenAI AI21 , you can connect with their respective API keys, but for this tutorial, we build with the Cohere model.

No alt text provided for this image

If you don’t have your API key for any of the AI Providers, here is documentation on how you can get one.

Interesting Note: Mantium Provider now supports GPT-J

Step 3 — Add New Prompt

The next step is to add a new prompt. Navigate to the AI Manager drop-down tab on the left sidebar, click on Prompts, and click on the Add new prompt button, as shown below.

AI Manager > Prompts > Add new prompt

No alt text provided for this image

Step 4 — Prompt Design

Here, we will provide the information to build our training prompt.

A. Basic Info

Let’s fill in the basic information to identify our prompt. Note that you can provide any name and description.

  • Name of Prompt — International travel tips 2022
  • Description — Fundamental Travel Planning Tips for 2022

B. Add a Security Policy

Adding a security policy to your prompt allows for controlling input and output content quality — you can configure your own or use Mantium’s default policy, which is included with every account. Click Add Security Policies under Security Policies and drag Default Policies to Selected Policies. Click Done to save. You will know the policy has been applied when its name is visible under Security Policies.

C. Provider

All providers have an endpoint that supports generating text. Select the corresponding endpoint for the provider you selected. The provider endpoints related to generative text are the following:

  • OpenAI: Completion
  • Co:here: Compose — Generate
  • Mantium: Completion
  • Ai21: Complete

In this tutorial, we are using the Cohere API, Please select Cohere from the drop-down.

D. Cohere Info

  1. Choose an Endpoint — Select the Compose — Generate endpoint. This endpoint provides the model with some text and generates a text completion that tries to fit the context of the provided text.
  2. Prompt Line — Here we are going to provide the model with examples, and it will figure out the patterns to perform the given task. See below a Prompt that I designed for our Travel Planning Tips generative task.
  3. Model Settings — The Cohere engine determines the language model used to execute tasks. Cohere supports various models with varying capabilities. These models are described and accessed using engines. For this tutorial, select the “Large” model.

Travel Tips: Be Passport Ready - To avoid any complications or cancellation of plans, update your passport approximately 9 months before the expiration date
Travel Tips: Pack Enough Medication - If you take prescription medication, or need a certain remedy once in a while, make sure you pack a lot of it.
Travel Tips: Watch for Travel Advisories - As you plan to set off on your international trip, read up on any travel warnings and advisories that your local or national government may have issued.
Travel Tips: Set up Fraud Alerts - Let your credit card company know what countries you’ll be visiting, and on what dates.
Travel Tips: Use a Credit Card- If you have a credit card, use it during international travel. You’ll often get the best currency exchange rates. But, beware of transaction fees.
Travel Tips: Take a Hotel Business Card - When you’re in a foreign country, the first thing you should do when you arrive at your hotel is grabbing a business card from the front desk.
Travel Tips: Sign up for Data Roaming - Make sure your cell phone is set up to accept international data roaming.
Travel Tips: Save the Maps - Before you leave for your international trip, save the google maps to places you know you’ll visit. Also, if your hotel has Wi-Fi, use it to update any maps or information you’ve realized you’ll need.

        

Copy and Paste the above in the Prompt Line input field. Don’t forget to add an empty line after the last tip.

E. Basic Settings

Here you will provide the basic settings for the OpenAI model, see the image below.

No alt text provided for this image

  1. Max Tokens — 30
  2. Temperature — .5 (point five)
  3. Return Likelihoods — NONE
  4. K — 0
  5. P — 0.75
  6. Frequency Penalty — 0
  7. Presence Penalty — 0
  8. Stop Sequence — \n

Basic Settings Explanations.

  1. Max Tokens — Tokens are ****words or parts of words that our models take as input or produce as output. (one word tends to be about 2–3 tokens).
  2. Temperature — A lower temperature means less randomness; a temperature of 0 will always yield the same output. Lower temperatures (less than 1) are more appropriate when performing tasks that have a “correct” answer, like question answering or summarization. If the model starts repeating itself this is a sign that the temperature is too low.
  3. K — Pick from amongst the top tokens.
  4. P — Pick from amongst the top tokens whose probabilities add up to 15%
  5. Frequency Penalty — This 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.
  6. Presence Penalty — The presence penalty prevents topic repetition. If you notice the output of a model is stuck on a particular topic, and you want it to talk about something else, try increasing the presence_penalty.
  7. Stop Sequence — A stop sequence is a set of characters that signal the API to stop generating tokens.

Step 5 — Testing Prompt Results

On the Mantium platform, we can test our prompt. See the image below, I got an interesting response. This prompt does not require an input so just hit the Test run button.

No alt text provided for this image

Congratulations on completing the first prompt, now just deploy it.

No alt text provided for this image

to Deploy just fill in the basic information that appears on your shared URL

No alt text provided for this image

You will be redirected to the shared URL and your shared prompt look like this, just use execute button to generate interactive text.

https://share.mantiumai.com/prompt/9082b73f-6bf3-45a6-827c-99fa0feb152f

No alt text provided for this image

I hope this article is helpful, and you learned about what you can do with Mantium & Large Language Model. If you have something to build in mind, you can reach out to me via LinkedIn , and follow me on Twitter .

if you have any questions please feel free to reach out on Mantium Discord !

Thanks to Mantium for giving me a chance to explore the #NLP and use their platform.

Don’t forget to explore more on

https://mantiumai.com/

API Guide

https://developer.mantiumai.com/

Mantium AI JavaScript Library GitHub repository and documentation.

https://github.com/mantiumai/mantiumclient-js/wiki/

Thank you!

Kedar Kulkarni

要查看或添加评论,请登录

社区洞察

其他会员也浏览了