Skip to content

[CONFIG-1] Create Domain-Specific Configuration Templates #25

@MVPandey

Description

@MVPandey

🔧 DOMAIN CONFIGURATION TEMPLATES

Priority: MEDIUM - Domain Enablement

Problem

Each new domain requires manual configuration setup. No standardized templates for different conversation types.

Solution

Create pre-built configuration templates for common domains to simplify adoption and ensure best practices.

Configuration Template System

# app/config/domain_templates.py
class DomainTemplate:
    @staticmethod
    def get_template(domain_name: str) -> Dict[str, Any]:
        """Get complete configuration template for domain"""
        templates = {
            "technical_support": {
                "mcts_config": {
                    "exploration_constant": 1.0,
                    "branching_factor": 2,
                    "simulation_depth": 4,
                    "confidence_threshold": 0.8
                },
                "prompts": {
                    "scoring": "Evaluate this technical support interaction for accuracy, clarity, helpfulness, resolution potential, and technical depth...",
                    "generation": "Generate a helpful technical response that addresses the user's specific issue...",
                    "simulation": "Continue this technical support conversation with focus on problem resolution..."
                },
                "scoring_metrics": ["accuracy", "clarity", "helpfulness", "resolution_potential", "technical_depth"],
                "resource_limits": {
                    "max_api_calls": 30,
                    "max_tokens": 8000,
                    "timeout_seconds": 180
                }
            },
            "sales": {
                "mcts_config": {
                    "exploration_constant": 1.8,
                    "branching_factor": 4,
                    "simulation_depth": 2,
                    "confidence_threshold": 0.6
                },
                "prompts": {
                    "scoring": "Evaluate this sales conversation for persuasiveness, rapport building, objection handling, and closing potential...",
                    "generation": "Generate a persuasive sales response that builds rapport and advances the conversation...",
                    "simulation": "Continue this sales conversation with focus on value proposition and closing..."
                },
                "scoring_metrics": ["persuasiveness", "rapport", "objection_handling", "closing_potential", "value_demonstration"],
                "resource_limits": {
                    "max_api_calls": 40,
                    "max_tokens": 10000,
                    "timeout_seconds": 240
                }
            }
        }
        return templates.get(domain_name, templates["general"])

Template Management API

# app/api/config.py
@app.get("/api/config/domains")
async def list_domain_templates():
    """List all available domain templates"""
    return {
        "domains": [
            {
                "name": "technical_support",
                "description": "Customer technical support interactions",
                "use_cases": ["helpdesk", "troubleshooting", "product support"]
            },
            {
                "name": "sales", 
                "description": "Sales and business development conversations",
                "use_cases": ["lead qualification", "demos", "negotiations"]
            },
            {
                "name": "education",
                "description": "Educational and training conversations", 
                "use_cases": ["tutoring", "training", "knowledge transfer"]
            }
        ]
    }

@app.get("/api/config/domains/{domain_name}")
async def get_domain_template(domain_name: str):
    """Get configuration template for specific domain"""
    try:
        template = DomainTemplate.get_template(domain_name)
        return {
            "domain": domain_name,
            "template": template,
            "customization_guide": f"docs/domains/{domain_name}.md"
        }
    except ValueError:
        raise HTTPException(status_code=404, detail="Domain template not found")

@app.post("/api/config/domains/{domain_name}/customize")
async def customize_domain_config(domain_name: str, customizations: Dict[str, Any]):
    """Create customized domain configuration"""
    base_template = DomainTemplate.get_template(domain_name)
    
    # Apply customizations
    customized_config = deep_merge(base_template, customizations)
    
    # Validate configuration
    await validate_domain_config(customized_config)
    
    return {
        "domain": domain_name,
        "config": customized_config,
        "validation": "passed"
    }

Domain Setup Wizard

# app/utils/domain_setup.py
class DomainSetupWizard:
    async def setup_domain(
        self,
        domain_name: str,
        use_case: str,
        performance_priority: str = "balanced",  # "speed", "quality", "cost"
        custom_metrics: List[str] = None
    ) -> DomainConfiguration:
        """
        Interactive domain setup with intelligent defaults
        """
        # Start with base template
        base_config = DomainTemplate.get_template(domain_name)
        
        # Adjust based on priorities
        if performance_priority == "speed":
            base_config["mcts_config"]["branching_factor"] = max(1, base_config["mcts_config"]["branching_factor"] - 1)
            base_config["resource_limits"]["timeout_seconds"] *= 0.7
        elif performance_priority == "quality":
            base_config["mcts_config"]["branching_factor"] += 1
            base_config["mcts_config"]["simulation_depth"] += 1
        elif performance_priority == "cost":
            base_config["resource_limits"]["max_api_calls"] *= 0.7
            base_config["mcts_config"]["branching_factor"] = max(2, base_config["mcts_config"]["branching_factor"] - 1)
        
        # Add custom metrics if provided
        if custom_metrics:
            base_config["scoring_metrics"].extend(custom_metrics)
        
        # Generate custom prompts based on use case
        base_config["prompts"] = await self._generate_custom_prompts(domain_name, use_case)
        
        return DomainConfiguration(**base_config)

Implementation Steps

  • Create domain template definitions
  • Build template management API
  • Add domain setup wizard
  • Create configuration validation
  • Add template customization tools
  • Create domain documentation

Template Features

  • Pre-optimized parameters for each domain
  • Validated prompt templates with proven effectiveness
  • Resource limit recommendations based on domain characteristics
  • Customization guidance for specific use cases
  • Performance benchmarks for each template

Acceptance Criteria

  • Templates for 5+ common domains
  • Template management API
  • Configuration validation system
  • Customization wizard
  • Comprehensive documentation
  • Performance benchmarks per template

Effort: Medium (3-4 days)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions