Optimizing Your Generative AI Prompts

  • 22 May 2023
  • 2 replies
  • 162 views

Userlevel 6
Badge +9

IMPORTANCE OF PROMPTS

Have you ever used Generative AI and felt like you didn’t get the results you were looking for? Just like search engines, the results returned from Generative AI tools, such as ChatGPT, rely heavily on your prompts.

When just starting to test Generative AI as a new tool in your intelligent automation tool belt, you can experiment with different phrasing to observe how results vary. However, when you are ready to implement AI into new or existing automations, you need to be sure the results returned from your prompts are what you need.

Prompt engineering is quickly becoming an essential aspect of intelligent automation development resulting in increased accuracy, time-savings, improved efficiency, scalability, reduction in errors, ease of use, and more.

TIPS FOR WRITING BETTER CHATGPT PROMPTS

Based on our experience, here are some things we’ve learned to create effective prompts:

  • Be clear - use simple language and avoid ambiguous terms
  • Provide examples - use specific examples that are similar to the desired output
  • Use structured data - use tables, lists, and other structured formats to provide input


REAL WORLD EXAMPLES

Here are a few real world applications to help inspire your prompt-writing:

Writing regular expressions
 

Prompt: Write a regular expression to extract the first letter from the first word and last two letters from second word in the example John Smith. Expected output: Jth
 

Response:

^(\w{1})\w*\s+\w*(\w{2})\b

 

Reading specific text from unstructured data and responding in structured JSON format
 

Prompt: Get me the key values from this text in json format. Please find attached invoice number INV-2022-007 for the social media marketing services we provided in July. The subtotal for all line items is $9,000, and an early payment discount of 2% has been applied, for a total of $8,820 along with and sales tax of 8.25%.
 

Response:
 

{
"invoice_number": "INV-2022-007",
"service": "social media marketing",
"month": "July",
"subtotal": "$9,000",
"discount": "2%",
"discount_amount": "$180",
"tax": "8.25%",
"total": "$9,959.50"
}

 

Text Generation: Generate Email responses for Customer Support
 

Prompt: Generate an email in less than 100 words to respond to an unhappy customer Allen to inform him that the issue with his smartphone will be rectified in 96 hours.
 

Response:
 

Dear Allen,
Thank you for bringing the issue with your smartphone to our attention. We apologize for any inconvenience caused. Our team is currently working on resolving the issue and we assure you that it will be rectified within the next 96 hours. We appreciate your patience and understanding in this matter. Please feel free to contact us if you have any further concerns or questions.
Best regards,
[Your Name]

 

CHALLENGE

As we’re all still learning and optimizing the way we leverage Generative AI and writing prompts, we’ve extended our April badge challenge to continue to share ideas as a community and build a repository of intelligent automation-related prompts.

 

Tell us: What is the most effective prompt you have leveraged to date in your automation development? Drop your answer here and claim and your badge!
 


2 replies

Userlevel 5
Badge +9

Helpful tips! We saw that in #BotGames some other tips were:

  •  Asking ChatGPT to actually optimize your prompts for you...which in testing so far has worked moderately well. 
  • Limiting the number of characters sent to ChatGPT in an effort to reduce token consumption (i.e. keep costs down)
  • Giving specific examples of the output you want, in the format you want it - “I want the response returned as a JSON which follows a format where {“name”:”customer name”, “address”:”customer address”...
Userlevel 4
Badge +10

Helpful tips! We saw that in #BotGames some other tips were:

  •  Asking ChatGPT to actually optimize your prompts for you...which in testing so far has worked moderately well. 
  • Limiting the number of characters sent to ChatGPT in an effort to reduce token consumption (i.e. keep costs down)
  • Giving specific examples of the output you want, in the format you want it - “I want the response returned as a JSON which follows a format where {“name”:”customer name”, “address”:”customer address”...

I did that too in #BotGames challenges for extraction of patient details from the email. I specifically asked just to extract the specific details not anything else. Also in that xPath dynamic one I asked to extract the xPath and added a not not to consider the class / id while making the xPath.

Reply