Build an AI Text Summarizer App with OpenAI GPT-3

Build an AI that summarizes complex text body

Is this your first time building No-Code AI Text Applications ? Check out this article for high-level explanations of some concepts.

  • To test out a pre-configured version of this application, click here!
  • Click here to connect with us on Discord

Getting Started

  • If you do not already have an account, register on the Mantium platform.
  • In order to create prompts with OpenAI as a provider, you must add your OpenAI API Key into the Mantium platform. If you don’t have an OpenAI API key, click here to learn how to obtain one.
  • Once you are logged into your Mantium account, Navigate to Integrations > AI Providers, then paste your API key into the OpenAI form.
14501450

Add Integration

Use Case

To demonstrate the summarization capabilities of a large language model, we will be building a prompt that summarizes a complex paragraph into plain-language explanation.

Prompt Creation

When you are ready to create your prompt, click AI Manager > Prompts > Add New Prompt.

28802880

Add Prompt

Then, fill out the following:

  • Name of Prompt: Simplify and Summarize
  • Description: Simplify and summarize a complex topic using OpenAI Completion.

Note that the above could be any Name or Description.

Provider Settings

Before filling out the Prompt Text, select the AI Provider settings as shown in the list below.

  • Provider: OpenAI
  • Endpoint: Completion
  • Model: Text-davinci-001

See OpenAI’s Engine Documentation for more explanations on Provider Settings

Prompt Body

Here is where you will provide the model with examples of paragraphs and corresponding summaries. This is a pattern that guides the language model on how to summarize your input paragraph.

Let’s examine one of the examples to better understand this.

Original Content
This is the original content.


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. When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows, and is on average the third-brightest natural object in the night sky after the Moon and Venus.

Summarized Content
This is the summary of the original content.


In summary, Jupiter is a planet that is bigger than all the other planets in our solar system and is very bright when you see it in the night sky. 

It is named after the Roman god Jupiter. When viewed from Earth, it is usually one of the three brightest objects in the sky.

The prompt consists of multiple examples just like the above to provide the summary of any given text paragraph.

We prepared a Prompt Sample below, copy this and paste in the Prompt Text field.

This is a summarization application. Given a text, it provides a summary of the text. 

Here are some examples:

###
Example 1.
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. When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows, and is on average the third-brightest natural object in the night sky after the Moon and Venus.

In summary, Jupiter is a planet that is bigger than all the other planets in our solar system and is very bright when you see it in the night sky. It is named after the Roman god Jupiter. When viewed from Earth, it is usually one of the three brightest objects in the sky.

###
Example 2.
In the east, a guy abandoned all worldly concerns and moved to a forest, where he constructed a hut and lived in it. He merely wore a piece of cloth around his waist as his only article of clothing. But, as fate would have it, rats abound in the woods, so he was forced to keep a cat. He had to keep a cow because the cat need milk. The cow needed to be tended to, therefore a cowboy was hired. The boy needed a place to reside. As a result, he was given a home. A maid had to be hired to look after the house. A couple additional houses had to be built and people asked to reside in them to keep the maid company. A small township sprouted up in the lovely wood in this fashion.

In summary, a man gave up all worldly possessions and moved into a beautiful wood block. Rats bothered him. As a result, he kept a cat. He kept a cow to feed the cat. Then a cowboy, a maid, and her companions arrived one by one. They required living quarters. As a result, the forest became a town.

###
Example 3.
The noblest things performed on our planet have never been done for the sake of riches. Lord Jesus did not come down and die on the cross for the sake of money. Where they battled and died at Thermopylae, the Spartans hoped for no reward. Socrates, the philosopher, asked his countrymen for no money and spent his days barefooted, just worrying about making them decent and honorable. Even now, there are heroes who perform honorable things for no monetary gain. Our forefathers did not go out to make money when they sailed out one by one into the bleak freezing seas, and neither did the ladies who went to work in the East's hospitals make themselves impoverished in order to make money doing noble work.

In summary, great men have done the noblest things for reasons other than money. Jesus, Socrates, the Spartans, explorers, and hospital nurses all served humanity just for the purpose of serving.

###
Example 4.
Nelson lacked physical strength as a child. Nonetheless, he demonstrated the firm heart and high spirit that had marked him throughout his illustrious career. He left his grandmother's house one day in the company of a cowboy. He was nowhere to be located as the supper hour passed. The family was terrified because they thought he had been kidnapped by gypsies. After a long search, he was eventually spotted sitting calmly by the side of a brook he couldn't cross. "I'm surprised, kid," the old lady remarked when she saw him, "that hunger and dread did not drive you home." "Fear! grandmama," the future hero said, "I've never seen fear; what is it?"

In summary, even as a toddler, Nelson demonstrated his fearlessness. He wandered away from his grandmother's house one day and did not return, even when dinner was served. Finally, he was discovered sitting by a brook. To his grandmother's surprise that hunger and terror could not bring him home, he responded that he had never seen fear and had no idea what it was.

###
Example 5.
We cannot live alone from the moment we are born; we require the help of everyone around us for body, soul, and spirit; we require clothes made by other men, houses built by other men, and food produced by other men; we must earn our living by working for others, while others earn their living by working for us. As children we need our parents to be our comforters, and to take care of others: we can not exist a day without our fellowmen; we require teachers to educate us: books and masters to teach our trade; and when we have learned it and settled ourselves in life, we require laws made by other men who died hundreds of years before we were born, to secure to us our rights and properties, to secure to our comforts in our station; and we need friends to comfort us in sorrow and to share our joy.

In summary, in this world, we cannot exist alone. We require the assistance of a variety of individuals, including farmers for food, weavers for cloth, masons for houses, teachers for education, attorneys for property, and, most importantly, parents to raise us in our youth.


Prompt Settings

Basic Settings

  • Response Length: 100
  • Temperature: 0.6
  • Stop Sequences: ###

(Click on Add Stop Sequence to add one)

You can ignore Tags and the Advanced Settings

17551755

Overview of the application

Test Prompt

After completing the above, you can test with the example Input text below. Copy and paste the example in the Input field, and then click Test Run to see the response in the Results field!

Feel free to click Test Run multiple times - due to the stochastic nature of natural language models, it is possible that you may receive a different result the next time you run the prompt.

Input Text

Charity is a universal duty, which it is in every man’s powers sometimes to practice, since every degree of assistance given to another on proper motives, is an act of charity; and there is scarcely any man in such a state of weakness that he may not on some occasion benefit his neighbor. He that can not relieve the poor may instruct the ignorant, and he that can not attend the sick may reclaim the vicious. He that can give little assistance himself may yet perform the duty of charity by inflaming the ardor of others and recommending the petitions which he can not grant, to those who have more power to bestow. The widow that shall give her mite to the treasury, and the poor man who shall bring to the thirsty a cup of cold water, shall not lose their reward.

10481048

Testing the prompt

On the top right corner of the screen, Click Save when you are ready to save your prompt. Notice that you can also deploy the prompt from here. See next section for explanation on how to deploy this prompt.

One-Click Deploy

Mantium enables sharing your prompt using the One-Click Deploy feature, located in each prompt's drawer view or the top right corner of the Edit Prompt interface. From your list of prompts, click on the Simplify and Summarize prompt, then click Deploy.

14501450

Deploy Prompt

Then, add the following configuration settings:

  • Name: Simplify and Summarize
  • Description: Summarize a complex paragraph about Jupiter using OpenAI Completion.
  • Author Name: Your Name
  • ✅  Add Input Field
  • ✅  Public
  • ✅  Live
  • ✅  I have followed my provider's go live requirements

Deploying a prompt will create a single-page application with a unique URL that can be shared if the prompt is deployed as Public.

28802880

To interact with this prompt, simply click Execute in the deployed prompt - each time, the model will create a summarized explanation of the prompt text from above. Creating an interactive Completion prompt requires creating a pattern of text for the model to follow - learn how in the Game Concept Generator tutorial!