← Back to all products
$29
Chatbot Builder
Python chatbot framework with intent matching, conversation state, response templates, and context memory.
JSONMarkdownPythonLLM
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 11 files
chatbot-builder/
├── LICENSE
├── README.md
├── examples/
│ ├── basic_usage.py
│ └── support_bot.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_project-structure.md
│ ├── 03_usage-examples.md
│ └── 04_license.md
├── index.html
└── src/
└── chatbot_builder.py
📖 Documentation Preview README excerpt
Chatbot Builder
Python chatbot framework with intent matching, conversation state, response templates, and context memory. Zero dependencies.
Part of the AI Toolkit collection by [CodeVault](https://ai-toolkit.codevault.dev).
Features
- Intent matching — Pattern-based and keyword intent detection with confidence scoring
- Conversation state machine — Finite-state conversation flows with transitions and guards
- Response templates — Variable-injected response templates with random variation
- Context memory — Sliding-window context that persists across conversation turns
- Fallback handling — Configurable fallback responses when no intent matches
- Conversation history — Full turn-by-turn log with timestamps
- CLI interface — Interactive terminal chatbot for testing and demos
- JSON config — Define intents, states, and responses in a JSON file
Quick Start
# Run the interactive chatbot demo
python src/chatbot_builder.py
# Run with a custom config
python src/chatbot_builder.py --config examples/support_bot.json
# Run the example script
python examples/basic_usage.py
Project Structure
chatbot-builder/
├── README.md
├── LICENSE
├── src/
│ └── chatbot_builder.py # Core chatbot engine (single file, ~300 lines)
└── examples/
├── basic_usage.py # Programmatic usage example
└── support_bot.json # Sample chatbot configuration
Configuration Reference
Chatbot config is a JSON object with these keys:
| Key | Type | Description |
|---|---|---|
name | string | Bot display name |
greeting | string | Opening message when conversation starts |
fallback_responses | list[str] | Random responses when no intent matches |
intents | list[Intent] | Intent definitions (see below) |
states | dict | State machine transitions (optional) |
Intent Object
| Key | Type | Description |
|---|---|---|
name | string | Unique intent identifier |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
examples/basic_usage.py#!/usr/bin/env python3
"""
Basic usage example for the Chatbot Builder.
Demonstrates:
- Creating intents programmatically
- Running the engine
- Accessing conversation history
"""
import sys
from pathlib import Path
# Allow running from the examples/ directory
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src"))
from chatbot_builder import ChatbotEngine, Intent, ResponseTemplate
def main() -> None:
# Define intents with patterns and response templates
intents = [
Intent(
name="greeting",
patterns=[r"\b(hi|hello|hey)\b"],
keywords=["hi", "hello", "hey"],
responses=[
ResponseTemplate("Hey {user_name}! How can I help?"),
ResponseTemplate("Hello! What can I do for you today?"),
],
),
Intent(
name="status_check",
patterns=[r"\b(status|how are you|how's it going)\b"],
keywords=["status", "how"],
responses=[
ResponseTemplate("All systems operational! What do you need?"),
],
),
Intent(
name="farewell",
patterns=[r"\b(bye|goodbye|see you)\b"],