liveBook · Manning

Language model

As explained in Just Use Postgres!

An LLM is a large language model trained to understand and generate natural-language text.

A large language model (LLM) is trained on vast amounts of text to understand natural-language prompts and generate coherent text. It can answer questions, converse, and perform tasks by interpreting user intent. section 8.0

Use an LLM to:

  • Answer general-purpose questions and power conversational applications such as a movie chatbot. section 8.1.1
  • Use current information or complete tasks by calling external tools, services, protocols, and APIs. section 8.1.1
  • Generate answers from context retrieved by vector similarity search in a retrieval-augmented generation (RAG) workflow. section 8.1 section 8.6.2

Movie question answering

Given the prompt “What are the other two movies produced by the studio that made Shrek?”, an LLM can identify DreamWorks Animation and respond with “Madagascar” and “Kung Fu Panda.” A RAG application can instead pass movie data retrieved from Postgres into the prompt before generating its answer. section 8.1.1 section 8.6.2

A practical integration connects an LLM through a provider API or local runtime. A LangChain OllamaLLM interface can invoke TinyLlama with a prompt containing the user question and retrieved context. Because LLMs are stateless, applications must store conversation history separately and pass it into later prompts. section 8.1.1 section 8.6.2

Figure 8.1 The LLM uses various tools to perform tasks following user prompts.
A diagram of a diagram

AI-generated content may be incorrect.

Shows how an LLM can combine user prompts with external tools to perform tasks before producing a response. section 8.1.1

How Just Use Postgres! covers it

How deep it goes
Explains capabilities, tool use, prompt context, and statelessness, but stops short of model internals or mathematical treatment.
Examples
Uses a DreamWorks movie question, a Postgres movie catalog, and a TinyLlama RAG notebook prototype.
What it assumes
Assumes basic application integration knowledge while demonstrating local execution through Python, Jupyter, Ollama, and LangChain.
What you can do after
Builds a prompt-based application that invokes an LLM with user questions and retrieved context.
How it connects
Connects LLMs with natural-language prompts, chatbots, APIs, embeddings, vector similarity search, Postgres, and retrieval-augmented generation.

Also explained in

Compare how 67 books explain language model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.