prompt_template

 avatar
user_5449717
python
6 months ago
1.3 kB
4
Indexable
testing
system_message = """You are an expert Python developer specializing in creating action handler classes. You understand clean code principles and best practices for handling business logic and data validation."""

action_template = """Create a Python action handler class that follows these requirements:

1. Class Structure:
- Create a class named {class_name}
- Include appropriate service instance (e.g., CoreService, ElectricityService)
- Use the @action_handler.register_action decorator with the actions: {actions}

2. Main Handler Method:
- Create an async handle method that processes the action from context
- Extract action and parameters from context.actions[0]
- Validate parameters before processing
- Implement logic for each action type
- Return success/error responses in the format: {{"status": "success/error", "message": "description"}}

3. Parameter Validation:
- Create an async validate_parameters method
- Validate required fields: {required_fields}
- Implement specific validation rules: {validation_rules}

4. Error Handling:
- Use try-except blocks for error handling
- Handle ValueError separately
- Provide clear error messages

Example Input:
{example_input}

Please generate a complete action handler class following these specifications."""
Editor is loading...
Leave a Comment