Convert Figma logo to code with AI

dair-ai logoPrompt-Engineering-Guide

🐙 Guides, papers, lecture, notebooks and resources for prompt engineering

47,577
4,632
47,577
140

Top Related Projects

Examples and guides for using the OpenAI API

18 Lessons, Get Started Building with Generative AI 🔗 https://microsoft.github.io/generative-ai-for-beginners/

This repo includes ChatGPT prompt curation to use ChatGPT better.

This repository contains a hand-curated resources for Prompt Engineering with a focus on Generative Pre-trained Transformer (GPT), ChatGPT, PaLM etc

92,071

🦜🔗 Build context-aware reasoning applications

Quick Overview

The Prompt-Engineering-Guide is a comprehensive resource for learning about prompt engineering techniques in AI and natural language processing. It covers various aspects of prompt engineering, including best practices, applications, and tools, aimed at helping developers and researchers improve their skills in crafting effective prompts for language models.

Pros

  • Extensive coverage of prompt engineering topics, from basics to advanced techniques
  • Regularly updated with new content and examples
  • Includes practical examples and case studies
  • Open-source and community-driven, allowing for contributions and improvements

Cons

  • May be overwhelming for beginners due to the breadth of information
  • Some sections might require prior knowledge of machine learning concepts
  • Limited interactive elements or hands-on exercises
  • Primarily focused on text-based prompts, with less emphasis on multimodal prompting

Competitor Comparisons

Examples and guides for using the OpenAI API

Pros of openai-cookbook

  • Directly maintained by OpenAI, ensuring up-to-date and accurate information
  • Focuses on practical examples and code snippets for OpenAI's API
  • Includes advanced topics like fine-tuning and embeddings

Cons of openai-cookbook

  • Limited to OpenAI-specific implementations
  • Less comprehensive coverage of general prompt engineering techniques
  • Fewer explanations of underlying concepts and theories

Code Comparison

Prompt-Engineering-Guide example:

prompt = f"""
Summarize the text below in 50 words:
{text}
"""
response = get_completion(prompt)
print(response)

openai-cookbook example:

response = openai.Completion.create(
  model="text-davinci-003",
  prompt="Summarize the following text in 50 words:\n\n" + text,
  max_tokens=60,
  temperature=0.7
)
print(response.choices[0].text.strip())

The Prompt-Engineering-Guide focuses on a more generic approach, while the openai-cookbook provides specific implementation details for the OpenAI API. Both repositories offer valuable resources for developers working with language models, with Prompt-Engineering-Guide providing a broader overview of prompt engineering techniques and openai-cookbook offering more targeted examples for OpenAI's services.

18 Lessons, Get Started Building with Generative AI 🔗 https://microsoft.github.io/generative-ai-for-beginners/

Pros of generative-ai-for-beginners

  • Comprehensive curriculum covering various aspects of generative AI
  • Hands-on projects and practical examples for better learning
  • Well-structured lessons with clear learning objectives

Cons of generative-ai-for-beginners

  • More focused on general AI concepts, less specific to prompt engineering
  • May be overwhelming for those solely interested in prompt engineering
  • Requires more time investment to complete the full course

Code Comparison

Prompt-Engineering-Guide example:

prompt = f"""
Summarize the text delimited by triple backticks into a single sentence.
```{text}```
"""
response = get_completion(prompt)
print(response)

generative-ai-for-beginners example:

from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

The Prompt-Engineering-Guide focuses more on crafting effective prompts, while generative-ai-for-beginners provides a broader introduction to working with AI models and APIs.

This repo includes ChatGPT prompt curation to use ChatGPT better.

Pros of awesome-chatgpt-prompts

  • Extensive collection of ready-to-use prompts for various scenarios
  • Community-driven with frequent updates and contributions
  • Easy to browse and implement prompts without deep technical knowledge

Cons of awesome-chatgpt-prompts

  • Lacks in-depth explanations of prompt engineering techniques
  • Limited focus on the theory and principles behind effective prompts
  • May not provide as much guidance for creating custom prompts

Code Comparison

Prompt-Engineering-Guide:

# Example of few-shot prompting
examples = [
    {"input": "I loved the movie!", "output": "Positive"},
    {"input": "The film was terrible.", "output": "Negative"}
]
prompt = f"Classify the sentiment: {user_input}\n\nExamples:\n"
for example in examples:
    prompt += f"Input: {example['input']}\nOutput: {example['output']}\n\n"

awesome-chatgpt-prompts:

# Act as an Excel Sheet
Instruction: I want you to act as a text-based Excel sheet. You'll only reply with the text-based 10-row x 10-column Excel sheet with cell numbers and letter headers, and nothing else. I'll give you the cell content. The cells should be blank if I don't give you any content. Don't write explanations. I'll give you instructions for cell content, and you'll reply with the result of those instructions.
Human: Write "Hello World" in B2 cell
AI: (Excel sheet representation with "Hello World" in B2)

This repository contains a hand-curated resources for Prompt Engineering with a focus on Generative Pre-trained Transformer (GPT), ChatGPT, PaLM etc

Pros of Awesome-Prompt-Engineering

  • More comprehensive collection of resources, including tools, papers, and tutorials
  • Better organized with clear categories and subcategories
  • Regularly updated with new content and contributions from the community

Cons of Awesome-Prompt-Engineering

  • Less in-depth explanations and original content
  • Lacks practical examples and hands-on guides
  • May be overwhelming for beginners due to the sheer volume of resources

Code Comparison

While both repositories primarily focus on curating resources rather than providing code, Prompt-Engineering-Guide occasionally includes code snippets for demonstration purposes. For example:

Prompt-Engineering-Guide:

prompt = f"""
Translate the following English text to Spanish:
```{text}```
"""

Awesome-Prompt-Engineering doesn't typically include code snippets, focusing instead on linking to external resources.

Both repositories serve as valuable resources for prompt engineering, with Awesome-Prompt-Engineering offering a broader collection of links and Prompt-Engineering-Guide providing more detailed explanations and examples. The choice between them depends on whether you prefer a comprehensive list of resources or a more curated, educational approach.

92,071

🦜🔗 Build context-aware reasoning applications

Pros of langchain

  • Comprehensive framework for building LLM-powered applications
  • Extensive library of tools and integrations for various AI tasks
  • Active development and community support

Cons of langchain

  • Steeper learning curve due to its extensive features
  • May be overkill for simple prompt engineering tasks
  • Requires more setup and configuration

Code comparison

Prompt-Engineering-Guide (example prompt):

prompt = """
Summarize the following text in 3 sentences:
{text}
"""

langchain (example chain):

from langchain import PromptTemplate, LLMChain
from langchain.llms import OpenAI

template = """Summarize the following text in 3 sentences:
{text}
"""
prompt = PromptTemplate(template=template, input_variables=["text"])
llm_chain = LLMChain(prompt=prompt, llm=OpenAI())

The Prompt-Engineering-Guide focuses on providing guidelines and best practices for crafting effective prompts, while langchain offers a more comprehensive framework for building complex LLM-powered applications. Prompt-Engineering-Guide is better suited for those primarily interested in improving their prompt writing skills, whereas langchain is ideal for developers building full-fledged AI applications with multiple components and integrations.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Prompt Engineering Guide

Prompt engineering is a relatively new discipline for developing and optimizing prompts to efficiently use language models (LMs) for a wide variety of applications and research topics. Prompt engineering skills help to better understand the capabilities and limitations of large language models (LLMs). Researchers use prompt engineering to improve the capacity of LLMs on a wide range of common and complex tasks such as question answering and arithmetic reasoning. Developers use prompt engineering to design robust and effective prompting techniques that interface with LLMs and other tools.

Motivated by the high interest in developing with LLMs, we have created this new prompt engineering guide that contains all the latest papers, learning guides, lectures, references, and tools related to prompt engineering for LLMs.

🌐 Prompt Engineering Guide (Web Version)

📺 YouTube Mini Lectures on Prompting Engineering

🎉 We are excited to launch our brand new course website and releasing our first course on Introduction to Prompt Engineering. Join Now!

Happy Prompting!


Announcements / Updates

  • 🎓 New course on Prompt Engineering for LLMs announced! Enroll here!
  • 💼 We now offer several services like corporate training, consulting, and talks.
  • 🌐 We now support 13 languages! Welcoming more translations.
  • 👩‍🎓 We crossed 3 million learners in January 2024!
  • 🎉 We have launched a new web version of the guide here
  • 🔥 We reached #1 on Hacker News on 21 Feb 2023
  • 🎉 The First Prompt Engineering Lecture went live here

Join our Discord

Follow us on Twitter

Subscribe to our YouTube

Subscribe to our Newsletter


Guides

You can also find the most up-to-date guides on our new website https://www.promptingguide.ai/.


Lecture

We have published a 1 hour lecture that provides a comprehensive overview of prompting techniques, applications, and tools.


Running the guide locally

To run the guide locally, for example to check the correct implementation of a new translation, you will need to:

  1. Install Node >=18.0.0
  2. Install pnpm if not present in your system. Check here for detailed instructions.
  3. Install the dependencies: pnpm i next react react-dom nextra nextra-theme-docs
  4. Boot the guide with pnpm dev
  5. Browse the guide at http://localhost:3000/

Appearances

Some places where we have been featured:


If you are using the guide for your work or research, please cite us as follows:

@article{Saravia_Prompt_Engineering_Guide_2022,
author = {Saravia, Elvis},
journal = {https://github.com/dair-ai/Prompt-Engineering-Guide},
month = {12},
title = {{Prompt Engineering Guide}},
year = {2022}
}

License

MIT License

Feel free to open a PR if you think something is missing here. Always welcome feedback and suggestions. Just open an issue!