Skip to content

amalshehu/prompt-engineering

Repository files navigation

Prompt Engineering with ChatGPT

Table of Contents


Prompt engineering refers to the practice of designing and structuring the input (prompt) to an AI model in a way that maximizes the likelihood of receiving the desired output.

Principles

  • Ensure prompts are precise and unambiguous.
  • Allow sufficient time for the model to process.

Delimiters

  • Delimiters, such as "\n---\n","```", can demarcate different sections of input.
  • GPT models do not inherently attach any meaning to delimiters. Their significance is learned from usage patterns in training data.

Hallucinations

  • Hallucinations refer to outputs from AI models that are not rooted in their training data or the given input.
  • Clarity and specificity in prompts can mitigate hallucinations.
  • Caution should be used when asking the model to cite sources, as this could trigger hallucinations.

Few-Shot Prompting

  • Few-shot prompting involves giving task examples before providing the actual prompt.
  • The utility of few-shot prompting varies based on task complexity and the relevancy of the examples.

Determination

  • Determination means sticking to a specific topic or style in the model's response.
  • Topic drift in longer responses can be mitigated by reinforcing the main topic.

Structured Prompts

  • Structured prompts guide model's output by explicitly organizing the input.
  • They're especially useful for tasks requiring a specific output format or style.

Iterative Prompt development

  • Start with clear, specific prompts.
  • Understand the root cause if outputs are not as expected.
  • Refine the prompt based on your understanding.
  • Repeat the process until desired results are achieved.

Iterative process

  • Start with a trial approach.
  • Analyze the shortcomings if outputs do not meet expectations.
  • Clarify instructions and allocate more time for processing.
  • Refine prompts using a collection of examples.

Summarizing

  • Summarizing reduces lengthy content to core points, allowing efficient understanding.

Inferring

  • Inferring involves extracting valuable information such as:
    • Relevant details
    • Emotions
    • Intent
    • Sentiment
    • Classifications

Transforming

  • Transforming involves modifying content, which can include:
    • Format conversions
    • Paraphrasing
    • Style transfers
    • Grammar and spelling corrections
    • Translations

Expanding

  • Expanding involves adding information to a piece of text, such as:
    • Generating a list of items
    • Adding more detail to a text

Custom Chatbot

  • Chatbots enhance customer interaction through personalized experiences and can assist with:
    • Answering queries
    • Offering recommendations
    • Gathering feedback

Support

Thanks for checking out my repo! If you find this project interesting, please consider giving it a star ⭐ to show your support. And, if you encounter any issues or have suggestions for improvements, feel free to open an issue. Your feedback is greatly appreciated! 😊