Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Chatbot

A chatbot is software that converses in natural language by text or voice, from keyword-matching scripts like ELIZA to LLM chat apps like ChatGPT.

A chatbot is a computer program that holds a conversation with people in natural language, by text or by voice. Joseph Weizenbaum's ELIZA, written at MIT and published in 1966, is usually credited as the first chatbot: its DOCTOR script imitated a psychotherapist by matching keywords and turning the user's statements back into questions, and Weizenbaum was disturbed to see users, including his own secretary, confide in it as if it understood them. Chatbots have since gone through three generations, from rule-based scripts to intent-based bots to large language models (LLMs). OpenAI's ChatGPT, launched on November 30, 2022, made the third generation mainstream, and "chatbot" now usually means a chat interface to an LLM such as ChatGPT, Claude, or Gemini.

How Chatbots Work#

  • Rule-based chatbots: Match the user's words against hand-written patterns and reply from templates. They are predictable and cheap, and they fail on any phrasing their authors did not anticipate.
  • Intent-based chatbots: A natural language understanding (NLU) classifier maps each message to an intent, such as checking a balance, and extracts details like an account or date, then designers' dialog flows decide the reply. Banks, airlines, and telecom companies built customer-service bots this way because every answer could be reviewed in advance.
  • LLM chatbots: Generate each reply one token at a time from the conversation so far. A system prompt sets the bot's role and rules, and the model handles phrasing no one anticipated.

The model behind an LLM chatbot is a transformer trained for dialogue with instruction tuning and reinforcement learning from human feedback (RLHF), and it has no memory between calls. The application stores the conversation and sends all of it, formatted by the model's chat template, with every new message:

from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-135M-Instruct")

# The chatbot stores the conversation and sends all of it with every new turn
messages = [
    {"role": "system", "content": "You are a support assistant for an online store."},
    {"role": "user", "content": "Where is my order?"},
    {"role": "assistant", "content": "Could you share your order number?"},
    {"role": "user", "content": "It's 4417."},
]

# The chat template flattens the history into one prompt for the model to continue
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(prompt)

The printed prompt wraps each turn in <|im_start|> and <|im_end|> markers with its role and ends with an open <|im_start|>assistant line, so the model's next tokens become the reply and "It's 4417" makes sense only because the earlier question is in the same prompt. Every turn makes this prompt longer, so long conversations are trimmed or summarized before they exceed the context window, and prompt caching avoids reprocessing the unchanged history on each turn.

Grounding, Tools, and Images#

A support chatbot that answers from its training data alone will state wrong policies with confidence, so production bots retrieve the relevant documents and account data first with retrieval-augmented generation (RAG), check inputs and drafts with AI guardrails, and hand off to a person when a reply cannot be supported:

Chatbots that call tools through function calling, such as looking up an order, are becoming AI agents, and multimodal chatbots accept photos and screenshots in a turn through vision-language models (VLMs). The Ultralytics LLM interface sends a prompt, an image, or a full message history to any OpenAI-compatible chat model and returns the provider's own response object, so a YOLO26 pipeline can ask a multimodal model to describe a scene only after detection finds a person in it.

Risks#

Hallucinations carry legal weight when a business deploys the bot. In Moffatt v. Air Canada, decided in February 2024, the airline's website chatbot told a grieving passenger that a bereavement fare discount could be claimed after travel, which contradicted the airline's actual policy. British Columbia's Civil Resolution Tribunal rejected Air Canada's argument that the chatbot was responsible for its own statements and ordered the airline to pay the difference. Chatbots also face prompt injection and jailbreaking attempts, and models tuned to please users can drift into AI sycophancy, agreeing with false claims instead of correcting them.

  • Virtual assistant: Software such as Siri or Alexa that carries out requests across apps and devices. A chatbot usually lives in one website, app, or messaging channel and focuses on conversation.
  • AI agent: A system that pursues a goal by choosing and executing actions, often over many steps without a person in the loop. A chatbot becomes an agent once it acts through tools as well as answering.
  • Conversational AI: The broader field of technologies behind chatbots and assistants, including speech recognition, NLU, dialog management, and text-to-speech.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning