exc.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class LLMNodeError(ValueError):
  2. """Base class for LLM Node errors."""
  3. class VariableNotFoundError(LLMNodeError):
  4. """Raised when a required variable is not found."""
  5. class InvalidContextStructureError(LLMNodeError):
  6. """Raised when the context structure is invalid."""
  7. class InvalidVariableTypeError(LLMNodeError):
  8. """Raised when the variable type is invalid."""
  9. class ModelNotExistError(LLMNodeError):
  10. """Raised when the specified model does not exist."""
  11. class LLMModeRequiredError(LLMNodeError):
  12. """Raised when LLM mode is required but not provided."""
  13. class NoPromptFoundError(LLMNodeError):
  14. """Raised when no prompt is found in the LLM configuration."""
  15. class TemplateTypeNotSupportError(LLMNodeError):
  16. def __init__(self, *, type_name: str):
  17. super().__init__(f"Prompt type {type_name} is not supported.")
  18. class MemoryRolePrefixRequiredError(LLMNodeError):
  19. """Raised when memory role prefix is required for completion model."""
  20. class FileTypeNotSupportError(LLMNodeError):
  21. def __init__(self, *, type_name: str):
  22. super().__init__(f"{type_name} type is not supported by this model")