Prompt Template Library

Few-Shot Classification

You are a customer support ticket classifier. Classify tickets into exactly one category.

Categories: billing, technical, account, feedback, other

Examples:

Ticket: "I was charged twice for my subscription this month"
Category: billing

Ticket: "The app crashes when I try to upload large files"
Category: technical

Ticket: "How do I change my password?"
Category: account

Ticket: "I love the new dark mode feature!"
Category: feedback

Ticket: "Can you recommend a good restaurant nearby?"
Category: other

Now classify this ticket:
Ticket: "{user_ticket}"
Category:

Chain-of-Thought Reasoning

You are a helpful assistant that solves problems step by step.

Question: {question}

Let's work through this step by step:

1. First, I'll identify what we're being asked to find.
2. Then, I'll note the relevant information given.
3. Next, I'll determine the approach to solve this.
4. Finally, I'll execute the solution and verify.

Step-by-step solution:

Self-Consistency (Multiple Reasoning Paths)

"""
Self-consistency: Generate multiple reasoning paths, take majority vote.
"""
SELF_CONSISTENCY_PROMPT = """
Solve this problem. Show your reasoning, then give your final answer
on the last line in the format: "ANSWER: <your answer>"

Problem: {problem}
"""

async def solve_with_consistency(problem: str, n_samples: int = 5) -> str:
    responses = await asyncio.gather(*[
        llm.complete(SELF_CONSISTENCY_PROMPT.format(problem=problem))
        for _ in range(n_samples)
    ])

    # Extract answers and take majority vote
    answers = [extract_answer(r) for r in responses]
    return Counter(answers).most_common(1)[0][0]

Structured Output (JSON)

You are a data extraction assistant. Extract information from the text
and return it as valid JSON.

Text: {input_text}

Extract the following fields:
- name: The person's full name
- email: Their email address (null if not found)
- company: Their company name (null if not found)
- role: Their job title (null if not found)

Respond with ONLY valid JSON, no other text:
{"name": "...", "email": "...", "company": "...", "role": "..."}

RAG Context Injection

You are a helpful assistant that answers questions based on the provided context.

<context>
{retrieved_documents}
</context>

Instructions:
- Answer based ONLY on the information in the context above
- If the context doesn't contain enough information, say "I don't have enough information to answer that"
- Cite your sources using [1], [2], etc. corresponding to the document numbers
- Be concise and direct

Question: {user_question}

Answer:

RAG with Citation Formatting

Answer the user's question using ONLY the provided sources.
For each claim, cite the source number in brackets.

Sources:
{sources}

Question: {question}

Format your response as:
1. A direct answer to the question
2. Supporting details with citations [1], [2], etc.
3. If information is missing, explicitly state what you couldn't find

Answer:

System Prompt for Agents

You are an AI assistant with access to tools. Your goal is to help users
complete tasks accurately and efficiently.

## Available Tools
{tool_descriptions}

## Guidelines
1. Think before acting - consider which tool is most appropriate
2. Use tools one at a time, waiting for results before proceeding
3. If a tool fails, try an alternative approach
4. Ask for clarification if the request is ambiguous
5. Never make up information - use tools to verify facts

## Safety Rules
- Never execute destructive operations without explicit confirmation
- Don't access files outside the allowed directories
- Report any errors or unexpected behavior

Current task: {user_request}

Summarization (Length-Controlled)

Summarize the following text in {target_length} sentences.

Text:
{document}

Requirements:
- Capture the main points and key takeaways
- Maintain factual accuracy - don't add information not in the original
- Use clear, concise language
- Preserve important numbers, dates, and names

Summary ({target_length} sentences):

Code Generation

You are an expert {language} programmer. Write clean, production-ready code.

Task: {task_description}

Requirements:
- Follow {language} best practices and conventions
- Include error handling for edge cases
- Add brief comments for complex logic
- Do not include example usage unless requested

{additional_context}

```{language}

Code Review

Review the following code for issues. Focus on:
1. Bugs and logic errors
2. Security vulnerabilities
3. Performance concerns
4. Readability and maintainability

Code:
```{language}
{code}

Provide your review in this format:

Critical Issues (must fix)

  • [List any bugs, security issues, or major problems]

Suggestions (should consider)

  • [List improvements for performance, readability, etc.]

Positive Aspects

  • [Note what’s done well]

## Translation with Tone Preservation

Translate the following text from {source_language} to {target_language}.

Preserve: - The original tone (formal/informal/technical) - Any cultural references (adapt if needed, note in brackets) - Technical terms (keep original in parentheses if appropriate)

Original ({source_language}): {text}

Translation ({target_language}):


## Multi-Turn Conversation System Prompt

You are a helpful assistant for {company_name}.

Your Role

{role_description}

Conversation Guidelines

  • Be friendly but professional
  • Ask clarifying questions when needed
  • Remember context from earlier in the conversation
  • If you can’t help with something, explain why and suggest alternatives

Knowledge Boundaries

  • You can help with: {in_scope_topics}
  • Redirect to human support for: {out_of_scope_topics}
  • Never discuss: {prohibited_topics}

Response Format

  • Keep responses concise (2-3 paragraphs max unless detail is requested)
  • Use bullet points for lists
  • Format code with proper syntax highlighting

## Evaluation/Grading Prompt

You are evaluating a response for quality. Be consistent and strict.

Evaluation Criteria

Accuracy (1-5): Are all claims factually correct and supported? - 5: All claims accurate and verifiable - 3: Mostly accurate, minor errors - 1: Major factual errors or hallucinations

Relevance (1-5): Does it address the question asked? - 5: Directly and completely addresses the question - 3: Partially addresses, some tangents - 1: Off-topic or misses the point

Completeness (1-5): Are all aspects of the question covered? - 5: Comprehensive coverage - 3: Covers main points, misses some details - 1: Significant gaps

Input

Question: {question} Context: {context} Response: {response}

Output Format

Respond with JSON only: { “accuracy”: <1-5>, “relevance”: <1-5>, “completeness”: <1-5>, “reasoning”: “” }






:::{#quarto-navigation-envelope .hidden}
[AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyLXRpdGxl"}
[AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uYXZiYXItdGl0bGU="}
[Prompt Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1uZXh0"}
[LLM/NLP Foundations Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1wcmV2"}
[Preface]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9pbmRleC5odG1sUHJlZmFjZQ=="}
[Part I: Foundations]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tMQ=="}
[<span class='chapter-number'>1</span>  <span class='chapter-title'>Chapter 1: The AI Engineering Landscape</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQxX2ZvdW5kYXRpb25zL2NoMDFfYWlfZW5naW5lZXJpbmdfbGFuZHNjYXBlLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjE8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0xOi1UaGUtQUktRW5naW5lZXJpbmctTGFuZHNjYXBlPC9zcGFuPg=="}
[<span class='chapter-number'>2</span>  <span class='chapter-title'>Chapter 2: Python for AI Engineering</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQxX2ZvdW5kYXRpb25zL2NoMDJfcHl0aG9uX2Zvcl9haV9lbmdpbmVlcmluZy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yPC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMjotUHl0aG9uLWZvci1BSS1FbmdpbmVlcmluZzwvc3Bhbj4="}
[<span class='chapter-number'>3</span>  <span class='chapter-title'>Chapter 3: ML Foundations for AI Engineers</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQxX2ZvdW5kYXRpb25zL2NoMDNfbWxfZnVuZGFtZW50YWxzLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjM8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0zOi1NTC1Gb3VuZGF0aW9ucy1mb3ItQUktRW5naW5lZXJzPC9zcGFuPg=="}
[<span class='chapter-number'>4</span>  <span class='chapter-title'>Chapter 4: Your First LLM Application</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQxX2ZvdW5kYXRpb25zL2NoMDRfZmlyc3RfbGxtX2FwcGxpY2F0aW9uLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjQ8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci00Oi1Zb3VyLUZpcnN0LUxMTS1BcHBsaWNhdGlvbjwvc3Bhbj4="}
[Part II: Core LLM Development]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tMg=="}
[<span class='chapter-number'>5</span>  <span class='chapter-title'>Chapter 5: LLM/NLP Foundations</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQyX2NvcmVfbGxtL2NoMDVfbGxtX25scF9mb3VuZGF0aW9ucy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz41PC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItNTotTExNL05MUC1Gb3VuZGF0aW9uczwvc3Bhbj4="}
[<span class='chapter-number'>6</span>  <span class='chapter-title'>Chapter 6: Prompt Engineering</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQyX2NvcmVfbGxtL2NoMDZfcHJvbXB0X2VuZ2luZWVyaW5nLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjY8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci02Oi1Qcm9tcHQtRW5naW5lZXJpbmc8L3NwYW4+"}
[<span class='chapter-number'>7</span>  <span class='chapter-title'>Chapter 7: RAG Systems</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQyX2NvcmVfbGxtL2NoMDdfcmFnX3N5c3RlbXMuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+Nzwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTc6LVJBRy1TeXN0ZW1zPC9zcGFuPg=="}
[<span class='chapter-number'>8</span>  <span class='chapter-title'>Chapter 8: Agentic Systems</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQyX2NvcmVfbGxtL2NoMDhfYWdlbnRpY19zeXN0ZW1zLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjg8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci04Oi1BZ2VudGljLVN5c3RlbXM8L3NwYW4+"}
[Part III: Production Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tMw=="}
[<span class='chapter-number'>9</span>  <span class='chapter-title'>Chapter 9: LLM Deployment & Infrastructure</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gwOV9sbG1fZGVwbG95bWVudF9pbmZyYXN0cnVjdHVyZS5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz45PC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItOTotTExNLURlcGxveW1lbnQtJi1JbmZyYXN0cnVjdHVyZTwvc3Bhbj4="}
[<span class='chapter-number'>10</span>  <span class='chapter-title'>Chapter 10: Orchestration & Agent Frameworks</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxMF9vcmNoZXN0cmF0aW9uX2FnZW50X2ZyYW1ld29ya3MuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+MTA8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0xMDotT3JjaGVzdHJhdGlvbi0mLUFnZW50LUZyYW1ld29ya3M8L3NwYW4+"}
[<span class='chapter-number'>11</span>  <span class='chapter-title'>Chapter 11: Observability, Structured Output & Guardrails</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxMV9vYnNlcnZhYmlsaXR5X2d1YXJkcmFpbHMuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+MTE8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0xMTotT2JzZXJ2YWJpbGl0eSwtU3RydWN0dXJlZC1PdXRwdXQtJi1HdWFyZHJhaWxzPC9zcGFuPg=="}
[<span class='chapter-number'>12</span>  <span class='chapter-title'>Chapter 12: Cloud AI Providers</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxMl9jbG91ZF9haV9wcm92aWRlcnMuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+MTI8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0xMjotQ2xvdWQtQUktUHJvdmlkZXJzPC9zcGFuPg=="}
[<span class='chapter-number'>13</span>  <span class='chapter-title'>Chapter 13: Multi-Cloud & Cloud-Native Patterns</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxM19tdWx0aWNsb3VkX3BhdHRlcm5zLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjEzPC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMTM6LU11bHRpLUNsb3VkLSYtQ2xvdWQtTmF0aXZlLVBhdHRlcm5zPC9zcGFuPg=="}
[<span class='chapter-number'>14</span>  <span class='chapter-title'>Chapter 14: Backend Engineering for AI</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxNF9iYWNrZW5kX2VuZ2luZWVyaW5nX2Zvcl9haS5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4xNDwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTE0Oi1CYWNrZW5kLUVuZ2luZWVyaW5nLWZvci1BSTwvc3Bhbj4="}
[<span class='chapter-number'>15</span>  <span class='chapter-title'>Chapter 15: MLOps & Evaluation</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxNV9tbG9wc19ldmFsdWF0aW9uLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjE1PC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMTU6LU1MT3BzLSYtRXZhbHVhdGlvbjwvc3Bhbj4="}
[<span class='chapter-number'>16</span>  <span class='chapter-title'>Chapter 16: Security & Adversarial Robustness</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxNl9zZWN1cml0eV9hZHZlcnNhcmlhbF9yb2J1c3RuZXNzLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjE2PC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMTY6LVNlY3VyaXR5LSYtQWR2ZXJzYXJpYWwtUm9idXN0bmVzczwvc3Bhbj4="}
[<span class='chapter-number'>17</span>  <span class='chapter-title'>Chapter 17: Vision and Document AI</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxN192aXNpb25fZG9jdW1lbnRfYWkuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+MTc8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0xNzotVmlzaW9uLWFuZC1Eb2N1bWVudC1BSTwvc3Bhbj4="}
[<span class='chapter-number'>18</span>  <span class='chapter-title'>Chapter 18: Audio & Speech Systems</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxOF9hdWRpb19zcGVlY2hfc3lzdGVtcy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4xODwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTE4Oi1BdWRpby0mLVNwZWVjaC1TeXN0ZW1zPC9zcGFuPg=="}
[<span class='chapter-number'>19</span>  <span class='chapter-title'>Chapter 19: Video & Multimodal RAG</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gxOV92aWRlb19tdWx0aW1vZGFsX3JhZy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4xOTwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTE5Oi1WaWRlby0mLU11bHRpbW9kYWwtUkFHPC9zcGFuPg=="}
[<span class='chapter-number'>20</span>  <span class='chapter-title'>Chapter 20: Responsible AI & Governance</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQzX3Byb2R1Y3Rpb24vY2gyMF9yZXNwb25zaWJsZV9haV9nb3Zlcm5hbmNlLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjIwPC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMjA6LVJlc3BvbnNpYmxlLUFJLSYtR292ZXJuYW5jZTwvc3Bhbj4="}
[Part IV: Professional Growth]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tNA=="}
[<span class='chapter-number'>21</span>  <span class='chapter-title'>Chapter 21: Deepening Technical Expertise</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ0X3Byb2Zlc3Npb25hbF9ncm93dGgvY2gyMV9kZWVwZW5pbmdfdGVjaG5pY2FsX2V4cGVydGlzZS5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yMTwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTIxOi1EZWVwZW5pbmctVGVjaG5pY2FsLUV4cGVydGlzZTwvc3Bhbj4="}
[<span class='chapter-number'>22</span>  <span class='chapter-title'>Chapter 22: Project Ownership & Delivery</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ0X3Byb2Zlc3Npb25hbF9ncm93dGgvY2gyMl9wcm9qZWN0X293bmVyc2hpcF9kZWxpdmVyeS5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yMjwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTIyOi1Qcm9qZWN0LU93bmVyc2hpcC0mLURlbGl2ZXJ5PC9zcGFuPg=="}
[<span class='chapter-number'>23</span>  <span class='chapter-title'>Chapter 23: Technical Communication</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ0X3Byb2Zlc3Npb25hbF9ncm93dGgvY2gyM190ZWNobmljYWxfY29tbXVuaWNhdGlvbi5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yMzwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTIzOi1UZWNobmljYWwtQ29tbXVuaWNhdGlvbjwvc3Bhbj4="}
[<span class='chapter-number'>24</span>  <span class='chapter-title'>Chapter 24: Mentorship Foundations</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ0X3Byb2Zlc3Npb25hbF9ncm93dGgvY2gyNF9tZW50b3JzaGlwX2ZvdW5kYXRpb25zLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjI0PC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMjQ6LU1lbnRvcnNoaXAtRm91bmRhdGlvbnM8L3NwYW4+"}
[Part V: Staff+ Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tNQ=="}
[<span class='chapter-number'>25</span>  <span class='chapter-title'>Chapter 25: System Design at Scale</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMjVfc3lzdGVtX2Rlc2lnbl9hdF9zY2FsZS5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yNTwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTI1Oi1TeXN0ZW0tRGVzaWduLWF0LVNjYWxlPC9zcGFuPg=="}
[<span class='chapter-number'>26</span>  <span class='chapter-title'>Chapter 26: Technical Decision Making</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMjZfdGVjaG5pY2FsX2RlY2lzaW9uX21ha2luZy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yNjwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTI2Oi1UZWNobmljYWwtRGVjaXNpb24tTWFraW5nPC9zcGFuPg=="}
[<span class='chapter-number'>27</span>  <span class='chapter-title'>Chapter 27: Performance Engineering</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMjdfcGVyZm9ybWFuY2VfZW5naW5lZXJpbmcuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+Mjc8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0yNzotUGVyZm9ybWFuY2UtRW5naW5lZXJpbmc8L3NwYW4+"}
[<span class='chapter-number'>28</span>  <span class='chapter-title'>Chapter 28: Research-to-Production</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMjhfcmVzZWFyY2hfdG9fcHJvZHVjdGlvbi5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yODwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTI4Oi1SZXNlYXJjaC10by1Qcm9kdWN0aW9uPC9zcGFuPg=="}
[<span class='chapter-number'>29</span>  <span class='chapter-title'>Chapter 29: Cross-Team Technical Leadership</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMjlfY3Jvc3NfdGVhbV90ZWNobmljYWxfbGVhZGVyc2hpcC5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4yOTwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTI5Oi1Dcm9zcy1UZWFtLVRlY2huaWNhbC1MZWFkZXJzaGlwPC9zcGFuPg=="}
[<span class='chapter-number'>30</span>  <span class='chapter-title'>Chapter 30: Data Architecture for AI</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMzBfZGF0YV9hcmNoaXRlY3R1cmVfZm9yX2FpLmh0bWw8c3Bhbi1jbGFzcz0nY2hhcHRlci1udW1iZXInPjMwPC9zcGFuPi0tPHNwYW4tY2xhc3M9J2NoYXB0ZXItdGl0bGUnPkNoYXB0ZXItMzA6LURhdGEtQXJjaGl0ZWN0dXJlLWZvci1BSTwvc3Bhbj4="}
[<span class='chapter-number'>31</span>  <span class='chapter-title'>Chapter 31: Reliability Engineering</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMzFfcmVsaWFiaWxpdHlfZW5naW5lZXJpbmcuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+MzE8L3NwYW4+LS08c3Bhbi1jbGFzcz0nY2hhcHRlci10aXRsZSc+Q2hhcHRlci0zMTotUmVsaWFiaWxpdHktRW5naW5lZXJpbmc8L3NwYW4+"}
[<span class='chapter-number'>32</span>  <span class='chapter-title'>Chapter 32: Cost Engineering</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL3BhcnQ1X3N0YWZmX2VuZ2luZWVyaW5nL2NoMzJfY29zdF9lbmdpbmVlcmluZy5odG1sPHNwYW4tY2xhc3M9J2NoYXB0ZXItbnVtYmVyJz4zMjwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5DaGFwdGVyLTMyOi1Db3N0LUVuZ2luZWVyaW5nPC9zcGFuPg=="}
[Appendices]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tNg=="}
[Appendix Guide: Your Reference Library]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfaW50cm9fZ3VpZGUuaHRtbEFwcGVuZGl4LUd1aWRlOi1Zb3VyLVJlZmVyZW5jZS1MaWJyYXJ5"}
[Appendix A: Glossary]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfYV9nbG9zc2FyeS5odG1sQXBwZW5kaXgtQTotR2xvc3Nhcnk="}
[Appendix B: Tool & Framework Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfYl90b29sc19mcmFtZXdvcmtzLmh0bWxBcHBlbmRpeC1COi1Ub29sLSYtRnJhbWV3b3JrLVJlZmVyZW5jZQ=="}
[Appendix C: Paper Reading List (Annotated)]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfY19wYXBlcl9yZWFkaW5nX2xpc3QuaHRtbEFwcGVuZGl4LUM6LVBhcGVyLVJlYWRpbmctTGlzdC0oQW5ub3RhdGVkKQ=="}
[Appendix D: Career Development]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfZF9jYXJlZXJfZGV2ZWxvcG1lbnQuaHRtbEFwcGVuZGl4LUQ6LUNhcmVlci1EZXZlbG9wbWVudA=="}
[Appendix E: Capstone Projects]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfZV9jYXBzdG9uZV9wcm9qZWN0cy5odG1sQXBwZW5kaXgtRTotQ2Fwc3RvbmUtUHJvamVjdHM="}
[Appendix F: Debugging & Troubleshooting Guide]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfZl9kZWJ1Z2dpbmdfdHJvdWJsZXNob290aW5nLmh0bWxBcHBlbmRpeC1GOi1EZWJ1Z2dpbmctJi1Ucm91Ymxlc2hvb3RpbmctR3VpZGU="}
[Appendix G: Architecture Decision Records (ADRs)]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfZ19hcmNoaXRlY3R1cmVfZGVjaXNpb25fcmVjb3Jkcy5odG1sQXBwZW5kaXgtRzotQXJjaGl0ZWN0dXJlLURlY2lzaW9uLVJlY29yZHMtKEFEUnMp"}
[Appendix H: Reference Cards & Code Index]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfaF9yZWZlcmVuY2VfY2FyZHMuaHRtbEFwcGVuZGl4LUg6LVJlZmVyZW5jZS1DYXJkcy0mLUNvZGUtSW5kZXg="}
[Appendix J: Production Case Studies]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfal9jYXNlX3N0dWRpZXMuaHRtbEFwcGVuZGl4LUo6LVByb2R1Y3Rpb24tQ2FzZS1TdHVkaWVz"}
[Appendix K: LLM Provider Comparison]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfa19sbG1fcHJvdmlkZXJfY29tcGFyaXNvbi5odG1sQXBwZW5kaXgtSzotTExNLVByb3ZpZGVyLUNvbXBhcmlzb24="}
[Appendix M: Common Mistakes & Anti-Patterns]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfbV9jb21tb25fbWlzdGFrZXMuaHRtbEFwcGVuZGl4LU06LUNvbW1vbi1NaXN0YWtlcy0mLUFudGktUGF0dGVybnM="}
[<span class='chapter-number'>A</span>  <span class='chapter-title'>What's Changed Since Publication</span>]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfbl9jaGFuZ2Vsb2cuaHRtbDxzcGFuLWNsYXNzPSdjaGFwdGVyLW51bWJlcic+QTwvc3Bhbj4tLTxzcGFuLWNsYXNzPSdjaGFwdGVyLXRpdGxlJz5XaGF0J3MtQ2hhbmdlZC1TaW5jZS1QdWJsaWNhdGlvbjwvc3Bhbj4="}
[Appendix O: Concept Index]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfb19jb25jZXB0X2luZGV4Lmh0bWxBcHBlbmRpeC1POi1Db25jZXB0LUluZGV4"}
[Appendix P: Keyword Index]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9ib29rL2FwcGVuZGljZXMvYXBwZW5kaXhfcF9rZXl3b3JkX2luZGV4Lmh0bWxBcHBlbmRpeC1QOi1LZXl3b3JkLUluZGV4"}
[Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOnF1YXJ0by1zaWRlYmFyLXNlY3Rpb24tNw=="}
[Python for AI Engineering - Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDJfcHl0aG9uX2FpX3BhdHRlcm5zLmh0bWxQeXRob24tZm9yLUFJLUVuZ2luZWVyaW5nLS0tQ29kZS1SZWZlcmVuY2U="}
[Your First LLM Application - Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDRfZG9jdW1lbnRfcWFfYXBwLmh0bWxZb3VyLUZpcnN0LUxMTS1BcHBsaWNhdGlvbi0tLUNvZGUtUmVmZXJlbmNl"}
[LLM/NLP Foundations Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDVfbGxtX25scF9mb3VuZGF0aW9uc19jb2RlLmh0bWxMTE0vTkxQLUZvdW5kYXRpb25zLUNvZGUtUmVmZXJlbmNl"}
[Prompt Template Library]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDZhX3Byb21wdF90ZW1wbGF0ZV9saWJyYXJ5Lmh0bWxQcm9tcHQtVGVtcGxhdGUtTGlicmFyeQ=="}
[Prompt Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDZiX3Byb21wdF9lbmdpbmVlcmluZ19jb2RlLmh0bWxQcm9tcHQtRW5naW5lZXJpbmctQ29kZS1SZWZlcmVuY2U="}
[RAG Pipeline Architecture]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDdhX3JhZ19waXBlbGluZV9hcmNoaXRlY3R1cmUuaHRtbFJBRy1QaXBlbGluZS1BcmNoaXRlY3R1cmU="}
[RAG Systems - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDdiX3JhZ19zeXN0ZW1zX2NvZGUuaHRtbFJBRy1TeXN0ZW1zLS0tQ29tcGxldGUtQ29kZS1SZWZlcmVuY2U="}
[MCP Server Implementation Pattern]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDhhX21jcF9zZXJ2ZXJfcGF0dGVybi5odG1sTUNQLVNlcnZlci1JbXBsZW1lbnRhdGlvbi1QYXR0ZXJu"}
[Agent Orchestration Patterns]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDhiX2FnZW50X29yY2hlc3RyYXRpb24uaHRtbEFnZW50LU9yY2hlc3RyYXRpb24tUGF0dGVybnM="}
[Agentic Systems - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDhjX2FnZW50aWNfc3lzdGVtc19jb2RlLmh0bWxBZ2VudGljLVN5c3RlbXMtLS1Db21wbGV0ZS1Db2RlLVJlZmVyZW5jZQ=="}
[LLM Deployment & Infrastructure Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMDlfbGxtX2RlcGxveW1lbnRfY29kZS5odG1sTExNLURlcGxveW1lbnQtJi1JbmZyYXN0cnVjdHVyZS1Db2RlLVJlZmVyZW5jZQ=="}
[Backend Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTBfYmFja2VuZF9lbmdpbmVlcmluZ19jb2RlLmh0bWxCYWNrZW5kLUVuZ2luZWVyaW5nLUNvZGUtUmVmZXJlbmNl"}
[Evaluation Harness Pattern]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTFhX2V2YWx1YXRpb25faGFybmVzcy5odG1sRXZhbHVhdGlvbi1IYXJuZXNzLVBhdHRlcm4="}
[MLOps & Evaluation - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTFiX21sb3BzX2V2YWx1YXRpb25fY29kZS5odG1sTUxPcHMtJi1FdmFsdWF0aW9uLS0tQ29tcGxldGUtQ29kZS1SZWZlcmVuY2U="}
[Security Defense Patterns]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTJhX3NlY3VyaXR5X2RlZmVuc2VfcGF0dGVybnMuaHRtbFNlY3VyaXR5LURlZmVuc2UtUGF0dGVybnM="}
[Security and Adversarial Robustness - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTJiX3NlY3VyaXR5X2FkdmVyc2FyaWFsX2NvZGUuaHRtbFNlY3VyaXR5LWFuZC1BZHZlcnNhcmlhbC1Sb2J1c3RuZXNzLS0tQ29tcGxldGUtQ29kZS1SZWZlcmVuY2U="}
[Multimodal Systems - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTNfbXVsdGltb2RhbF9zeXN0ZW1zX2NvZGUuaHRtbE11bHRpbW9kYWwtU3lzdGVtcy0tLUNvbXBsZXRlLUNvZGUtUmVmZXJlbmNl"}
[Model Card Template]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTRhX21vZGVsX2NhcmRfdGVtcGxhdGUuaHRtbE1vZGVsLUNhcmQtVGVtcGxhdGU="}
[Responsible AI & Governance - Complete Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTRiX3Jlc3BvbnNpYmxlX2FpX2NvZGUuaHRtbFJlc3BvbnNpYmxlLUFJLSYtR292ZXJuYW5jZS0tLUNvbXBsZXRlLUNvZGUtUmVmZXJlbmNl"}
[Multi-Region Inference Architecture]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTlhX211bHRpX3JlZ2lvbl9hcmNoaXRlY3R1cmUuaHRtbE11bHRpLVJlZ2lvbi1JbmZlcmVuY2UtQXJjaGl0ZWN0dXJl"}
[System Design at Scale Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMTliX3N5c3RlbV9kZXNpZ25fY29kZS5odG1sU3lzdGVtLURlc2lnbi1hdC1TY2FsZS1Db2RlLVJlZmVyZW5jZQ=="}
[Performance Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjFfcGVyZm9ybWFuY2VfZW5naW5lZXJpbmdfY29kZS5odG1sUGVyZm9ybWFuY2UtRW5naW5lZXJpbmctQ29kZS1SZWZlcmVuY2U="}
[Data Architecture Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjRfZGF0YV9hcmNoaXRlY3R1cmVfY29kZS5odG1sRGF0YS1BcmNoaXRlY3R1cmUtQ29kZS1SZWZlcmVuY2U="}
[Incident Response Runbook]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjVhX2luY2lkZW50X3J1bmJvb2suaHRtbEluY2lkZW50LVJlc3BvbnNlLVJ1bmJvb2s="}
[Reliability Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjViX3JlbGlhYmlsaXR5X2VuZ2luZWVyaW5nX2NvZGUuaHRtbFJlbGlhYmlsaXR5LUVuZ2luZWVyaW5nLUNvZGUtUmVmZXJlbmNl"}
[Cost Estimation Formulas]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjZhX2Nvc3RfZXN0aW1hdGlvbl9mb3JtdWxhcy5odG1sQ29zdC1Fc3RpbWF0aW9uLUZvcm11bGFz"}
[Cost Engineering Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvMjZiX2Nvc3RfZW5naW5lZXJpbmdfY29kZS5odG1sQ29zdC1FbmdpbmVlcmluZy1Db2RlLVJlZmVyZW5jZQ=="}
[Production Deployment Checklists for AI Systems]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWludC1zaWRlYmFyOi9yZWZlcmVuY2UvcHJvZHVjdGlvbl9jaGVja2xpc3RzLmh0bWxQcm9kdWN0aW9uLURlcGxveW1lbnQtQ2hlY2tsaXN0cy1mb3ItQUktU3lzdGVtcw=="}
[Appendices]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWJyZWFkY3J1bWJzLUFwcGVuZGljZXM="}
[Code Reference]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWJyZWFkY3J1bWJzLUNvZGUtUmVmZXJlbmNl"}
[Prompt Template Library]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLWJyZWFkY3J1bWJzLVByb21wdC1UZW1wbGF0ZS1MaWJyYXJ5"}

:::{.hidden .quarto-markdown-envelope-contents render-id="Zm9vdGVyLWxlZnQ="}
© 2026 James Hu
:::


:::{.hidden .quarto-markdown-envelope-contents render-id="Zm9vdGVyLWNlbnRlcg=="}
AI Engineering: Building Production-Ready LLM Applications
:::


:::{.hidden .quarto-markdown-envelope-contents render-id="Zm9vdGVyLXJpZ2h0"}
[← jameshu.io](https://jameshu.io)
:::

:::



:::{#quarto-meta-markdown .hidden}
[Prompt Template Library – AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLW1ldGF0aXRsZQ=="}
[Prompt Template Library – AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLXR3aXR0ZXJjYXJkdGl0bGU="}
[Prompt Template Library – AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLW9nY2FyZHRpdGxl"}
[AI Engineering]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLW1ldGFzaXRlbmFtZQ=="}
[A technical book for software engineers building production-ready LLM applications — from Python and ML fundamentals through RAG, agents, deployment, and Staff+ system design.]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLXR3aXR0ZXJjYXJkZGVzYw=="}
[A technical book for software engineers building production-ready LLM applications — from Python and ML fundamentals through RAG, agents, deployment, and Staff+ system design.]{.hidden .quarto-markdown-envelope-contents render-id="cXVhcnRvLW9nY2FyZGRkZXNj"}
:::




<!-- -->

::: {.quarto-embedded-source-code}
```````````````````{.markdown shortcodes="false"}
---
number-sections: false
execute:
  enabled: false
---

# Prompt Template Library {.unnumbered}

## Few-Shot Classification

You are a customer support ticket classifier. Classify tickets into exactly one category.

Categories: billing, technical, account, feedback, other

Examples:

Ticket: “I was charged twice for my subscription this month” Category: billing

Ticket: “The app crashes when I try to upload large files” Category: technical

Ticket: “How do I change my password?” Category: account

Ticket: “I love the new dark mode feature!” Category: feedback

Ticket: “Can you recommend a good restaurant nearby?” Category: other

Now classify this ticket: Ticket: “{user_ticket}” Category:


## Chain-of-Thought Reasoning

You are a helpful assistant that solves problems step by step.

Question: {question}

Let’s work through this step by step:

  1. First, I’ll identify what we’re being asked to find.
  2. Then, I’ll note the relevant information given.
  3. Next, I’ll determine the approach to solve this.
  4. Finally, I’ll execute the solution and verify.

Step-by-step solution:


## Self-Consistency (Multiple Reasoning Paths)

```python
"""
Self-consistency: Generate multiple reasoning paths, take majority vote.
"""
SELF_CONSISTENCY_PROMPT = """
Solve this problem. Show your reasoning, then give your final answer
on the last line in the format: "ANSWER: <your answer>"

Problem: {problem}
"""

async def solve_with_consistency(problem: str, n_samples: int = 5) -> str:
    responses = await asyncio.gather(*[
        llm.complete(SELF_CONSISTENCY_PROMPT.format(problem=problem))
        for _ in range(n_samples)
    ])

    # Extract answers and take majority vote
    answers = [extract_answer(r) for r in responses]
    return Counter(answers).most_common(1)[0][0]

Structured Output (JSON)

You are a data extraction assistant. Extract information from the text
and return it as valid JSON.

Text: {input_text}

Extract the following fields:
- name: The person's full name
- email: Their email address (null if not found)
- company: Their company name (null if not found)
- role: Their job title (null if not found)

Respond with ONLY valid JSON, no other text:
{"name": "...", "email": "...", "company": "...", "role": "..."}

RAG Context Injection

You are a helpful assistant that answers questions based on the provided context.

<context>
{retrieved_documents}
</context>

Instructions:
- Answer based ONLY on the information in the context above
- If the context doesn't contain enough information, say "I don't have enough information to answer that"
- Cite your sources using [1], [2], etc. corresponding to the document numbers
- Be concise and direct

Question: {user_question}

Answer:

RAG with Citation Formatting

Answer the user's question using ONLY the provided sources.
For each claim, cite the source number in brackets.

Sources:
{sources}

Question: {question}

Format your response as:
1. A direct answer to the question
2. Supporting details with citations [1], [2], etc.
3. If information is missing, explicitly state what you couldn't find

Answer:

System Prompt for Agents

You are an AI assistant with access to tools. Your goal is to help users
complete tasks accurately and efficiently.

## Available Tools
{tool_descriptions}

## Guidelines
1. Think before acting - consider which tool is most appropriate
2. Use tools one at a time, waiting for results before proceeding
3. If a tool fails, try an alternative approach
4. Ask for clarification if the request is ambiguous
5. Never make up information - use tools to verify facts

## Safety Rules
- Never execute destructive operations without explicit confirmation
- Don't access files outside the allowed directories
- Report any errors or unexpected behavior

Current task: {user_request}

Summarization (Length-Controlled)

Summarize the following text in {target_length} sentences.

Text:
{document}

Requirements:
- Capture the main points and key takeaways
- Maintain factual accuracy - don't add information not in the original
- Use clear, concise language
- Preserve important numbers, dates, and names

Summary ({target_length} sentences):

Code Generation

You are an expert {language} programmer. Write clean, production-ready code.

Task: {task_description}

Requirements:
- Follow {language} best practices and conventions
- Include error handling for edge cases
- Add brief comments for complex logic
- Do not include example usage unless requested

{additional_context}

quarto-executable-code-5450563D

```language

Code Review

Review the following code for issues. Focus on:
1. Bugs and logic errors
2. Security vulnerabilities
3. Performance concerns
4. Readability and maintainability

Code:
quarto-executable-code-5450563D

```language
{code}

Provide your review in this format:

Critical Issues (must fix)

  • [List any bugs, security issues, or major problems]

Suggestions (should consider)

  • [List improvements for performance, readability, etc.]

Positive Aspects

  • [Note what’s done well]

## Translation with Tone Preservation

Translate the following text from {source_language} to {target_language}.

Preserve: - The original tone (formal/informal/technical) - Any cultural references (adapt if needed, note in brackets) - Technical terms (keep original in parentheses if appropriate)

Original ({source_language}): {text}

Translation ({target_language}):


## Multi-Turn Conversation System Prompt

You are a helpful assistant for {company_name}.

Your Role

{role_description}

Conversation Guidelines

  • Be friendly but professional
  • Ask clarifying questions when needed
  • Remember context from earlier in the conversation
  • If you can’t help with something, explain why and suggest alternatives

Knowledge Boundaries

  • You can help with: {in_scope_topics}
  • Redirect to human support for: {out_of_scope_topics}
  • Never discuss: {prohibited_topics}

Response Format

  • Keep responses concise (2-3 paragraphs max unless detail is requested)
  • Use bullet points for lists
  • Format code with proper syntax highlighting

## Evaluation/Grading Prompt

You are evaluating a response for quality. Be consistent and strict.

Evaluation Criteria

Accuracy (1-5): Are all claims factually correct and supported? - 5: All claims accurate and verifiable - 3: Mostly accurate, minor errors - 1: Major factual errors or hallucinations

Relevance (1-5): Does it address the question asked? - 5: Directly and completely addresses the question - 3: Partially addresses, some tangents - 1: Off-topic or misses the point

Completeness (1-5): Are all aspects of the question covered? - 5: Comprehensive coverage - 3: Covers main points, misses some details - 1: Significant gaps

Input

Question: {question} Context: {context} Response: {response}

Output Format

Respond with JSON only: { “accuracy”: <1-5>, “relevance”: <1-5>, “completeness”: <1-5>, “reasoning”: “” }

:::