Preset
Defines reusable behavior templates for chatbot personality and capabilities.
USAGE
=None) Preset(name, tone, expertise, verbosity, constraints, system_prompt
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:
= ChatBot().preset("technical_advisor") bot
When applied, presets automatically configure multiple aspects of chatbot behavior while allowing individual parameter overrides:
= (
bot
ChatBot()"technical_advisor") # Apply preset
.preset(0.3) # Override temperature
.temperature(1500) # Override token limit
.max_tokens( )
Examples
Creating custom presets for specialized domains
Define presets for specific business or technical domains:
import talk_box as tb
# DevOps engineering specialist
= tb.Preset(
devops_preset ="devops_engineer",
name="authoritative",
tone="kubernetes,docker,ci_cd,monitoring",
expertise="detailed",
verbosity=["best_practices", "security_conscious", "production_ready"],
constraints="You are a senior DevOps engineer with expertise in containerization, "
system_prompt"orchestration, and CI/CD pipelines. Provide practical, production-ready "
"solutions with security and scalability considerations."
)
# Marketing content specialist
= tb.Preset(
marketing_preset ="marketing_specialist",
name="persuasive",
tone="copywriting,branding,digital_marketing",
expertise="descriptive",
verbosity=["brand_appropriate", "target_audience_aware", "conversion_focused"],
constraints="You are a marketing specialist who creates compelling content. "
system_prompt"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
= tb.Preset(
tutor_preset ="programming_tutor",
name="encouraging",
tone="python,programming_fundamentals,debugging",
expertise="thorough",
verbosity=["beginner_friendly", "step_by_step", "encouraging", "no_jargon"],
constraints="You are a patient programming tutor. Break down complex concepts "
system_prompt"into simple steps, provide encouragement, and use analogies to help "
"beginners understand programming concepts."
)
# Research assistant for academics
= tb.Preset(
research_preset ="research_assistant",
name="scholarly",
tone="academic_research,citation,methodology",
expertise="precise",
verbosity=["peer_reviewed_sources", "proper_citations", "methodology_aware"],
constraints="You are an academic research assistant. Provide well-sourced "
system_prompt"information with proper citations, maintain scholarly rigor, and "
"suggest appropriate research methodologies."
)
# Language learning coach
= tb.Preset(
language_preset ="language_coach",
name="supportive",
tone="language_learning,grammar,pronunciation",
expertise="detailed",
verbosity=["culturally_sensitive", "progressive_difficulty", "practice_focused"],
constraints="You are a language learning coach. Provide clear explanations "
system_prompt"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
= tb.Preset(
healthcare_preset ="healthcare_info",
name="professional",
tone="medical_information,health_education",
expertise="thorough",
verbosity=[
constraints"no_diagnosis",
"no_treatment_advice",
"medical_disclaimers",
"professional_referral"
],="You provide general health information for educational purposes only. "
system_prompt"Always include appropriate medical disclaimers and recommend consulting "
"healthcare professionals for personal medical concerns."
)
# Financial planning assistant
= tb.Preset(
finance_preset ="financial_planner",
name="advisory",
tone="personal_finance,investment_basics,budgeting",
expertise="detailed",
verbosity=[
constraints"no_specific_investment_advice",
"risk_awareness",
"educational_only",
"regulatory_compliant"
],="You provide general financial education and planning concepts. "
system_prompt"Emphasize the importance of individual circumstances and professional "
"financial advice for specific investment decisions."
)
# Real estate advisor
= tb.Preset(
realestate_preset ="realestate_advisor",
name="consultative",
tone="real_estate,market_analysis,property_investment",
expertise="comprehensive",
verbosity=["market_aware", "location_specific", "risk_transparent"],
constraints="You are a real estate advisor providing market insights and "
system_prompt"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
= tb.Preset(
storyteller_preset ="storyteller",
name="narrative",
tone="creative_writing,character_development,plot_structure",
expertise="descriptive",
verbosity=["engaging_narrative", "character_consistency", "genre_appropriate"],
constraints="You are a master storyteller. Create engaging narratives with "
system_prompt"well-developed characters, compelling plots, and vivid descriptions "
"that immerse readers in the story world."
)
# Technical writer
= tb.Preset(
techwriter_preset ="technical_writer",
name="clear",
tone="documentation,technical_communication,user_guides",
expertise="precise",
verbosity=["user_focused", "step_by_step", "accuracy_critical", "accessible"],
constraints="You are a technical writer who creates clear, user-friendly "
system_prompt"documentation. Focus on step-by-step instructions, logical "
"organization, and accessibility for your target audience."
)
# Social media specialist
= tb.Preset(
social_preset ="social_media_manager",
name="engaging",
tone="social_media,content_strategy,audience_engagement",
expertise="concise",
verbosity=["platform_appropriate", "brand_voice", "engagement_focused"],
constraints="You create engaging social media content optimized for specific "
system_prompt"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
= tutor_preset.to_dict()
preset_data
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.