Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.4. Prompt Engineering and Fine-Tuning

Prompt Engineering Techniques:
TechniqueDescription
System promptSet persona and rules
Few-shot examplesProvide input/output examples
Chain-of-thoughtRequest step-by-step reasoning
Output formatSpecify JSON, markdown, etc.
JSON Mode (Structured Output):
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[...],
    response_format={"type": "json_object"}  # Forces valid JSON output
)
When to Fine-Tune vs. Prompt Engineer:
ApproachUse When
Prompt EngineeringFirst approach; sufficient for most cases
Fine-TuningConsistent style needed; reduce token usage
RAGNeed factual/current knowledge (not fine-tuning!)

⚠️ Exam Trap: Fine-tuning does NOT add new knowledge—use RAG for that.

Alvin Varughese
Written byAlvin Varughese
Founder15 professional certifications