Library / SDK
gunthercox/ChatterBot avatar
gunthercox/ChatterBot

ChatterBot: a Python dialog engine that learns from what it is told

ChatterBot is a machine learning, conversational dialog engine for creating chat bots

14,520 stars4,418 forksPythonBSD-3-Clause

At a glance

What is it?
ChatterBot builds a chatbot from conversation pairs rather than from a language model. It is easy to start and easy to outgrow, and the documentation is thinner than the PyPI page suggests.
Who is it for?
Adopt ChatterBot when you need a small, offline, dependency-light bot over a fixed set of exchanges: an FAQ responder, a teaching exercise, or a prototype where a stored conversation log is the point. Do not adopt it when you need open-domain understanding, entity extraction, or a dialog state machine; the matching approach returns a plausible stored reply rather than an answer, and the README does not document any slot-filling or intent layer.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 35 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What problem ChatterBot solves, and for whom

ChatterBot is a Python library for producing replies from a collection of known conversations. The README describes an untrained instance as starting "off with no knowledge of how to communicate": every statement a user enters is saved together with the statement it was responding to. There is no pretrained model in the box. The knowledge arrives as text you supply, either as a corpus or as a list of pairs, and the library's job is to find the closest match to a new input and return the response most frequently associated with that match.

That places it in a different category from an assistant that answers questions. It is closer to a retrieval system with a conversational surface. The people who benefit are developers who already have a transcript, a FAQ, or a scripted exchange and want it reachable through a chat interface without training a model or paying for inference. The README also states that the design is language independent, so a bot can be trained to speak any language for which corpus data exists; the corpus module ships training data for over a dozen languages according to the same document.

How the matching engine actually decides on a reply

The mechanism is search plus frequency, not generation. When a statement arrives, the library looks for the closest matching known statement, then returns the most likely response to that statement based on how frequently each response is issued. The README puts it plainly: the program "selects the closest matching response by searching for the closest matching known statement that matches the input."

Two consequences follow. First, the bot can only say things it has seen or been given; a novel input maps onto the nearest stored statement, which may be a poor fit. Second, the system improves with use in a narrow sense. The README notes that as more input arrives, the number of responses it can reply to and the accuracy of each response increase. That is learning by accumulation of pairs, not by adjusting weights.

The repository layout shows the pieces: chatterbot/logic holds the response-selection logic, chatterbot/storage holds storage adapters, and chatterbot/ext contains a SQLAlchemy app and a django_chatterbot app with migrations. Storage is therefore a first-class concern rather than an afterthought, and the examples directory includes memory_sql_example.py, terminal_mongo_example.py, and a Django example, which indicates several backends are supported. The README does not describe the ranking algorithm beyond "closest matching", so if you need to know which similarity measure is in play you will have to read the source.

Installing ChatterBot and getting a first reply

The README gives one install command, from PyPI, and the package metadata requires Python 3.10 or newer and below 3.15.

bash
pip install chatterbot

The README's basic usage example creates a bot, attaches a corpus trainer, trains on the English corpus, and asks a question. The trainer is a separate import, because training and responding are separate steps.

python
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

chatbot = ChatBot('Ron Obvious')
trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train("chatterbot.corpus.english")
print(chatbot.get_response("Hello, how are you today?"))

After the first run you should see a reply drawn from the corpus, not a generated sentence. The README notes that the corpus module covers over a dozen languages, so the same call works with a different corpus path such as chatterbot.corpus.english.greetings, and the training data itself lives in the separate chatterbot-corpus package, where the README invites pull requests.

If you would rather not depend on the shipped corpus, the examples directory contains training_example_list_data.py, which shows training from a list you provide. That is the path most production users end up taking, because a generic English corpus produces generic English replies.

Where ChatterBot stops being the right tool

The honest limitation is that a nearest-match engine cannot tell you it does not know. Feed it a question about your refund policy when no refund exchange was ever stored, and it will return the closest stored statement's most frequent response, which may read as confident nonsense. The README does not document a confidence threshold or an abstain path, though the examples directory includes default_response_example.py, which suggests a fallback response is configured rather than inferred.

There is also a state problem. A dialog engine that stores statement pairs has no built-in notion of a multi-turn task: no slots, no required fields, no ordering. If your bot must collect an order number before answering, the matching layer will not enforce that, and you will be building the state machine around it. The README says nothing about intent classification or entity extraction, and those are not features you can assume.

Finally, the package metadata lists Development Status as "Beta". Treat the API surface as something that can move between minor releases, and check the release notes before upgrading rather than assuming compatibility.

ChatterBot compared with Rasa and with an LLM API

The frequent comparison is ChatterBot versus Rasa, and the difference is architectural. Rasa is built around intent classification and entity extraction with an explicit dialog policy, which means you define intents, annotate training examples, and describe conversation flows. ChatterBot has none of that layer: you supply conversation pairs and it matches. If your problem is "recognise that the user wants to reschedule and extract the new date", Rasa's model fits the shape of the problem and ChatterBot's does not.

The other comparison is against a hosted model. An LLM API generates text it has never stored and handles phrasing variation that a matcher will miss, at the cost of a network dependency and per-call billing. ChatterBot runs locally with no inference cost, and its replies are auditable in the sense that you can point at the stored pair that produced them. That auditability is the strongest argument for it, and it only holds if you curate the pairs.

The repository also includes examples/openai_example.py and examples/ollama_example.py, so the project itself demonstrates wiring a generative backend alongside the matching logic. That is a reasonable middle path: keep the stored pairs for the exchanges that must be exact, and delegate the rest.

Maintenance, releases and the BSD-3-Clause licence

The repository is not archived. The last push was on 2026-08-25, and the most recent release, 1.2.15, was tagged the same day, following 1.2.14 on 2026-06-19 and 1.2.13 on 2026-03-24. Releases are landing roughly quarterly, with the newest one days before the last commit, so the project is being cut and published rather than merely committed to.

Upgrade cost is mostly the storage schema. The package ships chatterbot.ext.django_chatterbot.migrations, which means Django users have migration files to apply, and a schema change between versions is the kind of thing that shows up as a failed query rather than a clean error. Read the release notes at the changelog URL in pyproject.toml before bumping the pin. Python support is bounded at >=3.10 and <3.15, so a jump to a newer interpreter will require a version bump from the project, not a local workaround.

The licence is BSD-3-Clause, a permissive licence that allows use in closed products and requires retaining the copyright notice and licence text. That is a summary of the identifier, not legal advice; if you are redistributing the library inside a commercial product, have counsel read the actual LICENSE file in the repository root.

Editorial conclusion

Adopt ChatterBot when you need a small, offline, dependency-light bot over a fixed set of exchanges: an FAQ responder, a teaching exercise, or a prototype where a stored conversation log is the point. Do not adopt it when you need open-domain understanding, entity extraction, or a dialog state machine; the matching approach returns a plausible stored reply rather than an answer, and the README does not document any slot-filling or intent layer. Before committing, verify three things: that the corpus trains cleanly on your Python version, that your chosen storage adapter survives a restart with the data intact, and that you are comfortable with the storage schema, because a response is only as good as the pairs you fed it.

Frequently asked questions

What is ChatterBot?

It is a machine-learning based conversational dialog engine written in Python that generates responses from collections of known conversations. An untrained instance knows nothing, and it learns from the statements and responses it is given.

How do I install ChatterBot in Python?

The README gives a single command, pip install chatterbot, which pulls the package from PyPI. The package metadata requires Python 3.10 or newer and below 3.15.

How do I use ChatterBot in Python?

Create a ChatBot instance, attach a ChatterBotCorpusTrainer, train it on a corpus such as chatterbot.corpus.english, then call chatbot.get_response with an input statement. Training and responding are separate steps, and the trainer is imported from chatterbot.trainers.

What is ChatterBot in Python?

It is the Python implementation of the ChatterBot dialog engine, distributed on PyPI and installable with pip. The README describes it as language independent, so it can be trained to speak any language for which corpus data exists.

Is ChatterBot an alternative to Rasa?

It occupies different ground. ChatterBot matches new input against stored statements and returns the most frequent associated response, while Rasa is built around intent classification, entity extraction and an explicit dialog policy. If you need to extract a value from a sentence, ChatterBot's matching layer does not do that.

What can I use instead of ChatterBot?

The repository itself includes examples/openai_example.py and examples/ollama_example.py, which wire a generative model alongside the matching logic. A hosted or local model handles phrasing variation that a nearest-match engine misses, at the cost of a model dependency.

Official sources

  1. gunthercox/ChatterBot on GitHub
  2. License: BSD-3-Clause
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/gunthercox-chatterbot.svg)](https://hysenlabs.com/projects/gunthercox-chatterbot)