Are you a software developer interested in creating a tool that can rewrite paragraphs, articles, and other text? OpenAI’s new ChatGPT tool is amazing at rewriting content. But how do you use it in your own app? In this brief post, I’m going to show how you can use the Open AI playground to create a text rewriter that you can then use in your own software or website by calling it via OpenAI’s api.
I won’t dive into the Open AI Playground in this article. However, if you don’t have any experience with it, check out learning the OpenAI playground step-by-step.
At the time of this writing, the free version of ChatGPT uses the gpt-3.5-turbo model with Chat mode. ChatGPT Pro uses Chat mode with the gpt-4 model. This of course means for our text rewriter we need to use the Chat mode with one of these two models. Because gpt-4 is expensive and 3.5 turbo is excellent at rewriting text, we’ll use GPT-3.5-turbo for this demo.
The system instruction is how we customize ChatGPT to excel in a specific task; in this case rewriting text. Below is what I entered for our text rewriter:
Please input the article you would like me to rewrite in your own words:
I use the Assistant instruction to tell the gpt-3.5-turbo model to rewrite the text that will be entered by the user. Below is the instruction I used:
Rewrite the following article in your own words:
The user message is where we accept the text from the user to be rewritten. When calling the OpenAI API from our software, we would pass in the System and Assistant messages along with the User message. Below is my user-inputted text for my example.
After passing in the System message, the first Assistant message, and the User message, we receive back the rewritten text in the form of a returned Assistant message. Below is the returned text from the playground. The same would be returned if using the API as well.
Below is a screenshot of the designed text rewriter as seen in the Open AI Playground. With just a few instructions, we created a really high quality text rewriter.
When incorporating the api call into your software, you can also continue to collect and pass back and forth all the Assistant and User messages. Doing so will strengthen the text rewriter by allowing it to understand context and learn from its ongoing interaction with the user.