liveBook · Manning

Chapter 12: Designing LLM-powered systems

What you will learn in chapter 12 of Machine Learning Platform Engineering

The chapter introduces LLMOps as an extension of existing MLOps infrastructure and previews building an observable RAG application before hardening it for production.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces LLMOps as an extension of existing MLOps infrastructure and previews building an observable RAG application before hardening it for production.

Key terms: MLOps, LLMOps, Kubernetes (K8s), CI/CD, document ingestion pipelines, vector databases, nondeterministic outputs, multistep reasoning chains, prompt engineering, safety concerns

12.1 LLMOps: New challenges, familiar principles

LLM applications change how ML systems are built, but still depend on the infrastructure and operational practices established in earlier chapters.

Key terms: LLMs, LLM-powered applications, K8s clusters, monitoring pipelines, CI/CD systems

12.1.1 What makes LLM applications different

This section explains why LLM applications need different testing, token management, observability, prompt practices, and cost controls from traditional ML systems.

Key terms: nondeterministic outputs, semantic correctness, factual accuracy, adherence to guidelines, temperature, Top-K sampling, Top-P, nucleus sampling, next token, token limits

12.1.2 Extending our ML platform for LLMs

This section shows how an existing ML platform can support LLM applications by retaining its operational foundation and adding LLM-specific artifacts, infrastructure, monitoring, and safeguards.

Key terms: containers, Kubernetes, CI/CD, Horizontal Pod Auto-scaler, prompt artifacts, configuration parameters, retrieval components, evaluation artifacts, lineage, MLflow

12.1.3 Essential tools for LLM applications

This section introduces the embedding, retrieval, orchestration, observability, and security tools used to build LLM applications beyond a simple RAG prototype.

Key terms: embeddings, embedding models, semantic search, vector space, FAISS, vector store, document chunks, similarity search, LangChain, chains

12.2 Building DataKrypt’s DakkaBot: A simple RAG architecture

Introduces DataKrypt’s onboarding problem and DakkaBot, a developer assistant intended to help new engineers find answers in company documentation.

Key terms: DataKrypt, DakkaBot, developer assistant, technical guides, API documentation, runbooks

12.2.1 What you’ll build

This subsection previews the end-to-end DakkaBot build and explains why observability and cost tracking matter beyond the first working chatbot.

Key terms: vector database, LLM, embedding model, user-friendly interface, nondeterministic, observability, RAG pipeline, token-based pricing, real-time spending, response quality

12.2.2 Beyond single API calls: Designing for composability

This section explains why complex LLM applications need composable steps and how RAG addresses the limits of single API calls.

Key terms: context window, tokens, reasoning quality degradation, error propagation, cost inefficiency, composable system, multistep systems, focused responsibility, targeted recovery, cache intermediate results

12.2.3 Google’s Gemini LLM and embeddings

This section selects Gemini models for DakkaBot’s embeddings and response generation, then outlines API setup and production safeguards.

Key terms: text-embedding-004, gemini-2.5-flash, embeddings, vector representations, Google AI Studio, API key, model access, rate limits, exponential backoff, throttling

12.2.4 The retrieval component

This section builds DakkaBot’s retrieval component by turning documentation into a persistent FAISS index for semantic search and explaining the choices that affect retrieval quality.

Key terms: GeminiEmbeddings, text-embedding-004, RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, chunking strategy, similarity metrics, cosine similarity, k, similarity thresholds, DirectoryLoader

12.2.5 The augmentation component

The section shows how to turn retrieved document chunks into context for an LLM, while safely reconnecting to the persistent index used to retrieve them.

Key terms: augmentation, document chunks, context assembly, prompt, prebuilt vector index, embedding model, retriever interface, similarity search, dangerous deserialization, FAISS

12.2.6 The generation component

This section shows how DakkaBot configures Gemini and uses a structured prompt to turn retrieved documentation into a grounded answer, then places generation within the complete RAG flow.

Key terms: zero temperature, gemini-2.5-flash, convert_system_message_to_human, prompt template, Context, Question, Answer, hallucination, RAG, semantic retrieval

12.3 Giving DakkaBot a UI

This section turns DakkaBot’s RAG pipeline into a reusable core and a responsive Chainlit chat interface with sources, streaming, validation, and graceful error handling.

Key terms: Chainlit, chat interface, conversation history, DakkaBotCore, separation of concerns, lazy initialization, initialized flag, singleton pattern, asyncio.run(), process_query

12.4 Observability for LLM applications

This section explains why diagnosing poor LLM answers requires tracing information through retrieval, augmentation, and generation rather than relying only on conventional system metrics.

Key terms: traditional observability, CPU, memory, request latency, breakpoints, stack traces, LLM observability, reasoning chain, retrieval, augmentation

12.4.1 Set up Langfuse via Docker

This subsection explains how to run Langfuse locally with Docker and prepare it to observe DakkaBot.

Key terms: Langfuse stack, web interface, database, worker processes, organization, project, open source, tracing, monitoring, Docker deployment

12.4.2 Integrating Langfuse with DakkaBot

This subsection explains how adding a Langfuse callback handler gives DakkaBot’s RAG pipeline automatic observability.

Key terms: Langfuse, callback handler, RAG pipeline, LLM calls, query embeddings, retrieved document metadata, chain execution, error traces, cost tracking

12.4.3 Enhanced observability in DakkaBotCore

This section instruments DakkaBotCore with Langfuse and shows how dashboard metrics and individual traces make its RAG pipeline measurable and debuggable.

Key terms: Langfuse, DakkaBotCore, callback handler, LangChain, traces, custom metadata, query analysis, document retrieval success rates, context utilization patterns, user session information

12.4.4 Beyond traditional metrics

This section explains why LLM applications need quality-aware metrics, multistep traces, and token monitoring alongside traditional infrastructure metrics.

Key terms: accuracy, latency, time-to-first-token, hallucination, user-perceived responsiveness, reasoning trace, span tracking, retrieval, augmentation, generation

12.5 Summary

The summary recaps how RAG separation, LLM-specific validation, observability, and workflow tools shape reliable LLM applications.

Where this is used later

Concepts explained in this chapter

← Chapter 11: Monitoring and explainability Chapter 13: Production LLM system design →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.