Skip to content
AIRepoHub

Prompt-Engineering-Guide

by dair-ai

Guides, papers and notebooks for learning prompt engineering, RAG and how to work with AI agents.

RAG & KnowledgeAI AgentsMDXMIT license
Stars
80,354
stars
Forks
8.8k
forks
Last push
8 months ago
Activity
Slowing down
Prompt-Engineering-Guide: quick start
# Run the guide locally$ git clone https://github.com/dair-ai/Prompt-Engineering-Guide.git
cd Prompt-Engineering-Guide
pnpm i next react react-dom nextra nextra-theme-docs
pnpm dev

Commands from the project's README. Run them after installing (see below).

Overview

Understand Prompt-Engineering-Guide in 60 seconds

What it does
The Prompt Engineering Guide from DAIR.AI is a free collection of guides, papers, lectures and tools on writing prompts for language models. It is published as the website promptingguide.ai and covers basics, techniques, applications, model notes and risks.
The problem it solves
Prompting techniques are spread across research papers and blog posts. This guide explains them in one place, from zero-shot and few-shot prompting to chain-of-thought, ReAct and retrieval-augmented generation, with examples.
Why choose it
Choose it as a free, well-known reference for prompting techniques and papers. It is reading material, not a tool; DAIR.AI also sells separate paid courses.
Who should use it
  • Developers building with LLMs
  • Students and researchers learning prompting techniques
  • Product people who write prompts
  • Translators contributing to a 13-language guide
Setup difficulty

You'll need:

  • A web browser to read it online
  • Node.js 18+ and pnpm to run it locally

How Prompt-Engineering-Guide works

The guide is organised into an introduction (LLM settings, prompt basics, prompt elements, tips and examples), techniques, applications, a prompt hub, model notes, risks and misuses, papers, tools, notebooks, datasets and further reading.

Techniques covered include zero-shot, few-shot, chain-of-thought, self-consistency, generated knowledge, prompt chaining, tree of thoughts, retrieval-augmented generation, automatic reasoning and tool use, automatic prompt engineer, ReAct, multimodal chain-of-thought and graph prompting. Applications include function calling, generating data and generating code.

The README links a one-hour lecture with a notebook and slides. The website version at promptingguide.ai is the most up to date, and the site can also be run locally with Nextra, for example to check a translation.

Features

Key features

Prompting techniques

From zero-shot to tree of thoughts and ReAct.

Applications

Function calling, data generation and coding.

Prompt hub

Example prompts by task.

Model notes

Guides for models like GPT-4, Gemini, LLaMA and Mixtral.

Risks

Adversarial prompting, factuality and bias.

Papers and tools

Curated research and tool lists.

Strengths

  • Free and widely used
  • Broad coverage of techniques
  • Available in 13 languages
  • MIT licensed

Limitations

  • Reading material rather than software
  • Some model pages cover older models
  • Hands-on courses are sold separately

Practical use cases

Learn prompting

Read the introduction and techniques sections.

Reference while building

Look up a technique such as chain-of-thought.

Teach a workshop

Use the lecture video, notebook and slides.

Installation

Install Prompt-Engineering-Guide

Based on official documentation

Commands come from Prompt Engineering Guide's README. AIRepoHub hasn't run them yet. View source

Prerequisites

  • A web browser

Supported systems

  • Windows
  • macOS
  • Linux
  1. 1

    Open promptingguide.ai

    The most up-to-date version of the guide.

  1. 1

    Install Node.js 18+ and pnpm

  2. 2

    Clone and install dependencies

    Shell
    git clone https://github.com/dair-ai/Prompt-Engineering-Guide.gitcd Prompt-Engineering-Guidepnpm i next react react-dom nextra nextra-theme-docs
  3. 3

    Start the site

    Browse it at http://localhost:3000/.

    Shell
    pnpm dev

Configuration and API keys

SettingWhat it's for

First run

  1. 1

    Read Basics of Prompting, then Chain-of-Thought Prompting

Prompt-Engineering-Guide's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.

Your first project

Learn the core prompting techniques

Work through the key techniques with the guide and lecture.

Before you start

  • A web browser
  • Optional: a Jupyter environment for the lecture notebook
  1. 1

    Read the introduction

    LLM settings, basics, prompt elements and tips.

  2. 2

    Try few-shot and chain-of-thought prompts

    Use the examples in the techniques section with any chat model.

  3. 3

    Watch the lecture and run its notebook

    notebooks/pe-lecture.ipynb in the repository.

What to expect

A working understanding of the main prompting techniques and when to use each.

Next steps

  • Read the RAG and ReAct pages
  • Browse the prompt hub by task
  • Check the papers section for research

Costs and requirements

What it costs to run

License
MIT.Free
Guide
Free to read online or locally.Free
DAIR.AI Academy courses
Optional paid courses.Paid

Troubleshooting

Common setup issues

Local site won't start

Check you have Node.js 18 or newer and pnpm, then install the listed dependencies.

Source: README.md

Content seems outdated

The website promptingguide.ai has the most recent guides.

Source: README.md

Alternatives

Similar AI repositories