liveBook · Manning

Prompt augmentation

As explained in AI Agents in Action, Second Edition

Prompt augmentation is the addition of retrieved information to an input prompt to provide a model with relevant context.

Prompt augmentation adds information found through retrieval to a prompt, giving an LLM relevant knowledge or memory as context. Retrieval searches external sources; augmentation supplies the results to the model. This lets an agent draw on stores larger than its context window while keeping each call within that window’s limit. section 6.1

In retrieval-augmented generation, augmentation follows a two-phase flow:

  • Ingestion: load documents, split them into chunks, embed them, and store them for search. section 6.1.1
  • Retrieval: search for chunks related to a user query, then add the matches to the prompt as context. section 6.1.1

A grounded answer

For “capital of France,” retrieval finds the matching text “capital of France is Paris.” Adding that text to the prompt gives the LLM context for its answer. section 6.1.1

Figure 6.2 RAG can be broken into two phases: ingestion and retrieval. First, documents are loaded, transformed, embedded, and stored in a searchable datastore. Second, they can be retrieved using query mechanisms as part of context augmentation.

Follow the document path from ingestion and storage to retrieval and prompt context. section 6.1.1

How AI Agents in Action, Second Edition covers it

How deep it goes
Defines augmentation and traces RAG from document indexing through query matching to prompt context.
Examples
Uses a “capital of France” query and a retrieved statement about Paris to illustrate grounded answering.
What it assumes
Defines retrieval and augmentation, and introduces knowledge and memory as external context sources.
What you can do after
Understand how retrieved document chunks become prompt context in a question-answering flow.
How it connects
Connects retrieval-augmented generation with retrieval, knowledge, memory, embeddings, and vector databases.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.