fix(api): Resolve error encountered when executing `QuestionClassifierNode`

The `QuestionClassifierNode` class extends `LLMNode`, meaning that, per the Liskov
Substitution Principle, `QuestionClassifierNodeData` **SHOULD** be compatible in contexts
where `LLMNodeData` is expected.

However, the absence of the `structured_output_enabled` attribute violates this principle,
causing `QuestionClassifierNode` to fail during execution.

This commit implements a quick and temporary workaround. A proper resolution
would involve refactoring to decouple `QuestionClassifierNode` from `LLMNode`
to address the underlying design issue.
pull/20829/head
QuantumGhost 12 months ago
parent 0720bc7408
commit 6d7d06f8f7

@ -19,3 +19,12 @@ class QuestionClassifierNodeData(BaseNodeData):
instruction: Optional[str] = None
memory: Optional[MemoryConfig] = None
vision: VisionConfig = Field(default_factory=VisionConfig)
@property
def structured_output_enabled(self) -> bool:
# NOTE(QuantumGhost): Temporary workaround for issue #20725
# (https://github.com/langgenius/dify/issues/20725).
#
# The proper fix would be to make `QuestionClassifierNode` inherit
# from `BaseNode` instead of `LLMNode`.
return False

Loading…
Cancel
Save