UI はローカライズ済みです。スキルの紹介と説明文書は選択した言語へ AI が自動翻訳し、コード・コマンド・パス・専門用語は原文のままです。原作者の文書が優先されます。
スキルを探す
開発・技術 · SKILL.md

logic-adapters

logic-adapters

Configure ChatterBot logic adapters, response selection, comparison methods, custom adapters, MCP tool adapters, and experimental Ollama/OpenAI LLM adapters.

Independent GitHub snapshot · Automated classification · Original documentation governs

スキルの説明

GitHub

name: logic-adapters description: "Configure ChatterBot logic adapters, response selection, comparison methods, custom adapters, MCP tool adapters, and experimental Ollama/OpenAI LLM adapters." disable-model-invocation: true metadata: disco-role: operating license: BSD 3-Clause

Logic Adapters

Use this sub-skill when a task asks how ChatterBot chooses a response, how to configure built-in logic adapters, how to add a custom adapter, why confidence values behave a certain way, or how experimental Ollama/OpenAI adapters expose deterministic adapters as tools.

Quick route

  1. Read references/logic-api.md for verified adapter signatures, parameters, and response-selection surfaces.
  2. Read references/workflows.md for concrete BestMatch, default response, math/time/unit conversion, specific response, custom adapter, and LLM-tool recipes.
  3. Read references/troubleshooting.md for optional dependencies, missing model, provider/service failures, invalid adapter dicts, and confidence surprises.
  4. Run scripts/logic_adapter_demo.py for deterministic math/time/specific/default/unit adapter smoke checks.

Built-in adapters

AdapterUse forNotes
BestMatchfind learned responses from storagedefault adapter; uses search + response selection
SpecificResponseAdapterexact or matcher-triggered canned responserequires input_text and output_text
MathematicalEvaluationnatural-language or symbolic mathuses mathparse; also exposes calculate as a tool
TimeLogicAdaptercurrent time questionsuses spaCy phrase matching; also exposes current time as a tool
UnitConversionnatural-language unit conversionrequires pint; exposes convert_units as a tool
OllamaLogicAdapterexperimental local/remote Ollama responsesrequires model, client package, and an Ollama service
OpenAILogicAdapterexperimental OpenAI-compatible responsesrequires model, client package, and credentials/base URL

Adapter configuration pattern

Use import paths or config dictionaries:

from chatterbot import ChatBot

bot = ChatBot(
    "Logic Bot",
    logic_adapters=[
        {
            "import_path": "chatterbot.logic.BestMatch",
            "default_response": "I am sorry, but I do not understand.",
            "maximum_similarity_threshold": 0.90,
        },
        {
            "import_path": "chatterbot.logic.SpecificResponseAdapter",
            "input_text": "Help me!",
            "output_text": "Read the support guide.",
        },
    ],
)

If multiple adapters can process a statement, ChatterBot returns the response with the highest confidence, with special handling when multiple adapters agree on the same statement.

Boundaries

  • For ChatBot lifecycle, Statement, taggers, and search classes, use core-chatbot.
  • For training data that powers BestMatch, use training.
  • For SQL/Mongo/Redis storage behavior used by search, use storage-adapters.
  • For Django-specific adapter usage, use django-integration.
保存したスキル