StudyVisuallyStart studying
Part 01 · LLM basics · Card 1 of 10

LLM

A Large Language Model is a function that takes text in and gives text back. GPT-4o, Claude and Llama are all LLMs.

Last updated

Analogy

A very clever API endpoint with no database. It has read half the internet, but it can't look anything up, and it has never heard of your users table.

Code example

llm.tsTypeScript
import OpenAI from "openai";
const client = new OpenAI();
const res = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Name three JS runtimes." }],
});
console.log(res.choices[0].message.content);

In an agent

The LLM is the brain of every agent. Everything else in this course (tools, memory, retrieval) exists to feed it better text.

Questions people ask

Is an LLM the same thing as an AI agent?

No. An LLM is the model itself: text goes in, text comes out, one call at a time. An agent is your code running that model in a loop with tools, so it can look things up and take actions. The LLM is the brain; the agent is the brain plus hands and a plan.

How do I call an LLM from JavaScript?

Install your provider's official SDK, for example the openai package, and put your API key in an environment variable. Then call client.chat.completions.create with a model name and a messages array. The reply text sits in choices[0].message.content. It is a normal HTTPS request, so it works in any Node backend.