Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

question classifier prompt optimization (#3479)

Jyongfd90d99cd0bb
diff --git a/api/core/workflow/nodes/question_classifier/question_classifier_node.py b/api/core/workflow/nodes/question_classifier/question_classifier_node.py
index 5ad2e1d5935..6449e2c11c7 100644
--- a/api/core/workflow/nodes/question_classifier/question_classifier_node.py
+++ b/api/core/workflow/nodes/question_classifier/question_classifier_node.py
@@ -211,7 +211,7 @@ class QuestionClassifierNode(LLMNode):
model_mode = ModelMode.value_of(node_data.model.mode)
classes = node_data.classes
class_names = [class_.name for class_ in classes]
- class_names_str = ','.join(class_names)
+ class_names_str = ','.join(f'"{name}"' for name in class_names)
instruction = node_data.instruction if node_data.instruction else ''
input_text = query
memory_str = ''
diff --git a/api/core/workflow/nodes/question_classifier/template_prompts.py b/api/core/workflow/nodes/question_classifier/template_prompts.py
index c101ad9b19d..318ad54f92f 100644
--- a/api/core/workflow/nodes/question_classifier/template_prompts.py
+++ b/api/core/workflow/nodes/question_classifier/template_prompts.py
@@ -35,7 +35,7 @@ QUESTION_CLASSIFIER_USER_PROMPT_2 = """
QUESTION_CLASSIFIER_ASSISTANT_PROMPT_2 = """
{"keywords": ["bad service", "slow", "food", "tip", "terrible", "waitresses"],
- "categories": ["Experience""]}```
+ "categories": ["Experience"]}```
"""
QUESTION_CLASSIFIER_USER_PROMPT_3 = """