Preset

Defines reusable behavior templates for chatbot personality and capabilities.

USAGE

Preset(name, tone, expertise, verbosity, constraints, system_prompt=None)

The Preset class encapsulates pre-configured behavior patterns that can be applied to chatbots to instantly configure their personality, expertise, communication style, and operational constraints. Presets provide a powerful way to create consistent, specialized chatbot behaviors without manual configuration of individual parameters.

Each preset defines a complete behavioral profile including conversational tone, areas of expertise, response verbosity, operational constraints, and optional system prompts. This enables rapid deployment of specialized chatbots for specific use cases like customer support, technical advisory, creative writing, or data analysis.

Presets are designed to be both comprehensive and flexible - they provide sensible defaults while allowing override of individual settings when applied to chatbots. The system prompt can include template variables and conditional logic for dynamic behavior adaptation.

Parameters

name : str

The unique identifier for this preset. This name is used when applying the preset to chatbots via the preset() method. Names should be descriptive and follow snake_case conventions (e.g., “technical_advisor”, “customer_support”).

tone : str

The conversational tone or style the chatbot should adopt. This affects how the chatbot communicates and interacts with users. Examples include: - "professional": Formal, business-appropriate communication - "friendly": Warm, approachable, conversational style - "authoritative": Confident, expert-level communication - "analytical": Logical, data-driven, precise communication - "creative": Imaginative, expressive, artistic communication

expertise : str

The primary areas of knowledge or specialization for this chatbot. This can be a single domain or comma-separated list of expertise areas. Examples include: - "python,ml": Python programming and machine learning - "customer_service": Customer support and service excellence - "data_analysis,statistics": Data analysis and statistical methods - "legal_knowledge": Legal information and procedures - "creative_writing": Creative writing and storytelling

verbosity : str

The level of detail and length in responses. This controls how much information the chatbot provides and how thoroughly it explains concepts. Options include: - "concise": Brief, direct responses focusing on essential information - "detailed": Comprehensive responses with explanations and context - "precise": Accurate, specific responses with exact information - "descriptive": Rich, elaborate responses with vivid details - "thorough": Complete, exhaustive responses covering all aspects

constraints : list[str]

A list of behavioral constraints or guidelines the chatbot should follow. These define what the chatbot should avoid or how it should behave in specific situations. Examples include: - ["no_slang", "professional_only"]: Maintain professional language - ["family_friendly", "no_controversial_topics"]: Safe, appropriate content - ["evidence_based", "cite_sources"]: Factual, well-sourced information - ["no_personal_advice", "disclaimers_required"]: Legal/medical boundaries - ["positive_tone", "solution_focused"]: Constructive, helpful approach

system_prompt : str = None

An optional system prompt template that provides detailed instructions to the underlying language model. This prompt sets the behavioral foundation and can include specific instructions, examples, and formatting guidelines. If not provided, behavior will be inferred from other preset parameters.

Returns

Preset

A new Preset instance with the specified behavioral configuration.

Preset Application

Presets are applied to chatbots using the chainable API:

bot = ChatBot().preset("technical_advisor")

When applied, presets automatically configure multiple aspects of chatbot behavior while allowing individual parameter overrides:

bot = (
    ChatBot()
    .preset("technical_advisor")        # Apply preset
    .temperature(0.3)                   # Override temperature
    .max_tokens(1500)                   # Override token limit
)

Examples


Creating custom presets for specialized domains

Define presets for specific business or technical domains:

import talk_box as tb

# DevOps engineering specialist
devops_preset = tb.Preset(
    name="devops_engineer",
    tone="authoritative",
    expertise="kubernetes,docker,ci_cd,monitoring",
    verbosity="detailed",
    constraints=["best_practices", "security_conscious", "production_ready"],
    system_prompt="You are a senior DevOps engineer with expertise in containerization, "
                 "orchestration, and CI/CD pipelines. Provide practical, production-ready "
                 "solutions with security and scalability considerations."
)

# Marketing content specialist
marketing_preset = tb.Preset(
    name="marketing_specialist",
    tone="persuasive",
    expertise="copywriting,branding,digital_marketing",
    verbosity="descriptive",
    constraints=["brand_appropriate", "target_audience_aware", "conversion_focused"],
    system_prompt="You are a marketing specialist who creates compelling content. "
                 "Focus on audience engagement, brand consistency, and clear calls to action."
)

print(f"DevOps preset: {devops_preset.name}")
print(f"Expertise areas: {devops_preset.expertise}")
print(f"Constraints: {', '.join(devops_preset.constraints)}")

Educational and training presets

Create presets for educational and training scenarios:

# Programming tutor for beginners
tutor_preset = tb.Preset(
    name="programming_tutor",
    tone="encouraging",
    expertise="python,programming_fundamentals,debugging",
    verbosity="thorough",
    constraints=["beginner_friendly", "step_by_step", "encouraging", "no_jargon"],
    system_prompt="You are a patient programming tutor. Break down complex concepts "
                 "into simple steps, provide encouragement, and use analogies to help "
                 "beginners understand programming concepts."
)

# Research assistant for academics
research_preset = tb.Preset(
    name="research_assistant",
    tone="scholarly",
    expertise="academic_research,citation,methodology",
    verbosity="precise",
    constraints=["peer_reviewed_sources", "proper_citations", "methodology_aware"],
    system_prompt="You are an academic research assistant. Provide well-sourced "
                 "information with proper citations, maintain scholarly rigor, and "
                 "suggest appropriate research methodologies."
)

# Language learning coach
language_preset = tb.Preset(
    name="language_coach",
    tone="supportive",
    expertise="language_learning,grammar,pronunciation",
    verbosity="detailed",
    constraints=["culturally_sensitive", "progressive_difficulty", "practice_focused"],
    system_prompt="You are a language learning coach. Provide clear explanations "
                 "of grammar rules, suggest practice exercises, and offer cultural "
                 "context for language usage."
)

Industry-specific service presets

Design presets for specific industry applications:

# Healthcare information assistant
healthcare_preset = tb.Preset(
    name="healthcare_info",
    tone="professional",
    expertise="medical_information,health_education",
    verbosity="thorough",
    constraints=[
        "no_diagnosis",
        "no_treatment_advice",
        "medical_disclaimers",
        "professional_referral"
    ],
    system_prompt="You provide general health information for educational purposes only. "
                 "Always include appropriate medical disclaimers and recommend consulting "
                 "healthcare professionals for personal medical concerns."
)

# Financial planning assistant
finance_preset = tb.Preset(
    name="financial_planner",
    tone="advisory",
    expertise="personal_finance,investment_basics,budgeting",
    verbosity="detailed",
    constraints=[
        "no_specific_investment_advice",
        "risk_awareness",
        "educational_only",
        "regulatory_compliant"
    ],
    system_prompt="You provide general financial education and planning concepts. "
                 "Emphasize the importance of individual circumstances and professional "
                 "financial advice for specific investment decisions."
)

# Real estate advisor
realestate_preset = tb.Preset(
    name="realestate_advisor",
    tone="consultative",
    expertise="real_estate,market_analysis,property_investment",
    verbosity="comprehensive",
    constraints=["market_aware", "location_specific", "risk_transparent"],
    system_prompt="You are a real estate advisor providing market insights and "
                 "property guidance. Consider local market conditions, investment "
                 "risks, and individual financial situations."
)

Creative and content generation presets

Build presets for creative and content creation tasks:

# Storytelling specialist
storyteller_preset = tb.Preset(
    name="storyteller",
    tone="narrative",
    expertise="creative_writing,character_development,plot_structure",
    verbosity="descriptive",
    constraints=["engaging_narrative", "character_consistency", "genre_appropriate"],
    system_prompt="You are a master storyteller. Create engaging narratives with "
                 "well-developed characters, compelling plots, and vivid descriptions "
                 "that immerse readers in the story world."
)

# Technical writer
techwriter_preset = tb.Preset(
    name="technical_writer",
    tone="clear",
    expertise="documentation,technical_communication,user_guides",
    verbosity="precise",
    constraints=["user_focused", "step_by_step", "accuracy_critical", "accessible"],
    system_prompt="You are a technical writer who creates clear, user-friendly "
                 "documentation. Focus on step-by-step instructions, logical "
                 "organization, and accessibility for your target audience."
)

# Social media specialist
social_preset = tb.Preset(
    name="social_media_manager",
    tone="engaging",
    expertise="social_media,content_strategy,audience_engagement",
    verbosity="concise",
    constraints=["platform_appropriate", "brand_voice", "engagement_focused"],
    system_prompt="You create engaging social media content optimized for specific "
                 "platforms. Maintain brand voice while maximizing audience engagement "
                 "and encouraging interaction."
)

Converting presets to configuration dictionaries

Extract preset data for integration with other systems:

# Convert preset to dictionary for storage or API transmission
preset_data = tutor_preset.to_dict()

print("Preset configuration:")
for key, value in preset_data.items():
    if isinstance(value, list):
        print(f"  {key}: {', '.join(value)}")
    else:
        print(f"  {key}: {value}")

# Example output structure:
# {
#     "name": "programming_tutor",
#     "tone": "encouraging",
#     "expertise": "python,programming_fundamentals,debugging",
#     "verbosity": "thorough",
#     "constraints": ["beginner_friendly", "step_by_step", "encouraging", "no_jargon"],
#     "system_prompt": "You are a patient programming tutor..."
# }

Preset validation and quality checks

You can implement validation workflows to ensure preset quality and consistency. This includes checking for required fields, naming conventions, constraint formats, and system prompt completeness.

Design Guidelines

Naming Conventions: Use descriptive snake_case names that clearly indicate the preset’s purpose and domain (e.g., “customer_support”, “technical_advisor”, “creative_writer”).

Tone Selection: Choose tones that match the intended use case and audience expectations. Consider how formal or informal the interaction should be.

Expertise Specification: Be specific about domains while keeping them broad enough for flexibility. Use comma-separated lists for multiple expertise areas.

Constraint Design: Include constraints that prevent inappropriate behavior for the specific use case. Consider legal, ethical, and practical limitations.

System Prompt Quality: Write clear, specific system prompts that provide concrete guidance to the language model. Include examples when helpful.

Flexibility Balance: Design presets to be opinionated enough to be useful while remaining flexible enough for customization through individual parameter overrides.

Integration Notes

  • Serialization: all preset data serializes to JSON via to_dict() for storage and transmission
  • Immutability: presets are dataclasses and should be treated as immutable templates
  • Validation: consider implementing validation logic for preset consistency and completeness
  • Versioning: for production use, consider versioning presets to manage behavioral changes
  • Documentation: maintain clear documentation of available presets and their intended use cases

The Preset class enables rapid deployment of specialized chatbot behaviors, making it easy to create consistent, purpose-built AI assistants for specific domains and use cases.