A collection of Jupyter notebook examples and guides showing how to accomplish common tasks with the OpenAI API.
NirDiamant/Prompt_Engineering
A collection of 22 prompt engineering techniques, each explained in a hands-on Jupyter Notebook tutorial for working with LLMs.
- Stars
- 7,924
- Forks
- 1,034
- Open issues
- 14
- Last commit
- 8 days ago
What is it?
This repository is a learning resource for prompt engineering, the practice of writing inputs that get reliable results from large language models. It covers 22 techniques arranged from fundamentals such as prompt templates and single- and multi-turn structures, through core methods like zero-shot, few-shot, and chain-of-thought prompting, to advanced strategies including self-consistency, task decomposition, prompt chaining, and prompt security.
Each technique has its own Jupyter Notebook that combines explanation with runnable code. The examples use OpenAI's GPT models and the LangChain library, and the template lesson uses Jinja2. Topics also include evaluating prompt effectiveness, multilingual prompting, and handling ambiguity.
The repository is maintained by Nir Diamant, who also publishes a companion book covering the same 22 techniques, and links to related repositories on RAG and agents.
Key features
- 01Covers 22 techniques from basic prompt structures to advanced strategies
- 02Each technique is a standalone Jupyter Notebook with runnable code
- 03Examples use OpenAI GPT models and the LangChain library
- 04Includes Jinja2-based prompt templates and prompt security topics
- 05Covers evaluation, A/B testing, and multilingual prompting
Use cases
- Learning prompt engineering from basics to advanced techniques
- Looking up a specific method such as chain-of-thought or self-consistency with working code
- Preparing prompts for production LLM applications with evaluation and security in mind
Quick start
- 1
Clone the repository and open the Jupyter notebooks
- 2
Open any technique notebook, such as the introduction lesson, in Jupyter
Things to know
- Tutorials are Jupyter notebooks rather than an installable library or package.
- Running the examples requires access to an LLM API key, which is not free.
Topics
FAQ
- What is Prompt_Engineering?
- A collection of 22 prompt engineering techniques, each explained in a hands-on Jupyter Notebook tutorial for working with LLMs. This repository is a learning resource for prompt engineering, the practice of writing inputs that get reliable results from large language models. It covers 22 techniques arranged from fundamentals such as prompt templates and single- and multi-turn structures, through core methods like zero-shot, few-shot, and chain-of-thought prompting, to advanced strategies including self-consistency, task decomposition, prompt chaining, and prompt security.
- Is Prompt_Engineering free to use? What license does it have?
- Prompt_Engineering is open source under the Other license. Check the license terms before using it in commercial products.
- Is Prompt_Engineering still maintained?
- Actively maintained. The last commit to Prompt_Engineering was on Oct 31, 2026.
- What can I use Prompt_Engineering for?
- Learning prompt engineering from basics to advanced techniques Looking up a specific method such as chain-of-thought or self-consistency with working code Preparing prompts for production LLM applications with evaluation and security in mind
- How do I install Prompt_Engineering?
- Clone the repository and open the Jupyter notebooks Open any technique notebook, such as the introduction lesson, in Jupyter
- Where can I get Prompt_Engineering?
- The source code and installation instructions are on GitHub: https://github.com/NirDiamant/Prompt_Engineering
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Microsoft Word add-in that brings AI chat and an agent that can edit your documents directly into Word.
An interactive, chapter-based course that teaches developers how to write effective prompts for Claude.
A collection of 90+ hands-on tutorial projects covering LLMs, RAG pipelines, and AI agents, organized by difficulty level.
An OpenAI API-compatible proxy that applies inference-time techniques like MoA, MCTS and best-of-N to improve LLM reasoning without training.
Executable Python notebooks, sample apps and resources for trying Elasticsearch across search, observability and security use cases.