liveBook · Manning

Prompt

As explained in Building Reliable AI Systems

Input instructions or context supplied to an AI model to guide its response.

A prompt is the instructions and context supplied to an LLM to guide its response. In an application, vague wording can leave important choices to the model: a legal assistant told only to “answer legal questions accurately” gave contradictory advice to users asking identical questions. A production prompt should specify the behavior the application needs, not merely name the task. section 2.6.2 section 10.5.2

Specificity changes the response

“The ocean is” gives the model little direction and may produce a long continuation. “Finish this thought in one sentence: The ocean is” supplies both a task and a length constraint. The result is more targeted, though a more predictable format does not by itself establish accuracy. section 2.6.2

For an application prompt, specify the parts that would otherwise be ambiguous:

  • Instructions: state the action, such as summarizing an order status or recommending products. section 2.6.2
  • Context and input: identify the domain and include the customer’s query so the response addresses the particular request. section 2.6.2
  • Response expectations: set qualities such as tone and length; for production use, also define behavior for requests beyond the assistant’s capabilities. section 2.6.2 section 10.5.2

A prompt can also constrain how supplied evidence is used. In a health-care policy assistant, retrieved policy chunks are formatted as context, and the prompt instructs the LLM to answer only from that context. The application returns source information with the answer so a user can check which policies informed it. Retrieval, prompt wording, and a low temperature setting work together to encourage grounded answers; none makes an answer automatically correct. section 4.5.4

At scale, treat prompts as quality contracts: define the expected tone, specificity, length, and handling of unsupported requests, then check whether those expectations hold across varied inputs. Keep versions so a change in behavior can be associated with a particular prompt rather than an untracked edit. section 10.5.2

PROMPT_VERSIONS = {                                        #1
    "customer_support_v1.0": "You are a helpful customer support agent...",
    "customer_support_v1.1": "You are a helpful customer support agent.
        Always be empathetic...",
    "customer_support_v2.0": "You are a customer support agent for AcmeSoft..."
}

def get_prompt(version="latest"):                          #2
    if version == "latest":
        version = max(PROMPT_VERSIONS.keys())
    return PROMPT_VERSIONS[version]

A Python dictionary stores named prompt versions, and a retrieval function selects one. This makes a prompt revision an identifiable application change. section 10.5.2

How Building Reliable AI Systems covers it

How deep it goes
Explains prompt components through contrasting examples and extends them to production expectations and version selection, without detailing model internals.
Examples
Contrasts two ocean prompts, describes a legal assistant’s contradictory advice, and constructs context-bound health-care policy answers.
What it assumes
Starts with a simple completion prompt, while the versioning example assumes readers can follow a short Python function.
What you can do after
Build it from scratch by specifying instructions, context, input, and response expectations; version prompts when consistent production behavior matters.
How it connects
Connects prompts to structured output, prompt engineering, retrieval-augmented generation, and source tracking.

Also explained in

Compare how 50 books explain prompt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Reliable AI Systems. The section links point to the parts of the book it draws on.