Writing improvement
A popular online community relies on user-generated content to thrive. Users frequently contribute reviews, articles, and comments, but the quality of these contributions varies. To elevate the overall experience for its members, the community aims to enhance user-generated texts. This includes fixing grammar errors and refining writing tones to create a more polished and engaging environment for all users. Your task is to build a multi-step prompt that proofreads and adjusts the tone of a given text
.
The OpenAI
package, the text
string to operate on, and the get_response()
function have been pre-loaded for you.
This exercise is part of the course
Prompt Engineering with the OpenAI API
Exercise instructions
- Craft a multi-step prompt that first proofreads the text without changing its structure, and then adjusts its tone to be formal and friendly.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
client = OpenAI(api_key="")
# Craft a prompt to transform the text
prompt = ____
response = get_response(prompt)
print("Before transformation:\n", text)
print("After transformation:\n", response)