enums.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from enum import StrEnum
  2. class NodeType(StrEnum):
  3. START = "start"
  4. END = "end"
  5. ANSWER = "answer"
  6. LLM = "llm"
  7. KNOWLEDGE_RETRIEVAL = "knowledge-retrieval"
  8. IF_ELSE = "if-else"
  9. CODE = "code"
  10. TEMPLATE_TRANSFORM = "template-transform"
  11. QUESTION_CLASSIFIER = "question-classifier"
  12. HTTP_REQUEST = "http-request"
  13. TOOL = "tool"
  14. VARIABLE_AGGREGATOR = "variable-aggregator"
  15. LEGACY_VARIABLE_AGGREGATOR = "variable-assigner" # TODO: Merge this into VARIABLE_AGGREGATOR in the database.
  16. LOOP = "loop"
  17. LOOP_START = "loop-start"
  18. ITERATION = "iteration"
  19. ITERATION_START = "iteration-start" # Fake start node for iteration.
  20. PARAMETER_EXTRACTOR = "parameter-extractor"
  21. VARIABLE_ASSIGNER = "assigner"
  22. DOCUMENT_EXTRACTOR = "document-extractor"
  23. LIST_OPERATOR = "list-operator"
  24. AGENT = "agent"
  25. class ErrorStrategy(StrEnum):
  26. FAIL_BRANCH = "fail-branch"
  27. DEFAULT_VALUE = "default-value"
  28. class FailBranchSourceHandle(StrEnum):
  29. FAILED = "fail-branch"
  30. SUCCESS = "success-branch"
  31. CONTINUE_ON_ERROR_NODE_TYPE = [NodeType.LLM, NodeType.CODE, NodeType.TOOL, NodeType.HTTP_REQUEST]
  32. RETRY_ON_ERROR_NODE_TYPE = CONTINUE_ON_ERROR_NODE_TYPE