Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Prompt Engineering Masterclass

Advanced prompting techniques for LLMs with working GPT-4 code examples.

Techniques Covered

Technique Description Use Case
Few-Shot Learning Provide examples to guide output format Classification, formatting
Chain-of-Thought Step-by-step reasoning Math, logic, complex problems
Persona Prompting Define LLM personality/expertise Domain-specific tasks
Self-Consistency Multiple reasoning paths, majority vote Improved accuracy
Iterative Refinement Self-reflection and improvement loops Quality enhancement
Role-Playing Scenario-based dialogue generation Creative writing, simulation

What You'll Learn

  • How to shape LLM behavior through systematic prompt design
  • Techniques to improve output accuracy and consistency
  • Methods for guiding code generation with explanations
  • Strategies for maintaining context in multi-turn conversations

Notebooks

Each notebook includes working code examples using the OpenAI API:

  1. Persona-based Prompting - Shape the LLM's "personality" for specific domains
  2. Few-Shot Learning - Demonstrate desired input-output format with examples
  3. Code-based Prompting - Guide code generation with explanations
  4. Chain-of-Thought - Encourage logical step-by-step reasoning
  5. Iterative Refinement - Improve responses through self-reflection
  6. Role-Playing Scenarios - Create engaging narratives and dialogues

Quick Start

pip install openai
export OPENAI_API_KEY=your_key_here
jupyter notebook

Requirements

  • Python 3.8+
  • OpenAI API key
  • Jupyter Notebook

Tech Stack

  • LLM: GPT-4 / GPT-4-Turbo
  • API: OpenAI Python SDK
  • Environment: Jupyter Notebooks

License

MIT

About

Working GPT-4 notebooks covering few-shot prompting, self-consistency, ReAct, and iterative refinement

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages