This article describe some key takeaways concept that I learnt from the Coursera course.
This goal of this article is to summarise what I learnt from the Coursera
course: ChatGPT Prompt Engineering for
Developers
as well to share few prompt engineering articles that I enjoy reading. Hope
this is helpful for people who want to learn how to write good ChatGPT prompts
and have some hands-on prompt engineering experience.
From the course, we learn that ChatGPT is quite powerful and capable of
performing a lot of NLP tasks such as inferring, summarisation, transforming
(e.g., converting extracted information to JSON format) and others tasks. In
order to achieve good performance and getting desired output format, it is
important to follow these prompting principles: (1) Write clear and clear
instructions (short != clear) and (2) Give the model time to “think” and (3)
Use delimiters to clearly indicate distinct parts of the input. For the
principle (2), what it means is actually to ask ChatGPT to think or explain the
solution step by step.
In the following section, we will see examples that demostrate different kind
NLP tasks that ChatGPT is capable of and also to demostrate how to write good
prompts based on the principles that we described above.
ChatGPT answered:
It was pretty impressive! Look at the example, we use delimiter to specify text
to be summarised and question to be answered. We write clear instruction and
describe the desired output format to ChatGPT. It performed 5 different tasks
accurately: Summarisation, translation, named entity extraction, transforming
and Question-answering.
Let’s look at another example that demo the principle-(2): Think step by step.
Again, the answer and step-by-step explanation are correct.
Personally, I’m interested in using ChatGPT to perform information extraction
on unstructure text data. Specifically, extracting key financial indicator
values such as Earning-per-share (EPS), dividend, net-asset-value (NAV) from
text. Let’s try them:
ChatGPT answered:
Type of Indicator
Year
Value
Diluted earning per share (cent)
2021
Information not found
Basic earning per share (cent)
2021
Information not found
Dividend
2021
3.10 cents per share
Number of share (NOS)
2021
Information not found
Net asset value (NAV)
2021
Information not found
Diluted earning per share (cent)
2020
Information not found
Basic earning per share (cent)
2020
Information not found
Dividend
2020
3.00 cents per share
Number of share (NOS)
2020
Information not found
Net asset value (NAV)
2020
Information not found
The results are all correct! The provided text is all about dividend and no
additional information for other indicators.
That’s it. I recommend everyone to try the free prompt engineering course on
Coursera to get some hands-on experience and play with the notebooks. You don’t
even have to generate your own openai api key and setting up the env. If you
wish to learn more about prompt engineering, please check out the following
articles or resources: