I write a newsletter called Above Average, where I talk about the second-order insights behind everything that is happening in the big tech. If you are into tech and want to be above average, subscribe to it.
I don’t know if prompt engineering will actually become a role in companies in the future. But writing better prompts will become more and more important if you want to be more productive. So, to learn how to write better prompts to get the desired output, I did a short course on Deeplearning.ai called ChatGPT Prompt Engineering for Developers.
Here are some takeaways that will help you become a better prompter.
from openai import OpenAI
client = OpenAI()
client.api_key = 'YOUR_SECRET_KEY'
text_1 = f"""
Making a cup of tea is easy! First, you need to get somewater boiling. While that's happening,
grab a cup and put a tea bag in it. Once the water is
hot enough, just pour it over the tea bag.
Let it sit for a bit so the tea can steep. After a
few minutes, take out the tea bag. If you
like, you can add some sugar or milk to taste.
And that's it! You've got yourself a delicious
cup of tea to enjoy.
"""
prompt = f"""
You will be provided with text delimited by triple quotes.
If it contains a sequence of instructions, \
re-write those instructions in the following format:
Step 1 - ...
Step 2 - …
…
Step N - …
If the text does not contain a sequence of instructions, \
then simply write "No steps provided."
"""{text_1}"""
"""
response = client.chat.completions.create(
model="gpt-4",
messages=[
{
"role": "user",
"content": prompt
}
],
temperature=0,
#max_tokens=64,
#top_p=1
)
print(response.choices[0].message.content)
That’s it for day 2 of 100 days of AI.
Follow me on Twitter for the latest updates on 100 days of AI, or bookmark this page.
Also published here.