html and css code for a nav bar

Prompt Engineering and chatGPT

Reading Time: 3 minutes

If you follow chatGPT and AI courses you will often come across the term “Prompt Engineering”. Prompt Engineering is the art and science of writing instructions so that AI understands what you would like to do. With time and practice you can be as specific as you like. You can fine tune your request until you get precisely what you are looking for. 

The Limit of chatGPT. 

“As an AI language model, my responses are generated based on a mixture of licensed data, data created by human trainers, and publicly available data. These sources may contain publicly available information up until my knowledge cutoff in September 2021. It’s important to note that I do not have direct knowledge of specific data gathering practices or the individual sources used to train me.”

chatGPT

The limit of chatGPT is that it goes up to September 2021. This means that code solutions for specific apps, like a css style sheet for calckey.social won’t work. You need to ask questions about CSS and adapt the resulting code to work with Calckey or other newer code. 

Writing Tic Tac Toe and Hangman

Last night I asked chatGPT to write Tic Tac Toe, Hangman and a ToDo app in C++, php and java. The results were variably successful but this shows the power of chatGPT. In theory you could browse to github or other website and just cut and paste the code. The result is similar, but with one key difference. 

With chatGPT you can ask “create a simple nav bar that changes colour on mouse over using UL and LI tags and it will generate that code for you. 

“please create a simple nav menu using html ul and li elements and style it with css so that text is highlighted on mouseover”.

html and css code for a nav bar
html and css code for a nav bar

The point is that chatGPT can write entire apps, if you engineer the right prompt, but it can also generate snippets of code for you with a specific result in mind, as in the example above. 

Show something in a table

When you ask chatGPT for a table of things to do in barefoot shoes
When you ask chatGPT for a table of things to do in barefoot shoes

Show something in an HTML table

When you ask chatGPT for a table of things to do in barefoot shoes in html
When you ask chatGPT for a table of things to do in barefoot shoes in html

As you see chatGPT understands the instruction, provides me with a result which I can then tweak to match my desired outcome. Instead of spending ten to fifteen minutes writing and formatting the table with this data, I can get chatGPT to do it for me. 

In What is Generative AI Pinar Seyhan Demirdag said of AI that “AI does the work and humans focuses on the vision, the idea and the purpose.” In other words AI is an assistant. The more you study prompt engineeering, and the better you get at getting the desired outcome, the more useful and valuable AI, and your skills in using AI become. 

And Finally, For Now

AI behaves like a person. The more clearly and concisely your instructions are, the more the output will reflect your desired outcome. AI is constantly learning from Big Data. Our task is to learn how to give instuctions, prompt engineering, as it’s called within the industry, so that AI provides the results we require, saving both time, and to some degree, learning. I have just scraped the surface. I want to learn more.