# Prompt Engineering

This module is most useful when treated as systems design for model interaction, not as a bag of prompt hacks. The repo currently focuses on the practical subset you can actually apply in production workflows.

## Actual Module Contents

1. [01_START_HERE.ipynb](01_START_HERE.ipynb)
2. [02_basic_prompting.ipynb](02_basic_prompting.ipynb)
3. [03_chain_of_thought.ipynb](03_chain_of_thought.ipynb)
4. [04_react_prompting.ipynb](04_react_prompting.ipynb)
5. [05_structured_outputs_dspy.ipynb](05_structured_outputs_dspy.ipynb)
6. [06_long_context_strategies.ipynb](06_long_context_strategies.ipynb)
7. [08_assignment.md](08_assignment.md)

## What To Learn Here

- How prompt quality changes task reliability
- When few-shot examples are worth the extra tokens
- How ReAct changes model behavior when tools are involved
- Why structured outputs are better than post-hoc parsing
- How to handle long contexts without blindly stuffing documents into prompts
- How reasoning models change prompting strategy and output expectations
- When prompt caching, context compression, and schema-first design matter more than clever wording

## Recent 2026 Prompting Topics

- Reasoning-model prompting for deliberate models that think longer before answering
- Context engineering: prompt layering, retrieval packing, and instruction hierarchy
- Prompt caching and prefix reuse to reduce cost and latency
- Structured generation with JSON schema constraints and tool-first interfaces
- Eval-driven prompt iteration instead of subjective prompt tweaking

## Recommended Study Order

- Start with [02_basic_prompting.ipynb](02_basic_prompting.ipynb)
- Move to [03_chain_of_thought.ipynb](03_chain_of_thought.ipynb) for reasoning patterns
- Study [04_react_prompting.ipynb](04_react_prompting.ipynb) before Phase 15 agents
- Use [05_structured_outputs_dspy.ipynb](05_structured_outputs_dspy.ipynb) to connect prompting with reliability
- Finish with [06_long_context_strategies.ipynb](06_long_context_strategies.ipynb) before deeper RAG and agent work

## Learning Advice

- Prompting is not a substitute for retrieval, fine-tuning, or evaluation.
- If a task fails, ask whether the real issue is missing context, poor tools, or missing schema constraints.
- Keep examples and output formats explicit; ambiguity is expensive.

## Good Follow-On Projects

- A structured extraction pipeline with validation
- A multi-step research assistant using ReAct
- A long-context summarizer that compares chunk-then-summarize vs direct prompting

## What Comes Next

- Continue to [../15-ai-agents/README.md](../15-ai-agents/README.md) if you want tool-using systems.
- Revisit [../08-rag/README.md](../08-rag/README.md) if you want to improve retrieval prompts and answer synthesis.
- Continue to [../16-model-evaluation/README.md](../16-model-evaluation/README.md) if you want to measure prompt quality instead of iterating by intuition.
