From b318394982c8a7c67826eab2f5b4fd5c0dfdbf5c Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Mon, 9 Jun 2025 21:13:14 +0800 Subject: [PATCH] feat(api): add `structured_output_enabled` to `KnowledgeRetrievalNodeData` Avoid pontential Liskov Substitution Principle violation. --- api/core/workflow/nodes/knowledge_retrieval/entities.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/core/workflow/nodes/knowledge_retrieval/entities.py b/api/core/workflow/nodes/knowledge_retrieval/entities.py index d2e5a15545..19bdee4fe2 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/entities.py +++ b/api/core/workflow/nodes/knowledge_retrieval/entities.py @@ -132,3 +132,12 @@ class KnowledgeRetrievalNodeData(BaseNodeData): metadata_model_config: Optional[ModelConfig] = None metadata_filtering_conditions: Optional[MetadataFilteringCondition] = 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 `KnowledgeRetrievalNode` inherit + # from `BaseNode` instead of `LLMNode`. + return False