Replies: 2 comments 1 reply
-
|
To make the Question Classifier node in Dify follow strict rules for chip model classification, use the node’s instruction field to define explicit classification instructions. The node passes your categories and these instructions directly to the LLM in the prompt. There’s no extra logic for partial or negative matches—the LLM relies entirely on your instructions to decide when to match, expand, or leave input unchanged. For your scenario, craft your instruction like this:
Keep your categories distinct and your instructions concise and unambiguous. Use a model known for following instructions well (like GPT-4o), and avoid overloading the prompt with unnecessary context or examples, as this can reduce accuracy and cause the LLM to default to the first category if it gets confused or outputs invalid JSON source source source. If you want to handle errors gracefully (like invalid JSON output), you can set a default value in the workflow definition so the workflow continues instead of failing source. Prompt engineering is key—test and refine your instructions to get the strict behavior you want. Some LLMs may still occasionally overgeneralize, so model choice and clear instructions matter most. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
I have used below prompts,: 你必须把用户的问题分类到以下其中一个类别:
你必须严格遵守以下规则:
###################################################################### 给我介绍一下STM32L003这款芯片 🤖 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
In Dify’s question classifier, how can we make the LLM accurately classify the user’s query based on the chip model mentioned in the input, and how should cases be handled when the model is not among the predefined categories?
Currently, I have defined the following categories in the classifier:
SLM32F1XA001
SLM32F1XM606
SLM32F1XA604
SLM32F1XL002
SLM32F1XL012
SLM32F030
SLM32MC081
(SLM32F103, SLM32M103, SLM32M/F103)
SLM32L003
Other
If the model mentioned in the user’s input does not match any of these defined categories, the classifier should not rewrite or alter the model the user is asking about.
For example:
If the user inputs “STM32L003”, it must not be rewritten as “SLM32L003”.
But if the user inputs “L003”, it can be interpreted as “SLM32L003”.
How should I define the instructions or prompt so that the LLM follows this rule?
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions