-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
ai/prompt-engineering-notes/prompt-engineering-notes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Prompt Engineering - Notes | ||
|
||
## Table of Contents (ToC) | ||
|
||
- [Introduction](#introduction) | ||
- [What's Prompt Engineering?](#whats-prompt-engineering) | ||
- [Key Concepts and Terminology](#key-concepts-and-terminology) | ||
- [Applications](#applications) | ||
- [Fundamentals](#fundamentals) | ||
- [Prompt Engineering Architecture Pipeline](#prompt-engineering-architecture-pipeline) | ||
- [How Prompt Engineering Works?](#how-prompt-engineering-works) | ||
- [Prompt Engineering Techniques](#prompt-engineering-techniques) | ||
- [Some Hands-on Examples](#some-hands-on-examples) | ||
- [Tools \& Frameworks](#tools--frameworks) | ||
- [Hello World!](#hello-world) | ||
- [Lab: Zero to Hero Projects](#lab-zero-to-hero-projects) | ||
- [References](#references) | ||
- [References](#references-1) | ||
|
||
|
||
## Introduction | ||
Prompt engineering is the process of designing and optimizing prompts for AI models to elicit the desired responses. | ||
|
||
### What's Prompt Engineering? | ||
- Crafting input prompts to guide AI outputs. | ||
- Enhancing model performance with well-designed prompts. | ||
- A critical skill for interacting with AI systems effectively. | ||
|
||
### Key Concepts and Terminology | ||
- **Prompt**: The input given to an AI model. | ||
- **Completion**: The output generated by the AI model. | ||
- **Tokens**: Units of text the model processes. | ||
- **Context**: The surrounding text influencing the model's output. | ||
|
||
### Applications | ||
- Generating human-like text in chatbots. | ||
- Summarizing documents and articles. | ||
- Automating customer service responses. | ||
- Creating interactive AI-based tools. | ||
|
||
## Fundamentals | ||
|
||
### Prompt Engineering Architecture Pipeline | ||
- Defining the task and objectives. | ||
- Crafting initial prompts. | ||
- Iterative testing and refinement. | ||
- Evaluating model outputs for desired performance. | ||
|
||
### How Prompt Engineering Works? | ||
- Identifying the purpose and scope of the task. | ||
- Designing prompts with specific instructions. | ||
- Utilizing examples to guide model responses. | ||
- Refining prompts based on model feedback. | ||
|
||
### Prompt Engineering Techniques | ||
- **Zero-shot**: Providing no examples, relying on the model's general knowledge. | ||
- **Few-shot**: Giving a few examples to guide the model. | ||
- **One-shot**: Providing a single example to demonstrate the task. | ||
- **Multi-shot**: Offering multiple examples to improve response accuracy. | ||
- **Chain-of-thought**: Structuring prompts to show the reasoning process step-by-step. | ||
|
||
### Some Hands-on Examples | ||
- **Text Summarization**: Crafting prompts for concise summaries. | ||
- **Conversational Agents**: Designing prompts for engaging dialogues. | ||
- **Content Generation**: Creating prompts for writing assistance. | ||
|
||
## Tools & Frameworks | ||
- OpenAI GPT | ||
- Hugging Face Transformers | ||
- Google's T5 | ||
- Microsoft DialoGPT | ||
|
||
## Hello World! | ||
```python | ||
import openai | ||
|
||
# Set up the OpenAI API key | ||
openai.api_key = 'your-api-key' | ||
|
||
# Define a simple prompt | ||
prompt = "Explain the concept of prompt engineering in AI." | ||
|
||
# Get the completion from the AI model | ||
response = openai.Completion.create( | ||
engine="text-davinci-003", | ||
prompt=prompt, | ||
max_tokens=100 | ||
) | ||
|
||
# Print the response | ||
print(response.choices[0].text.strip()) | ||
``` | ||
|
||
## Lab: Zero to Hero Projects | ||
- **Project 1**: Building a FAQ chatbot using prompt engineering. | ||
- **Project 2**: Creating a personalized email assistant. | ||
- **Project 3**: Developing a story generator with adjustable prompts. | ||
- **Project 4**: Designing an AI-driven content summarizer. | ||
|
||
## References | ||
- [OpenAI documentation](https://beta.openai.com/docs/) | ||
- [Hugging Face Transformers](https://huggingface.co/transformers/) | ||
- [Google's T5](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) | ||
- [Microsoft DialoGPT](https://github.com/microsoft/DialoGPT) | ||
- https://www.promptingguide.ai/techniques | ||
|
||
Free Course: | ||
|
||
- [Course on ChatGPT Prompt Engineering for Developers - by DeepLearningAI](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/2/guidelines) | ||
|
||
Awesome ChatGPT Prompts: | ||
|
||
- [Awesome ChatGPT Prompts](https://prompts.chat/) | ||
- [Awesome GPT Prompts](https://www.awesomegptprompts.com/) | ||
|
||
Visual Prompting | ||
|
||
- [INTRODUCING - Visual Prompting - @LandingAI](https://landing.ai/) | ||
- [What is Visual Prompting? - LandingAI](https://landing.ai/blog/what-is-visual-prompting/) | ||
- [Visual Prompting Livestream With Andrew Ng](https://www.youtube.com/watch?v=FE88OOUBonQ) | ||
- [CVPR 2023 Tutorial on Prompting in Vision](https://prompting-in-vision.github.io/) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters