NirDiamant/Prompt_Engineering

★ 7,859⑂ 1,027

22 prompt engineering techniques with hands-on Jupyter Notebook tutorials, from fundamental concepts to advanced strategies for leveraging LLMs.

About NirDiamant/Prompt_Engineering

NirDiamant/Prompt_Engineering is an open-source project on GitHub, mainly written in Jupyter Notebook. 22 prompt engineering techniques with hands-on Jupyter Notebook tutorials, from fundamental concepts to advanced strategies for leveraging LLMs. It currently holds 7,859 stars and 1,027 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Prompt Engineering board.

GitHub Repository Details

Repository NirDiamant/Prompt_Engineering · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

PRs Welcome LinkedIn Twitter Discord

Prompt Engineering Techniques: Comprehensive Repository for Development and Implementation 🖋️

Welcome to one of the most extensive and dynamic collections of Prompt Engineering tutorials and implementations available today. This repository serves as a comprehensive resource for learning, building, and sharing prompt engineering techniques, ranging from basic concepts to advanced strategies for leveraging large language models.

22 hands-on tutorials covering everything from basic prompt templates to advanced techniques like chain-of-thought, self-consistency, and tree-of-thought prompting.

🎓 From prompts to production

Prompt to Production - my full course on building software with AI the way professionals do: the methods and paradigms behind reliable, efficient, modular production systems, taught systematically. 17 modules, each pairing a video lecture with a hands-on lab, from your first structured prompt to a working production system.

The course is live. Every module is out, lecture and lab.

🎁 Try a full module, free

🎬
7-minute
video lecture
🛠️
Hands-on
tutorial
🤖
AI assistant
inside Claude Code

One npm install adds the module's AI assistant to your Claude Code, and it guides you through the tutorial as you build.

https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/Claim your free module

👉 Get the full course

🎯 Sponsors

https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/Coderabbit      https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/Qodo

📫 Stay Updated!

🚀
Cutting-edge
Updates
💡
Expert
Insights
🎯
Top 0.1%
Content

Subscribe to DiamantAI Newsletter

Join over 50,000 AI enthusiasts getting unique cutting-edge insights and free tutorials! Plus, subscribers get exclusive early access and special discounts to our upcoming RAG Techniques course!

DiamantAI's newsletter

🎬 Prefer video?

I break these ideas down into short, one-idea-per-episode explainers on YouTube.

https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/
How LLMs Actually Work (and Why AI Makes Things Up)

recalling a fact and inventing one are literally the same move
https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/
Context Is the New Code

the shift from writing the code to shaping what the model sees
https://github.com/NirDiamant/Prompt_Engineering/blob/HEAD/
Stop Thinking Claude Code Is Magic. Here's How It Works

what the agent loop is actually doing on every turn

Subscribe on YouTube   Browse every episode →

Introduction

Prompt engineering is at the forefront of artificial intelligence, revolutionizing the way we interact with and leverage AI technologies. This repository is designed to guide you through the development journey, from basic prompt structures to advanced, cutting-edge techniques.

Our goal is to provide a valuable resource for everyone - from beginners taking their first steps in AI to seasoned practitioners pushing the boundaries of what's possible. By offering a range of examples from foundational to complex, we aim to facilitate learning, experimentation, and innovation in the rapidly evolving field of prompt engineering.

Furthermore, this repository serves as a platform for showcasing innovative prompt engineering techniques. Whether you've developed a novel approach or found an innovative application for existing techniques, we encourage you to share your work with the community.

📖 The book version of this repo

Prompt Engineering from Zero to Hero - all 22 techniques from this repo, fully explained with step-by-step breakdowns and hands-on exercises.

Amazon Kindle - $9.99 · Paperback · Gumroad PDF

Related Projects

🔍 RAG Techniques - 40+ notebooks on retrieval-augmented generation.

🤖 GenAI Agents - implementations and tutorials for building AI agent systems.

🚀 Agents Towards Production - code-first tutorials for shipping production-grade agents.

🧠 Agent Memory Techniques - 30 notebooks on agent memory: vector stores, graphs, Mem0, Zep.

Join the community

Contributions make this better - propose ideas, share techniques, or give feedback via CONTRIBUTING.md.

r/EducationalAI · Discord · LinkedIn

Key Features

Prompt Engineering Techniques

Explore our extensive list of prompt engineering techniques, ranging from basic to advanced:

| # | Category | Technique | Description | |---|----------|-----------|-------------| | 1 | 🎓 Fundamental Concepts | Introduction to Prompt Engineering | Comprehensive introduction to fundamental concepts of prompt engineering | | 2 | 🎓 Fundamental Concepts | Basic Prompt Structures | Exploration of single-turn and multi-turn prompt structures | | 3 | 🎓 Fundamental Concepts | Prompt Templates and Variables | Creating and using prompt templates with variables | | 4 | 🔧 Core Techniques | Zero-Shot Prompting | Performing tasks without specific examples | | 5 | 🔧 Core Techniques | Few-Shot Learning | Learning from a small number of examples | | 6 | 🔧 Core Techniques | Chain of Thought (CoT) | Step-by-step reasoning processes | | 7 | 🎯 Advanced Strategies | Self-Consistency | Multiple reasoning paths and result aggregation | | 8 | 🎯 Advanced Strategies | Constrained Generation | Setting up output constraints | | 9 | 🎯 Advanced Strategies | Role Prompting | Assigning specific roles to AI models | | 10 | 🚀 Advanced Implementations | Task Decomposition | Breaking down complex tasks | | 11 | 🚀 Advanced Implementations | Prompt Chaining | Connecting multiple prompts | | 12 | 🚀 Advanced Implementations | Instruction Engineering | Crafting clear instructions | | 13 | ⚡ Optimization | Prompt Optimization | A/B testing and refinement | | 14 | ⚡ Optimization | Handling Ambiguity | Resolving ambiguous prompts | | 15 | ⚡ Optimization | Length Management | Managing prompt complexity | | 16 | 🛠️ Specialized Applications | Negative Prompting | Avoiding undesired outputs | | 17 | 🛠️ Specialized Applications | Prompt Formatting | Various prompt formats | | 18 | 🛠️ Specialized Applications | Task-Specific Prompts | Prompts for specific tasks | | 19 | 🌍 Advanced Applications | Multilingual Prompting | Cross-lingual techniques | | 20 | 🌍 Advanced Applications | Ethical Considerations | Bias avoidance and inclusivity | | 21 | 🌍 Advanced Applications | Prompt Security | Preventing injections | | 22 | 🌍 Advanced Applications | Effectiveness Evaluation | Evaluating prompt performance |

🌱 Fundamental Concepts

1. Introduction to Prompt Engineering

#### Overview 🔎 A comprehensive introduction to the fundamental concepts of prompt engineering in the context of AI and language models.

#### Implementation 🛠️ Combines theoretical explanations with practical demonstrations, covering basic concepts, structured prompts, comparative analysis, and problem-solving applications.

2. Basic Prompt Structures

#### Overview 🔎 Explores two fundamental types of prompt structures: single-turn prompts and multi-turn prompts (conversations).

#### Implementation 🛠️ Uses OpenAI's GPT model and LangChain to demonstrate single-turn and multi-turn prompts, prompt templates, and conversation chains.

3. Prompt Templates and Variables

#### Overview 🔎 Introduces creating and using prompt templates with variables, focusing on Python and the Jinja2 templating engine.

#### Implementation 🛠️ Covers template creation, variable insertion, conditional content, list processing, and integration with the OpenAI API.

🔧 Core Techniques

4. Zero-Shot Prompting

#### Overview 🔎 Explores zero-shot prompting, allowing language models to perform tasks without specific examples or prior training.

#### Implementation 🛠️ Demonstrates direct task specification, role-based prompting, format specification, and multi-step reasoning using OpenAI and LangChain.

5. Few-Shot Learning and In-Context Learning

#### Overview 🔎 Covers Few-Shot Learning and In-Context Learning techniques using OpenAI's GPT models and the LangChain library.

#### Implementation 🛠️ Implements basic and advanced few-shot learning, in-context learning, and best practices for example selection and evaluation.

6. Chain of Thought (CoT) Prompting

#### Overview 🔎 Introduces Chain of Thought (CoT) prompting, encouraging AI models to break down complex problems into step-by-step reasoning processes.

#### Implementation 🛠️ Covers basic and advanced CoT techniques, applying them to various problem-solving scenarios and comparing results with standard prompts.

🔍 Advanced Strategies

7. Self-Consistency and Multiple Paths of Reasoning

#### Overview 🔎 Explores techniques for generating diverse reasoning paths and aggregating results to improve AI-generated answers.

#### Implementation 🛠️ Demonstrates designing diverse reasoning prompts, generating multiple responses, implementing aggregation methods, and applying self-consistency checks.

8. Constrained and Guided Generation

#### Overview 🔎 Focuses on techniques to set up constraints for model outputs and implement rule-based generation.

#### Implementation 🛠️ Uses LangChain's PromptTemplate for structured prompts, implements constraints, and explores rule-based generation techniques.

9. Role Prompting

#### Overview 🔎 Explores assigning specific roles to AI models and crafting effective role descriptions.

#### Implementation 🛠️ Demonstrates creating role-based prompts, assigning roles to AI models, and refining role descriptions for various scenarios.

🚀 Advanced Implementations

10. Task Decomposition in Prompts

#### Overview 🔎 Explores techniques for breaking down complex tasks and chaining subtasks in prompts.

#### Implementation 🛠️ Covers problem analysis, subtask definition, targeted prompt engineering, sequential execution, and result synthesis.

11. Prompt Chaining and Sequencing

#### Overview 🔎 Demonstrates how to connect multiple prompts and build logical flows for complex AI-driven tasks.

#### Implementation 🛠️ Explores basic prompt chaining, sequential prompting, dynamic prompt generation, and error handling within prompt chains.

12. Instruction Engineering

#### Overview 🔎 Focuses on crafting clear and effective instructions for language models, balancing specificity and generality.

#### Implementation 🛠️ Covers creating and refining instructions, experimenting with different structures, and implementing iterative improvement based on model responses.

🎨 Optimization and Refinement

13. Prompt Optimization Techniques

#### Overview 🔎 Explores advanced techniques for optimizing prompts, focusing on A/B testing and iterative refinement.

#### Implementation 🛠️ Demonstrates A/B testing of prompts, iterative refinement processes, and performance evaluation using relevant metrics.

14. Handling Ambiguity and Improving Clarity

#### Overview 🔎 Focuses on identifying and resolving ambiguous prompts and techniques for writing clearer prompts.

#### Implementation 🛠️ Covers analyzing ambiguous prompts, implementing strategies to resolve ambiguity, and exploring techniques for writing clearer prompts.

15. Prompt Length and Complexity Management

#### Overview 🔎 Explores techniques for managing prompt length and complexity when working with large language models.

#### Implementation 🛠️ Demonstrates techniques for balancing detail and conciseness, and strategies for handling long contexts including chunking, summarization, and iterative processing.

🛠️ Specialized Applications

16. Negative Prompting and Avoiding Undesired Outputs

#### Overview 🔎 Explores negative prompting and techniques for avoiding undesired outputs from large language models.

#### Implementation 🛠️ Covers basic negative examples, explicit exclusions, constraint implementation using LangChain, and methods for evaluating and refining negative prompts.

17. Prompt Formatting and Structure

#### Overview 🔎 Explores various prompt formats and structural elements, demonstrating their impact on AI model responses.

#### Implementation 🛠️ Demonstrates creating various prompt formats, incorporating structural elements, and comparing responses from different prompt structures.

18. Prompts for Specific Tasks

#### Overview 🔎 Explores the creation and use of prompts for specific tasks: text summarization, question-answering, code generation, and creative wri

GitHub Stars & Activity

7,859Stars
1,027Forks
0Open issues
Jupyter NotebookLanguage

GitHub Popularity

GitHub stars7,859
Forks1,027
Open issues0
Primary languageJupyter Notebook
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

microsoft / generative-ai-for-beginners

Jupyter Notebook★ 120,121⑂ 63,239
2

AI4Finance-Foundation / FinGPT

Jupyter Notebook★ 21,271⑂ 3,013
3

langgptai / LangGPT

Jupyter Notebook★ 12,540⑂ 947
4

AI4Finance-Foundation / FinRobot

Jupyter Notebook★ 8,037⑂ 1,357
5

f / prompts.chat

HTML★ 170,803⑂ 21,945
6

DietrichGebert / ponytail

JavaScript★ 142,816⑂ 7,659
7

JuliusBrussee / caveman

Go★ 106,886⑂ 6,182
8

dair-ai / Prompt-Engineering-Guide

MDX★ 78,489⑂ 8,630

More AI Rankings