Chatbot
In short
A chatbot is a program that converses with people in text or speech, answering questions or helping with tasks, using scripted rules or a language model.
What is a chatbot?
One of the first chatbots was ELIZA, written at MIT in the mid-1960s by Joseph Weizenbaum. It matched keywords and turned the user's sentences back into questions, and people were surprised by how human it seemed. For decades afterwards most chatbots worked the same way: rules, keyword matching and decision trees that led the user through fixed menus.
Modern chatbots such as ChatGPT, Claude and Gemini are built on large language models. Instead of picking a scripted answer, they generate a reply word by word from the whole conversation so far, which lets them handle questions nobody planned for, write and explain code, and keep the context of a long exchange.
Businesses use chatbots for customer support, booking, internal help desks and searching documentation. A useful production chatbot usually combines the language model with a system prompt that sets its role and limits, retrieval of the company's own documents (RAG) so it answers from real facts, and tool calls so it can look up an order or open a ticket.
A common misconception is that a chatbot knows or checks what it says. A language model predicts likely text, so it can state wrong things confidently, an error called hallucination. Grounding answers in trusted documents, showing sources and handing over to a person for important cases make chatbots far more reliable.
Key takeaways
- A chatbot holds a conversation in text or speech.
- ELIZA, from the mid-1960s, was one of the first chatbots.
- Older chatbots follow scripts; modern ones generate replies with an LLM.
- Production chatbots add a system prompt, retrieval (RAG) and tool calls.
- They can hallucinate, so grounding and human handover matter.
Example
import anthropic
client = anthropic.Anthropic()
history = []
while True:
history.append({"role": "user", "content": input("You: ")})
reply = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=500,
system="You are a friendly support assistant for a bookshop.",
messages=history, # the whole conversation, so the bot keeps context
)
text = reply.content[0].text
history.append({"role": "assistant", "content": text})
print("Bot:", text)Readers ask
What is the difference between a chatbot and an AI agent?
A chatbot mainly talks: it answers questions in a conversation. An AI agent works toward a goal on its own, planning steps and using tools such as search, code or APIs. Many modern assistants are both.
Is ChatGPT a chatbot?
Yes. ChatGPT is a chatbot built on OpenAI's GPT language models. It was released in November 2022 and made LLM-based chatbots widely known.
How do chatbots remember the conversation?
Usually the application sends the earlier messages along with each new one, so the model sees the whole exchange. The model itself does not remember between requests, and very long conversations are limited by its context window.
Often compared
See also
- LLMAI & Machine Learning, p. 25An LLM is a machine learning model trained on huge amounts of text that generates language by repeatedly predicting the next most likely piece of text.
- Generative AIAI & Machine Learning, p. 20Generative AI is artificial intelligence that creates new content, such as text, images, code, or audio, based on patterns learned from existing data.
- AI AgentAI & Machine Learning, p. 2An AI agent is a system that uses an LLM to plan and carry out multi-step tasks by deciding which tools to call, observing the results, and acting again.
- System PromptAI & Machine Learning, p. 44A system prompt is the instructions an app gives a language model before the conversation starts, setting its role, rules, tone and what it should know.
- RAGAI & Machine Learning, p. 38RAG is a technique that makes an LLM answer using relevant documents retrieved at question time, so its responses are grounded in current, specific data.
- Natural Language ProcessingAI & Machine Learning, p. 32Natural language processing is the field of AI that teaches computers to read, understand, and generate human language in the form of text or speech.
Spotted a mistake or something missing on this page?Suggest an edit