liveBook · Manning

Language model

As explained in AI Agents and Applications

A large language model is a neural language model trained on extensive text data to understand and generate language and perform text-based reasoning.

A large language model (LLM) processes natural-language input and generates a response. It can summarize a document, extract information, classify text, answer a question, or generate code. In an application, the model is one component: the application prepares its input and decides what to do with its output. section 1.1 section 1.3

The same model capability supports different application shapes:

  • An engine completes a bounded task, such as summarizing text, and stops. section 1.1
  • A chatbot keeps conversational context across exchanges. section 1.1
  • An agent uses model output to choose tools and carry out multi-step work, adjusting after intermediate results or errors. section 1.1

Make a first model call

A phishing-awareness reminder needs only a short prompt. With an OpenAI client, send a system message describing the assistant and a user message requesting the reminder to chat.completions.create, select gpt-5-nano, then read response.choices[0].message.content. Keep the API key out of the code; expect the wording to vary between runs. section 2.1.2

prompt_input = """Write a concise message to remind 
users to be vigilant about phishing attacks."""
response = client.chat.completions.create(
  model="gpt-5-nano",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": prompt_input}
  ] 
)

print(response)

The minimal call shows how a model name and role-labeled messages fit into a working request. section 2.1.2

For questions about your own documents, do not rely on the model’s pretrained knowledge alone. Retrieval-Augmented Generation (RAG) finds relevant document chunks and adds them to the question before the model answers. This can reduce unsupported answers, but it does not make the model automatically reliable: missing information can still produce plausible-sounding errors. section 1.4.2

Choose a model for the task rather than assuming the largest is best. Compare accuracy, response speed, and per-token cost; also check whether its context window accommodates the intended input. A support chatbot may favor speed and cost, while legal document analysis may prioritize accuracy. section 1.5

How AI Agents and Applications covers it

How deep it goes
Demonstrates a model call and explains its place in application workflows, without detailing neural-model internals.
Examples
Uses a phishing reminder request, a research summarization engine, and a retrieved-document Q&A workflow.
What it assumes
Starts with a minimal API call and introduces application components without assuming prior LLM experience.
What you can do after
Apply it via OpenAI and LangChain to generate task-specific responses, while selecting models and supplying relevant context.
How it connects
Connects language models to prompts, retrieval, vector stores, chatbots, and AI agents.

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 AI Agents and Applications. The section links point to the parts of the book it draws on.