Prompt engineering is the practice of designing and refining inputs (prompts) to guide Large Language Models (LLMs) toward producing desired outputs. Well-crafted prompts can dramatically improve the quality, accuracy, and relevance of AI-generated responses.
Why is prompt engineering important?
- Control and precision: Direct the model to produce specific formats, tones, or types of responses
- Better results with less effort: Get accurate answers without fine-tuning or training custom models
- Cost-effective: Optimize model performance using existing pre-trained models
- Flexibility: Quickly adapt model behavior for different use cases
When to use prompt engineering:
- Building chatbots, virtual assistants, or conversational interfaces
- Creating content generation systems (documentation, FAQs, summaries)
- Extracting structured information from unstructured text
- Building Retrieval-Augmented Generation (RAG) systems
- Prototyping AI applications before investing in custom model training
This workshop teaches you practical prompt engineering techniques using the LangChain framework—a popular Python library for building LLM applications—with Groq's free LLM API through hands-on exercises.
Understanding the Workflow:
- User Input/Query - Your question or request
- Prompt Template - Structures input with four components:
- Instruction: What the model should do
- External Context: Additional knowledge from documents or databases (source knowledge vs. parametric knowledge)
- User Input: Query dynamically inserted via variables like
{question} - Output Indicator: Guides response format (e.g., "Answer:", structured formatting)
- Few-Shot Examples - Example input-output pairs that teach the model your desired format
- LangChain Chain - Components piped together:
prompt_template | llm | output_parser - LLM (Groq API) - Model (
llama3-8b-8192) processes the prompt with configurable parameters (temperature,max_tokens) - Output Parser - Formats raw responses into usable structures
- Final Response - Polished output for your application
This workflow controls LLM behavior without retraining, enabling production-quality results from general-purpose models.
Work through these two Jupyter notebooks sequentially:
- 1_intro_langchain.ipynb - Introduction to LangChain
- 2_langchain_prompt_engineering.ipynb - Prompt Engineering with LangChain
Notebook 1: LangChain Fundamentals
- What LangChain is and its core components (prompts, LLMs, chains, tools, agents, memory)
- How to integrate LLMs (specifically Groq's API) with LangChain
- How to create prompt templates with dynamic input variables
- How to build chains by piping components together (
prompt | llm) - How to invoke chains for single and batch queries
Notebook 2: Prompt Engineering Techniques
- Applying the 4-part prompt structure in practice
- Context-based question answering with external knowledge
- Few-shot prompting with example input-output pairs
- Using
FewShotPromptTemplateto structure examples systematically - Chaining with output parsers for formatted responses
- Python 3.11.3 installed (via pyenv)
- Free Groq API key from Groq Console
- Basic understanding of Python and Jupyter notebooks
1. Get your Groq API key
- Create a free account at Groq Console
- Generate your API key (no credit card required)
2. Create .env file
Create a .env file in the repository root with:
GROQ_API_KEY=<your groq api key>
3. Set up your Python environment
macOS:
pyenv local 3.11.3
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtWindows (PowerShell):
pyenv local 3.11.3
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txtWindows (Git Bash):
pyenv local 3.11.3
python -m venv .venv
source .venv/Scripts/activate
python -m pip install --upgrade pip
pip install -r requirements.txtPrompt engineering makes AI applications more efficient and effective. Application developers typically encapsulate open-ended user input inside a prompt before passing it to the AI model.
For example, consider AI chatbots. A user may enter an incomplete problem statement like, "Where to purchase a shirt." Internally, the application's code uses an engineered prompt that says, "You are a sales assistant for a clothing company. A user, based in Alabama, United States, is asking you where to purchase a shirt. Respond with the three nearest store locations that currently stock a shirt." The chatbot then generates more relevant and accurate information. AWS Prompt Engineering
The prompt engineering techniques are actively used in production by major companies worldwide:
Source: LangGraph in Production
- Klarna: AI customer support assistant serving 85 million active users, reducing customer resolution time by 80%
- LinkedIn: AI-powered recruiter automating candidate sourcing and SQL Bot that transforms natural language questions into SQL queries
- Uber: Automated unit test generation for large-scale code migrations using multi-agent systems
- AppFolio: AI copilot saving property managers 10+ hours per week with 2x improvement in decision accuracy
Source: Top LangGraph Agents in Production 2024
- Cisco Outshift: AI Platform Engineer boosting developer productivity 10x, reducing CI/CD pipeline setup from one week to under one hour
Source: LangChain Use Cases - Airbyte
- Organizations report LangChain pipelines shorten deployment by 3-5x and reduce manual data engineering tasks by up to 80%
- Used by 100,000+ companies worldwide for document Q&A, conversational AI, and automated knowledge systems
After completing this workshop, you'll have the skills to build your own prompt engineering applications. Here are practical project ideas that apply what you've learned:
Analyze job postings and extract structured information (skills, requirements, experience levels).
Workflow:
- Paste job posting text
- Extract requirements with prompt template
- Categorize skills using few-shot examples
- Generate cover letter outline via chained prompt
Extensions: Compare multiple postings, generate tailored resume bullets, create skills gap analysis
Convert content between formats (e.g., technical docs to beginner guides, meeting notes to action items).
Workflow:
- Start with source content
- Use few-shot examples for desired transformation
- Build chain:
extraction_prompt | llm | formatting_prompt | llm | output_parser - Batch process multiple documents
Examples: Meeting notes → action items, research papers → summaries, code docs → tutorials
Pick a project that solves a real problem you have. Start simple:
- Define your input and desired output clearly
- Create a basic prompt template with the 4 components (instruction, context, input variable, output indicator)
- Test with a few examples manually
- Add few-shot examples if formatting is complex
- Build chains if you need multi-step processing
- Scale with batch processing
Additional resources:
