Skip to content

Commit

Permalink
ai-prompt-eng: add notes
Browse files Browse the repository at this point in the history
  • Loading branch information
afondiel committed Jun 13, 2024
1 parent 5bfeec6 commit 0d2a704
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 20 deletions.
122 changes: 122 additions & 0 deletions ai/prompt-engineering-notes/prompt-engineering-notes.md
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/)

23 changes: 3 additions & 20 deletions ai/prompt-engineering-notes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,8 @@

Credits to : Max Rascher

## Contributing

Please refer to this [CONTRIBUTING.md](../../CONTRIBUTING.md) file.

## References

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/)



> **"...And so my hope is someday when the next Aristotle is alive, we can capture the underlying worldview of that Aristotle, in a computer, and someday some students will be able to not only read the words Aristotle wrote but ask Aristotle a question and get an answer."** - Steve Jobs (Generative AI Prediction from 1985 Speech)

0 comments on commit 0d2a704

Please sign in to comment.