← Back to all products

Chatbot Builder

$29

Python chatbot framework with intent matching, conversation state, response templates, and context memory.

📁 11 files
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:

KeyTypeDescription
namestringBot display name
greetingstringOpening message when conversation starts
fallback_responseslist[str]Random responses when no intent matches
intentslist[Intent]Intent definitions (see below)
statesdictState machine transitions (optional)

Intent Object

KeyTypeDescription
namestringUnique intent identifier

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/chatbot_builder.py #!/usr/bin/env python3 """ Chatbot Builder — AI Toolkit (DataNest) A self-contained chatbot framework with intent matching, conversation state management, response templates with variable injection, and sliding-window context memory. Zero external dependencies — Python 3.10+ stdlib only. Usage: python chatbot_builder.py # interactive demo python chatbot_builder.py --config bot.json # load config from JSON python chatbot_builder.py --export-sample # dump a sample config """ from __future__ import annotations import argparse import json import logging import os import random import re import sys import time from dataclasses import dataclass, field from enum import Enum, auto from pathlib import Path from typing import Any # --------------------------------------------------------------------------- # Logging — production-grade, not print() # --------------------------------------------------------------------------- logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", ) logger = logging.getLogger("chatbot_builder") # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- DEFAULT_BOT_NAME: str = "AssistBot" MAX_CONTEXT_WINDOW: int = 20 # sliding-window size (turns kept in memory) DEFAULT_CONFIDENCE_THRESHOLD: float = 0.3 KEYWORD_WEIGHT: float = 0.6 # weight for keyword matches vs pattern matches PATTERN_WEIGHT: float = 0.8 # --------------------------------------------------------------------------- # Data classes # --------------------------------------------------------------------------- # ... 365 more lines ...
Buy Now — $29 Back to Products