Create and share your first Mantium AI app using OpenAI

Making AI easy to get started with

Introduction

In this guide, we will be using OpenAI to translate difficult text into simpler concepts. For example, imagine that a second-grader asked you to explain quantum mechanics; we will create an AI to help with that. This is an example from the OpenAI prompt examples.

Below are the steps that you will follow on the Mantium platform to create your first prompt.

Step 1 - Register for a Mantium account

If you do not already have an account, register on the Mantium platform.

Step 2 - Add new Integration

After registering, you will be presented with the interface below. Navigate to the Integration tab to connect your API keys before you start creating your prompts.

For this guide, we will configure a new Open AI Integration. Click on the "Add new Integration" button as shown in the image above.

You will be presented with the Modal below, click on "OpenAI"

Step 3 - Insert your API Key

Copy and paste the API key for OpenAI in the input field as shown below. You will not be able to see the API key you have stored in the system again. It is stored encrypted and is only decrypted at the point in time it is passed to Open AI with your prompts. It is never logged, cached, or stored unencrypted in any fashion in the Mantium architecture.

Now you are ready to create your first prompt!

Step 4 - Add new Prompt

The next step is to add a new prompt. On your dashboard, navigate to the "AI Manager" drop down tab on the left hand side, click on "Prompts", and click on the "Add new prompt" button, as shown below.

Step 5 - Add new AI

Basic Info

Now, you are set to create your own prompt, you will need to fill in the basic info. For now, give your prompt a name in the "Name of Prompt" field, and a description in the "Description" field.

As described above, we will create a prompt that summarizes difficult text for a second-grader, so you can provide the details as shown below and leave the rest of the basic info settings empty for now.

Name of Prompt - Summarize for a 2nd grader

Description - This prompt translates difficult text into simpler concepts

Provider

Choose a provider and an endpoint as shown below.

  1. Provider - For this example, we will interact with the OpenAI API, select the "OpenAI" provider
  2. Choose an Endpoint - Here you will select the "Completion" Endpoint, which is suitable for this example. This endpoint provides the model with some text, and generates a text completion that tries to fit the context of the provided text.

Endpoint and Basic Setting

  1. Enter the Prompt - Here you will need to enter the prompt. You can copy the text below and paste in the input field (See image above)
My second grader asked me what this passage means:
"""
Jupiter is the fifth planet from the Sun and the largest in the Solar System. It is a gas giant with a mass one-thousandth that of the Sun, but two-and-a-half times that of all the other planets in the Solar System combined. Jupiter is one of the brightest objects visible to the naked eye in the night sky, and has been known to ancient civilizations since before recorded history. It is named after the Roman god Jupiter.[19] When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows,[20] and is on average the third-brightest natural object in the night sky after the Moon and Venus.
"""
I rephrased it for him, in plain language a second grader can understand:
"""
  1. Choose an Engine (Davinci) - Here, you will select an engine. For this example, we are using the OpenAI API, which supports various models with varying capabilities. These models are described and accessed using engines. For this example, we selected the "Davinci" Engine. It is the largest engine, but also costs the most. If you would like to use a smaller engine, you may choose Ada, Babbage, or Curie.
  2. Response Length(60) - Now set the "Response Length" value to 60. The Response Length is just to control the length of an output response, and it varies based on the type of Completion example you are trying out.
  3. Temperature (0) - The temperature controls how much randomness is in the output; it is one of the most important settings as it significantly impacts the output. A lower temperature is advised for a prompt that requires a well-defined response. While, for creative and interesting responses, a higher temperature value is suitable.
    For this example, you can set the temperature value to 0
  4. Top P (1) - The **Top P value is an alternative way of controlling the randomness and creativity of the text generated by the model. It is recommended that only one of the Temperature and Top P values are used, so we will set the Top P value to 1.**
  5. Stop Sequencen (""") - This parameter allows you to define any sequences that force the model to stop. If you don't have a stop sequence, the model might generate a stream of text until the requested length and then stop or stop in the middle of the sentence. For this example, the Stop Sequence is """

You can leave the rest of the Advanced Settings empty for now.

Test Run Prompt

After completing the above, hit the "Test Run" button, and you can see your response in the Results field.

Now click the "Create and Finish" button to create your prompt.

Deploy your Prompt

Congratulations! You can now ask this prompt to summarize text for you. Now it is time to share with the world by deploying your prompt. Mantium makes it simple to share what you've created as a single page application by clicking a button.

Navigate to the Prompts section by clicking "AI Manager", and then "Prompts".
You will be presented with the interface below, which shows a list of the prompts that you've created. Click on the Prompt, and a pop-out will appear on the right-hand side.

Click on the deploy button as shown below to deploy your prompt.

As shown in the image below, you will fill out the "Name", "Description" and "Author Name", also check the boxes for placeholder text and approval. If your prompt could output anything considered ‘mature’ you should check the "Intended for adult use only" box.

We recommend that all deployed applications are protected by security policies. Try adding a security policy in the Prompt Editor.

Click on the Deploy Button to deploy the prompt.

Going Forward

Now you should be comfortable with creating prompts. The pointers below will help with further exploration.

  1. More OpenAI Examples - Visit OpenAI's examples lists or more examples to explore what's possible with the Mantium platform.
  2. Import Prompts button - The "Import Prompts" button will help to easily import prompt setting using a curl command text.

Example

On the OpenAI example website, select an example prompt, and scroll to the bottom of the page. Copy the curl command text in the API request box.

Paste the curl command text in the Importing Prompt modal, after this click on "Import this prompt".

  1. Check out and integrate with AI21
  2. Check out and integrate with Cohere