liveBook · Manning

Retrieval-augmented generation

As explained in Investing for Programmers

Retrieval-augmented generation is a technique that retrieves relevant external information and supplies it to a generative model when producing a response.

Retrieval-augmented generation (RAG) supplies a generative model with relevant external context while it produces an answer. It acts as additional memory for information unavailable during training, including recent events, restricted corporate data, databases, APIs, and web sources. section 9.1.1 section 9.3.2

A practical RAG workflow separates data preparation from question answering:

  • Fetch documents from crawlers, downloaded files, APIs, databases, or public data exchanges. section 9.3.2

Financial research assistant

A research workflow can load earnings-call transcripts and company files, then answer a question about autonomous-driving companies with recent earnings. Context can also encode preferences, such as favoring solutions without expensive LiDAR systems. The resulting answer depends on retrieved documents as well as the model’s general knowledge, so it remains research support rather than a guarantee or investment decision. section 9.3.2

RAG improves access to specialized or newer information, but it does not remove uncertainty. Standalone chatbots may miss smaller companies, lack finance-specific vectorized data, or retain results on a provider’s side. Carefully managed sources, prompts, and validation remain necessary; AI can still lack context and make mistakes. section 8.4.2 section 13.1

How Investing for Programmers covers it

How deep it goes
Explains document loading, chunking, embeddings, similarity retrieval, prompting, and graph execution, while deferring broader data-source coverage.
Examples
Demonstrates company files, earnings transcripts, investor preferences, autonomous-driving research, and a LangGraph retrieve-generate pipeline.
What it assumes
Assumes basic prompting and programming familiarity while teaching document preparation and retrieval through executable examples.
What you can do after
Build it from scratch with LangChain and LangGraph by loading documents, indexing chunks, retrieving context, and generating an answer.
How it connects
Connects prompting, large language models, embeddings, vector databases, APIs, databases, and AI agents.

Also explained in

Compare how 32 books explain retrieval-augmented generation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.