liveBook · Manning

Prompt engineering

As explained in Machine Learning Platform Engineering

Prompt engineering is the deliberate design and refinement of inputs provided to generative models to influence their outputs.

Prompt engineering is the deliberate design and refinement of inputs to a generative model. In a documentation assistant, a prompt combines instructions, retrieved context, and a user question to guide the response. Prompts can also contain structured context such as JSON specifications or API documentation. Because these inputs shape application behavior, treat them as code rather than disposable strings. section 12.1.1 section 13.1

Move a prompt from prototype to production in three steps:

  • Make it manageable: version prompts, test changes, and track how different versions perform. Langfuse can manage prompts outside hardcoded application strings and support A/B testing. section 13.1
  • Evaluate meaning, not exact wording. An LLM may produce multiple valid answers to the same input, so check factual correctness, scope, and policy alignment. section 13.0
  • Trim redundant instructions and formatting, then retest. Fewer tokens reduce cost only if the shorter prompt preserves response quality and safety. section 13.4.4
verbose_prompt = """
You are DakkaBot, DataKrypt's helpful AI assistant designed to help engineers 
and developers find information in our comprehensive documentation. Please 
carefully read through the provided context below, which contains relevant 
information from our knowledge base, and then provide a detailed, accurate, 
and helpful response to the user's question. Make sure to be specific and 
include relevant details that would help the user accomplish their task.

Context: {context}
Question: {query}
Please provide your response:
"""

The verbose documentation-assistant prompt spells out the role, source, task, and response request, but repeats instructions that consume tokens. section 13.4.4

concise_prompt = """
You are DakkaBot. Answer based on this DataKrypt documentation:

{context}

Q: {query}
A:
"""

The shorter version keeps the documentation context and Q:/A: boundary while using fewer tokens; compare its response quality before adopting it. section 13.4.4

Prompt design also affects surrounding system decisions. A short classification prompt can give a low-cost model enough criteria to route simple, moderate, and complex queries. In a retrieval-augmented system, observing the prompt together with retrieved context and generated output helps locate failures across the chain. section 13.4.2 section 12.1.1

How Machine Learning Platform Engineering covers it

How deep it goes
Explains versioned prompt management and token-saving revisions, but does not specify a complete prompt-testing implementation.
Examples
Compares verbose and concise documentation prompts and uses a minimal complexity-classification prompt for model routing.
What it assumes
Builds on ML engineering and MLOps practices while introducing prompt-specific operational challenges.
What you can do after
Apply it via Langfuse to version and compare prompts, then refine token use without sacrificing quality.
How it connects
Connects retrieval-augmented generation, semantic evaluation, safety guardrails, observability, and token-based cost optimization.

Also explained in

Compare how 38 books explain prompt engineering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.