feat: support editable class labels in question classifier#34075
Open
Blackoutta wants to merge 7 commits intolanggenius:mainfrom
Open
feat: support editable class labels in question classifier#34075Blackoutta wants to merge 7 commits intolanggenius:mainfrom
Blackoutta wants to merge 7 commits intolanggenius:mainfrom
Conversation
…values to be passed from classifiers to down stream nodes.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-25 09:17:25.959558372 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-25 09:17:13.910537393 +0000
@@ -6409,9 +6409,13 @@
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_list_operator.py:60:16
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:92:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:96:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:100:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:104:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:140:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:148:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:34:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-25 09:18:02.473080703 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-25 09:17:50.949071392 +0000
@@ -6409,9 +6409,13 @@
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_list_operator.py:60:16
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:92:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:96:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:100:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:104:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:140:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:148:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:34:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-25 09:22:26.466529562 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-25 09:22:16.084592296 +0000
@@ -6409,9 +6409,13 @@
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_list_operator.py:60:16
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:92:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:96:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:100:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:104:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:140:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `dify_graph.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:148:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `dify_graph.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:34:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
…on-classifier-custom-label-1
b36a997 to
0c4f737
Compare
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 02:13:50.905924703 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 02:13:40.174836249 +0000
@@ -6527,9 +6527,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 02:17:36.822716278 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 02:17:25.693724238 +0000
@@ -6527,9 +6527,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
@@ -6951,7 +6955,7 @@
ERROR Could not import `MetadataValue` from `services.entities.knowledge_entities.knowledge_entities` [missing-module-attribute]
--> tests/unit_tests/services/dataset_metadata.py:95:5
ERROR Cannot find module `dify_graph.model_runtime.entities.model_entities` [missing-import]
- --> tests/unit_tests/services/dataset_service_test_helpers.py:19:1
+ --> tests/unit_tests/services/dataset_service_test_helpers.py:13:1
ERROR Argument `str` is not assignable to parameter `indexing_technique` with type `Literal['economy', 'high_quality']` in function `services.entities.knowledge_entities.rag_pipeline_entities.KnowledgeConfiguration.__init__` [bad-argument-type]
--> tests/unit_tests/services/dataset_service_test_helpers.py:449:28
ERROR Argument `Literal['']` is not assignable to parameter `plan` with type `CloudPlan` in function `DocumentIndexingTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 06:28:44.182818356 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 06:28:32.434706883 +0000
@@ -6527,9 +6527,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 07:09:20.749358348 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 07:09:10.492122055 +0000
@@ -6527,9 +6527,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-27 02:20:44.667454216 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-27 02:20:33.550402306 +0000
@@ -6507,9 +6507,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-27 06:45:00.455605077 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-27 06:44:49.328315790 +0000
@@ -6507,9 +6507,13 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/nodes/test_loop_node.py:135:32
ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:93:42
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:97:42
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:101:29
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:105:29
+ERROR `dict[str, Any]` is not assignable to TypedDict key `data` with type `BaseNodeData` [bad-typed-dict-key]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:141:42
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `graphon.nodes.question_classifier.question_classifier_node.QuestionClassifierNode.__init__` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/nodes/test_question_classifier_node.py:149:29
ERROR Argument `dict[str, dict[str, Any] | str]` is not assignable to parameter `config` with type `NodeConfigDict` in function `graphon.nodes.base.node.Node.__init__` [bad-argument-type]
--> tests/unit_tests/core/workflow/nodes/test_start_node_json_object.py:37:16
ERROR `Literal['{invalid-json-schema']` is not assignable to attribute `json_schema` with type `dict[str, Any] | None` [bad-assignment]
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #33806
Summary
This PR adds editable branch labels to the Question Classifier node while preserving the existing classifier behavior.
Changes included:
labelfield to Question Classifier classesclass_nameas the original descriptive topic/class textclass_labeloutput for downstream nodesCLASS 1when no custom label is setMotivation:
The current Question Classifier only exposes class names/topics and uses fixed branch titles. This change lets users define a human-friendly branch label separately, display it consistently in the workflow UI, and consume it downstream via
class_labelwithout changing the existingclass_namebehavior.Verification performed:
Screenshots
CLASS Ntitles and did not expose a separate label output.class_labelfor downstream use.Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods