{"id":534,"date":"2025-01-09T22:48:39","date_gmt":"2025-01-10T03:48:39","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/chapter\/5-how-to-prompt-an-ai-tool\/"},"modified":"2025-09-07T12:53:21","modified_gmt":"2025-09-07T16:53:21","slug":"5-how-to-prompt-an-ai-tool","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/chapter\/5-how-to-prompt-an-ai-tool\/","title":{"raw":"How to prompt an AI tool","rendered":"How to prompt an AI tool"},"content":{"raw":"<h2>What is prompting?<\/h2>\r\nPrompts are the <strong>input instructions<\/strong> for AI tools to perform tasks. They can include text, data (such as tables) or images.\r\n\r\nThe input of a prompt is converted into tokens by the AI tool. Tokens represent the prompt elements converted into a form that the tool understands. These are processed and converted back into words or other outputs. The tool prompt length is limited by <a href=\"https:\/\/help.openai.com\/en\/articles\/4936856-what-are-tokens-and-how-to-count-them\">the number of tokens<\/a>\u00a0allowed to be input.\r\n<h2>Components of a good prompt<\/h2>\r\nThe more specific your prompt details are, the more relevant your output will be. Provide plenty of details, and define the task and the output you want.\r\n<h3>[h5p id=\"18\"]<\/h3>\r\n<div class=\"textbox shaded\">\r\n<h3>Prompting tips<\/h3>\r\n<ul>\r\n \t<li>Use instructional verbs: summarise, classify, write, and compose.<\/li>\r\n \t<li>Expand on prompts iteratively \u2014 your first go doesn\u2019t have to be perfect!<\/li>\r\n \t<li>Write short but detailed prompts.\u00a0Break down your tasks into a subtask list if needed.<\/li>\r\n \t<li>Tell the AI what to do rather than tell it what not to do. Negative prompts can be useful in image generators.<\/li>\r\n<\/ul>\r\n<a href=\"\/\" rel=\"attachment wp-att-34\"><img class=\"alignnone wp-image-34\" src=\"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-content\/uploads\/sites\/2495\/2025\/01\/book-open-bookmark.png\" alt=\"read icon\" width=\"30\" height=\"30\" \/><\/a>\u00a0Read <a href=\"https:\/\/www.scientificamerican.com\/article\/should-you-be-nice-to-ai-chatbots-such-as-chatgpt\/\">Please Be Polite to ChatGPT<\/a> on why being polite to your chatbot makes for better responses.\r\n\r\n<\/div>\r\n<h2>Types of easy prompts<\/h2>\r\n[table id=4 \/]\r\n<h3>Simple prompts<\/h3>\r\nA simple prompt or <strong>zero-shot prompt <\/strong>relies on the LLM training data to answer a question without any examples.\r\n<div class=\"textbox shaded\">\r\n<ul>\r\n \t<li>Provide a list of ten ideas for a report on housing issues in Australia.<\/li>\r\n \t<li>Write a poem about The University of Queensland.<\/li>\r\n<\/ul>\r\n<\/div>\r\n<h3>Few-shot prompting<\/h3>\r\n<strong>Few-shot prompting<\/strong> provides examples of how a task is to be solved. It is used to provide guidance for the required output. An easy example is a <strong>sentiment analysis<\/strong>.\r\n<div class=\"textbox shaded\">\r\n\r\n<strong>Input:<\/strong>\r\n\r\nHere are a few examples of movie reviews and what sentiment they have:\r\n<ul>\r\n \t<li>Review: \"This movie was absolutely fantastic! I loved every minute of it.\"<\/li>\r\n \t<li>Sentiment: Positive<\/li>\r\n \t<li>Review: \"The plot was confusing and the acting was terrible. What a waste of time.\"<\/li>\r\n \t<li>Sentiment: Negative<\/li>\r\n \t<li>Review: \"It was okay. Not great, not terrible, just average.\"<\/li>\r\n \t<li>Sentiment: Neutral<\/li>\r\n<\/ul>\r\n<strong>Now, classify the sentiment of this review: <\/strong>\"The special effects were amazing, but the story was predictable and the characters were flat.\"\r\n\r\n<strong>Output:<\/strong>\r\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\r\n<div class=\"flex-col gap-1 md:gap-3\">\r\n<div class=\"flex max-w-full flex-col flex-grow\">\r\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"ec41128f-e83c-4e3f-add6-4a7dac43e89f\" data-message-model-slug=\"gpt-4o\">\r\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\r\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\r\n<ul>\r\n \t<li>Review: \"The special effects were amazing, but the story was predictable and the characters were flat.\"<\/li>\r\n \t<li>Sentiment: Mixed.<\/li>\r\n \t<li>Reasoning: The review contains both positive and negative aspects. While it praises the special effects, it criticizes the story and characters. This balance of contrasting opinions classifies it as a mixed sentiment.<\/li>\r\n<\/ul>\r\n[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]\r\n\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<h3>Chain-of-thought prompting<\/h3>\r\n<strong>Chain-of-thought prompting<\/strong> is a technique in which the model is encouraged to provide reasoning for its answer in a series of logical steps to solve a problem provided it initially got wrong in its output. It also increases the transparency of the answer and prompts users to use critical thinking when evaluating the responses.\r\n<div class=\"textbox shaded\">\r\n\r\n<strong>Input: <\/strong>\r\n\r\nYes or no: would a pear sink in water? <strong>Provide a reasoning for your answer in logical steps before providing an answer<\/strong>.\r\n\r\n<strong>Output:\u00a0<\/strong>\r\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\r\n<div class=\"flex-col gap-1 md:gap-3\">\r\n<div class=\"flex max-w-full flex-col flex-grow\">\r\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"f735e118-eda6-42b4-a544-490e0d150411\" data-message-model-slug=\"gpt-4o\">\r\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\r\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\r\n<ol>\r\n \t<li><strong>Density determines floating or sinking:<\/strong>\r\nAn object floats in water if its density is less than that of water (approximately 1 g\/cm\u00b3). If the object's density is greater, it sinks.<\/li>\r\n \t<li><strong>Examining a pear's composition:<\/strong>\r\nA pear is composed of water, sugars, fibers, and air pockets within its cellular structure. The presence of air pockets lowers its overall density compared to water.<\/li>\r\n \t<li><strong>Considering variations in pears:<\/strong>\r\nWhile most pears have a density less than water, factors like ripeness, water content, or damage can affect buoyancy. Overripe or denser pears might sink.<\/li>\r\n<\/ol>\r\n<strong style=\"font-size: 1rem;text-align: initial\">Answer:<\/strong><span style=\"font-size: 1rem;text-align: initial\"> No, a pear would not sink in water under normal conditions. It generally floats because its density is slightly less than water.<\/span>\r\n\r\n[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]\r\n\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<h2>Choosing the right prompt<\/h2>\r\nThis visual guides you through a step-by-step decision pathway to match your task type with an appropriate prompting method.\r\n\r\n[caption id=\"attachment_666\" align=\"alignnone\" width=\"1606\"]<a href=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/11\/Screenshot-2025-06-23-at-12.29.09\u202fpm.png\"><img class=\"wp-image-666 size-full\" src=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/11\/Screenshot-2025-06-23-at-12.29.09\u202fpm.png#fixme\" alt=\"\" width=\"1606\" height=\"464\" \/><\/a> Click on the image to make larger.[\/caption]\r\n\r\n[h5p id=\"19\"]\r\n<h2>Additional resources on prompt engineering<\/h2>\r\n<ul>\r\n \t<li><a href=\"https:\/\/platform.openai.com\/docs\/guides\/prompt-engineering\" target=\"_blank\" rel=\"noopener\">Prompt Engineering by OpenAI<\/a><\/li>\r\n \t<li><a href=\"https:\/\/learnprompting.org\/docs\/intro\" target=\"_blank\" rel=\"noopener\">Prompt Engineering Guide by Learn Prompting<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.promptingguide.ai\/\" target=\"_blank\" rel=\"noopener\">Prompt Engineering Guide by DAIR.AI<\/a><\/li>\r\n \t<li><a href=\"https:\/\/etc.cuit.columbia.edu\/news\/how-talk-ais-advanced-prompt-engineering\">Columbia University: How to talk to AIs - Advanced Prompt Engineering<\/a><\/li>\r\n<\/ul>\r\n<a href=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/09\/video-player-movie.png\" rel=\"attachment wp-att-26\"><img class=\"alignnone wp-image-26\" src=\"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-content\/uploads\/sites\/2495\/2025\/08\/video-player-movie.png\" alt=\"video icon\" width=\"30\" height=\"30\" \/><\/a> Want to learn more? Watch <a href=\"https:\/\/www.youtube.com\/watch?v=1c9iyoVIwDs\">Four Methods of Prompt Engineering (YouTube, 12m 41s)<\/a> by IBM Technology.","rendered":"<h2>What is prompting?<\/h2>\n<p>Prompts are the <strong>input instructions<\/strong> for AI tools to perform tasks. They can include text, data (such as tables) or images.<\/p>\n<p>The input of a prompt is converted into tokens by the AI tool. Tokens represent the prompt elements converted into a form that the tool understands. These are processed and converted back into words or other outputs. The tool prompt length is limited by <a href=\"https:\/\/help.openai.com\/en\/articles\/4936856-what-are-tokens-and-how-to-count-them\">the number of tokens<\/a>\u00a0allowed to be input.<\/p>\n<h2>Components of a good prompt<\/h2>\n<p>The more specific your prompt details are, the more relevant your output will be. Provide plenty of details, and define the task and the output you want.<\/p>\n<h3>\n<div id=\"h5p-18\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-18\" class=\"h5p-iframe\" data-content-id=\"18\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Components of a good prompt\"><\/iframe><\/div>\n<\/div>\n<\/h3>\n<div class=\"textbox shaded\">\n<h3>Prompting tips<\/h3>\n<ul>\n<li>Use instructional verbs: summarise, classify, write, and compose.<\/li>\n<li>Expand on prompts iteratively \u2014 your first go doesn\u2019t have to be perfect!<\/li>\n<li>Write short but detailed prompts.\u00a0Break down your tasks into a subtask list if needed.<\/li>\n<li>Tell the AI what to do rather than tell it what not to do. Negative prompts can be useful in image generators.<\/li>\n<\/ul>\n<p><a href=\"\/\" rel=\"attachment wp-att-34\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-34\" src=\"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-content\/uploads\/sites\/2495\/2025\/01\/book-open-bookmark.png\" alt=\"read icon\" width=\"30\" height=\"30\" \/><\/a>\u00a0Read <a href=\"https:\/\/www.scientificamerican.com\/article\/should-you-be-nice-to-ai-chatbots-such-as-chatgpt\/\">Please Be Polite to ChatGPT<\/a> on why being polite to your chatbot makes for better responses.<\/p>\n<\/div>\n<h2>Types of easy prompts<\/h2>\n<p>[table \u201c4\u201d not found \/]<\/p>\n<h3>Simple prompts<\/h3>\n<p>A simple prompt or <strong>zero-shot prompt <\/strong>relies on the LLM training data to answer a question without any examples.<\/p>\n<div class=\"textbox shaded\">\n<ul>\n<li>Provide a list of ten ideas for a report on housing issues in Australia.<\/li>\n<li>Write a poem about The University of Queensland.<\/li>\n<\/ul>\n<\/div>\n<h3>Few-shot prompting<\/h3>\n<p><strong>Few-shot prompting<\/strong> provides examples of how a task is to be solved. It is used to provide guidance for the required output. An easy example is a <strong>sentiment analysis<\/strong>.<\/p>\n<div class=\"textbox shaded\">\n<p><strong>Input:<\/strong><\/p>\n<p>Here are a few examples of movie reviews and what sentiment they have:<\/p>\n<ul>\n<li>Review: &#8220;This movie was absolutely fantastic! I loved every minute of it.&#8221;<\/li>\n<li>Sentiment: Positive<\/li>\n<li>Review: &#8220;The plot was confusing and the acting was terrible. What a waste of time.&#8221;<\/li>\n<li>Sentiment: Negative<\/li>\n<li>Review: &#8220;It was okay. Not great, not terrible, just average.&#8221;<\/li>\n<li>Sentiment: Neutral<\/li>\n<\/ul>\n<p><strong>Now, classify the sentiment of this review: <\/strong>&#8220;The special effects were amazing, but the story was predictable and the characters were flat.&#8221;<\/p>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\n<div class=\"flex-col gap-1 md:gap-3\">\n<div class=\"flex max-w-full flex-col flex-grow\">\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"ec41128f-e83c-4e3f-add6-4a7dac43e89f\" data-message-model-slug=\"gpt-4o\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<ul>\n<li>Review: &#8220;The special effects were amazing, but the story was predictable and the characters were flat.&#8221;<\/li>\n<li>Sentiment: Mixed.<\/li>\n<li>Reasoning: The review contains both positive and negative aspects. While it praises the special effects, it criticizes the story and characters. This balance of contrasting opinions classifies it as a mixed sentiment.<\/li>\n<\/ul>\n<p>[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3>Chain-of-thought prompting<\/h3>\n<p><strong>Chain-of-thought prompting<\/strong> is a technique in which the model is encouraged to provide reasoning for its answer in a series of logical steps to solve a problem provided it initially got wrong in its output. It also increases the transparency of the answer and prompts users to use critical thinking when evaluating the responses.<\/p>\n<div class=\"textbox shaded\">\n<p><strong>Input: <\/strong><\/p>\n<p>Yes or no: would a pear sink in water? <strong>Provide a reasoning for your answer in logical steps before providing an answer<\/strong>.<\/p>\n<p><strong>Output:\u00a0<\/strong><\/p>\n<div class=\"group\/conversation-turn relative flex w-full min-w-0 flex-col agent-turn\">\n<div class=\"flex-col gap-1 md:gap-3\">\n<div class=\"flex max-w-full flex-col flex-grow\">\n<div class=\"min-h-8 text-message flex w-full flex-col items-end gap-2 whitespace-normal break-words [.text-message+&amp;]:mt-5\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"f735e118-eda6-42b4-a544-490e0d150411\" data-message-model-slug=\"gpt-4o\">\n<div class=\"flex w-full flex-col gap-1 empty:hidden first:pt-[3px]\">\n<div class=\"markdown prose w-full break-words dark:prose-invert light\">\n<ol>\n<li><strong>Density determines floating or sinking:<\/strong><br \/>\nAn object floats in water if its density is less than that of water (approximately 1 g\/cm\u00b3). If the object&#8217;s density is greater, it sinks.<\/li>\n<li><strong>Examining a pear&#8217;s composition:<\/strong><br \/>\nA pear is composed of water, sugars, fibers, and air pockets within its cellular structure. The presence of air pockets lowers its overall density compared to water.<\/li>\n<li><strong>Considering variations in pears:<\/strong><br \/>\nWhile most pears have a density less than water, factors like ripeness, water content, or damage can affect buoyancy. Overripe or denser pears might sink.<\/li>\n<\/ol>\n<p><strong style=\"font-size: 1rem;text-align: initial\">Answer:<\/strong><span style=\"font-size: 1rem;text-align: initial\"> No, a pear would not sink in water under normal conditions. It generally floats because its density is slightly less than water.<\/span><\/p>\n<p>[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2>Choosing the right prompt<\/h2>\n<p>This visual guides you through a step-by-step decision pathway to match your task type with an appropriate prompting method.<\/p>\n<figure id=\"attachment_666\" aria-describedby=\"caption-attachment-666\" style=\"width: 1606px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/11\/Screenshot-2025-06-23-at-12.29.09\u202fpm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-666 size-full\" src=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/11\/Screenshot-2025-06-23-at-12.29.09\u202fpm.png#fixme\" alt=\"\" width=\"1606\" height=\"464\" \/><\/a><figcaption id=\"caption-attachment-666\" class=\"wp-caption-text\">Click on the image to make larger.<\/figcaption><\/figure>\n<div id=\"h5p-19\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-19\" class=\"h5p-iframe\" data-content-id=\"19\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Text description\"><\/iframe><\/div>\n<\/div>\n<h2>Additional resources on prompt engineering<\/h2>\n<ul>\n<li><a href=\"https:\/\/platform.openai.com\/docs\/guides\/prompt-engineering\" target=\"_blank\" rel=\"noopener\">Prompt Engineering by OpenAI<\/a><\/li>\n<li><a href=\"https:\/\/learnprompting.org\/docs\/intro\" target=\"_blank\" rel=\"noopener\">Prompt Engineering Guide by Learn Prompting<\/a><\/li>\n<li><a href=\"https:\/\/www.promptingguide.ai\/\" target=\"_blank\" rel=\"noopener\">Prompt Engineering Guide by DAIR.AI<\/a><\/li>\n<li><a href=\"https:\/\/etc.cuit.columbia.edu\/news\/how-talk-ais-advanced-prompt-engineering\">Columbia University: How to talk to AIs &#8211; Advanced Prompt Engineering<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/uq.pressbooks.pub\/app\/uploads\/sites\/146\/2024\/09\/video-player-movie.png\" rel=\"attachment wp-att-26\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-26\" src=\"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-content\/uploads\/sites\/2495\/2025\/08\/video-player-movie.png\" alt=\"video icon\" width=\"30\" height=\"30\" \/><\/a> Want to learn more? Watch <a href=\"https:\/\/www.youtube.com\/watch?v=1c9iyoVIwDs\">Four Methods of Prompt Engineering (YouTube, 12m 41s)<\/a> by IBM Technology.<\/p>\n","protected":false},"author":2509,"menu_order":5,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["uq-library-2"],"pb_section_license":"cc-by-nc"},"chapter-type":[],"contributor":[71],"license":[56],"class_list":["post-534","chapter","type-chapter","status-publish","hentry","contributor-uq-library-2","license-cc-by-nc"],"part":92,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapters\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/wp\/v2\/users\/2509"}],"version-history":[{"count":3,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapters\/534\/revisions"}],"predecessor-version":[{"id":1034,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapters\/534\/revisions\/1034"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/parts\/92"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapters\/534\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/pressbooks\/v2\/chapter-type?post=534"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/wp\/v2\/contributor?post=534"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/introductiontoresearch\/wp-json\/wp\/v2\/license?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}