"""
Custom Exceptions
Defines custom exception classes for the slot resolution system.
"""
class SlotResolutionError(Exception):
"""Base exception for all slot resolution errors."""
pass
class ConfigurationError(SlotResolutionError):
"""Raised when there's an error in configuration."""
pass
class ValidationError(SlotResolutionError):
"""Raised when input validation fails."""
pass
class ResolutionError(SlotResolutionError):
"""Raised when entity resolution fails."""
pass
class DisambiguationRequiredError(SlotResolutionError):
"""
Raised when multiple matches are found and user disambiguation is required.
Attributes:
field_name: The field that requires disambiguation
candidates: List of candidate entities
"""
def __init__(self, field_name: str, candidates: list, message: str = None):
self.field_name = field_name
self.candidates = candidates
if message is None:
message = f"Multiple matches found for field '{field_name}'. User disambiguation required."
super().__init__(message)