BuilderTypes

Predefined builder types for autocomplete and type safety when using prompt builders.

USAGE

BuilderTypes()

This class provides constants for all available prompt builder types, enabling IDE autocomplete support and preventing typos when calling the prompt_builder() method. Using these constants instead of string literals improves code maintainability and provides a better developer experience through IDE features like auto-completion and type checking.

The builder types represent different pre-configured prompt engineering templates optimized for specific use cases. Each type includes specialized attention patterns, section structures, and formatting guidelines based on the intended domain.

Attributes

GENERAL :

Basic attention-optimized builder for general-purpose prompts. Provides fundamental prompt engineering structure without domain-specific optimizations. Best for: Custom prompts, exploratory use cases, general AI interactions.

ARCHITECTURAL :

Pre-configured builder for software architecture analysis and documentation. Includes specialized sections for system design, patterns, dependencies, and architectural recommendations. Best for: Code architecture reviews, system design documentation, technical debt analysis.

CODE_REVIEW :

Pre-configured builder for comprehensive code review tasks. Optimized for identifying issues, suggesting improvements, and providing constructive feedback with proper prioritization of concerns. Best for: Pull request reviews, code quality assessment, mentoring feedback.

DEBUGGING :

Pre-configured builder for debugging assistance and troubleshooting. Structured to systematically identify problems, analyze root causes, and provide step-by-step debugging guidance. Best for: Error analysis, troubleshooting guides, debugging workflows.

Examples


Using BuilderTypes constants for type safety

Recommended approach with autocomplete and type checking:

import talk_box as tb

# Type-safe builder selection with IDE support
bot = tb.ChatBot().model("gpt-4-turbo")

# Architectural analysis builder
arch_builder = bot.prompt_builder(tb.BuilderTypes.ARCHITECTURAL)
arch_prompt = arch_builder.focus_on("identifying design patterns")._build()

# Code review builder
review_builder = bot.prompt_builder(tb.BuilderTypes.CODE_REVIEW)
review_prompt = review_builder.avoid_topics(["personal criticism"])._build()

# Debugging builder
debug_builder = bot.prompt_builder(tb.BuilderTypes.DEBUGGING)
debug_prompt = debug_builder.focus_on("systematic problem solving")._build()

Comparing with string literals

While string literals work, constants provide better development experience:

import talk_box as tb

bot = tb.ChatBot().model("gpt-4-turbo")

# Using string literals (works but less maintainable)
builder1 = bot.prompt_builder("architectural")  # No autocomplete, typo-prone

# Using constants (recommended)
builder2 = bot.prompt_builder(tb.BuilderTypes.ARCHITECTURAL)  # IDE support

Dynamic builder type selection

Use constants in conditional logic and configuration:

import talk_box as tb

def create_specialized_bot(task_type: str) -> tb.ChatBot:
    bot = tb.ChatBot().model("gpt-4-turbo")

    if task_type == "architecture":
        builder_type = tb.BuilderTypes.ARCHITECTURAL
    elif task_type == "review":
        builder_type = tb.BuilderTypes.CODE_REVIEW
    elif task_type == "debug":
        builder_type = tb.BuilderTypes.DEBUGGING
    else:
        builder_type = tb.BuilderTypes.GENERAL

    prompt = bot.prompt_builder(builder_type)._build()
    return bot.system_prompt(prompt)

# Usage
arch_bot = create_specialized_bot("architecture")
review_bot = create_specialized_bot("review")

Integration with configuration systems

Use constants in configuration files and team standards:

import talk_box as tb

# Team configuration using constants
TEAM_BOT_CONFIGS = {
    "code_reviewer": {
        "model": "gpt-4-turbo",
        "builder_type": tb.BuilderTypes.CODE_REVIEW,
        "temperature": 0.3
    },
    "architect": {
        "model": "gpt-4-turbo",
        "builder_type": tb.BuilderTypes.ARCHITECTURAL,
        "temperature": 0.2
    }
}

def create_team_bot(role: str) -> tb.ChatBot:
    config = TEAM_BOT_CONFIGS[role]
    bot = tb.ChatBot().model(config["model"]).temperature(config["temperature"])
    prompt = bot.prompt_builder(config["builder_type"])._build()
    return bot.system_prompt(prompt)

Builder Type Selection Guide

GENERAL: choose when you need maximum flexibility and plan to define custom prompt structure. Provides basic attention optimization without domain constraints.

ARCHITECTURAL: select for system design tasks, architecture documentation, technical debt analysis, and design pattern identification.

CODE_REVIEW: use for pull request reviews, code quality assessment, mentoring feedback, and development best practices guidance.

DEBUGGING: apply for error analysis, troubleshooting workflows, systematic problem solving, and debugging assistance.

Notes

IDE Support: using these constants enables autocomplete, type checking, and refactoring support in most modern IDEs and editors.

Maintainability: constants prevent typos and make code more maintainable when builder types change or new types are added.

Consistency: using constants ensures consistent builder type names across different parts of your application.

Extensibility: new builder types can be added to this class while maintaining backward compatibility.

See Also

ChatBot.prompt_builder : Create attention-optimized prompt builders PromptBuilder : The prompt builder class for structured prompt creation