-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(workflow): introduce specific error handling for LLM nodes
- Define custom exception classes for various LLM node errors. - Replace generic ValueErrors with specific exceptions to improve error handling. - Enhance clarity and maintainability by categorizing errors, aiding debugging and troubleshooting.
- Loading branch information
Showing
2 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class LLMNodeError(ValueError): | ||
"""Base class for LLM Node errors.""" | ||
|
||
|
||
class VariableNotFoundError(LLMNodeError): | ||
"""Raised when a required variable is not found.""" | ||
|
||
|
||
class InvalidContextStructureError(LLMNodeError): | ||
"""Raised when the context structure is invalid.""" | ||
|
||
|
||
class InvalidVariableTypeError(LLMNodeError): | ||
"""Raised when the variable type is invalid.""" | ||
|
||
|
||
class ModelNotExistError(LLMNodeError): | ||
"""Raised when the specified model does not exist.""" | ||
|
||
|
||
class LLMModeRequiredError(LLMNodeError): | ||
"""Raised when LLM mode is required but not provided.""" | ||
|
||
|
||
class NoPromptFoundError(LLMNodeError): | ||
"""Raised when no prompt is found in the LLM configuration.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters