langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
51.85k stars 7.52k forks source link

[bug] Question Classifier working wrong in the workflow process #3410

Closed jiacheo closed 7 months ago

jiacheo commented 7 months ago

Self Checks

Dify version

0.6.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. create a workflow from template by the name of 'Customer Review Analysis Workflow'
  2. Run it in the studio
  3. input a nagetive review text such like :'Bad experience of refunding'
  4. then submit the text and see the workflow processing diagram
  5. Check the trace, can find that the LLM classfier the question as a 'Negative review' but the next step it goes to the 'Class1' (Positive review) brunch, this act a wrong brunch choosen.
image

✔️ Expected Behavior

Understand and go to the right brunch in the question classifier.

❌ Actual Behavior

No response

dosubot[bot] commented 7 months ago

Hey there, @jiacheo! 👋 I'm Dosu, your friendly neighborhood bot here to lend a hand with bugs, answer your questions, and guide you on your way to becoming a stellar contributor to Dify. While we're waiting for a human maintainer to chime in, I'm here to help as best as I can! Just wanted to let you know that I'm currently looking into your issue regarding the Question Classifier in your workflow. Hang tight, and I'll get back to you with a full answer shortly!

crazywoola commented 7 months ago

Please attach the exported yml file as well. @jiacheo

jiacheo commented 7 months ago

@crazywoola The DSL file here: Customer Review Analysis Workflow .yml.txt

crazywoola commented 7 months ago

@JohnJyong Please take a look at this.

Avuja commented 7 months ago

What's the Classification tracing look like? After the most recent update my classification seems to have some hard coded customer service related prompts that I can't get rid of, wondering if maybe they're also being applied and messing things up (I think that's what's happening to my deployment, also having problems now)

I don't think these prompts were there before and not sure where they're coming from but they're always in my question classification tracing even in a workflow unrelated to customers - maybe unrelated and I'm just missing something figured would chime in though, here's what keeps getting added to my actual context:

  "role": "user",
  "text": "\n    { \"input_text\": [\"I recently had a great experience with your company. The service was prompt and the staff was very friendly.\"],\n    \"categories\": [\"Customer Service, Satisfaction, Sales, Product\"],\n    \"classification_instructions\": [\"classify the text based on the feedback provided by customer\"]}```JSON\n",
  "files": []
},
{
  "role": "assistant",
  "text": "\n    {\"keywords\": [\"recently\", \"great experience\", \"company\", \"service\", \"prompt\", \"staff\", \"friendly\"],\n    \"categories\": [\"Customer Service\"]}```\n",
  "files": []
},
{
  "role": "user",
  "text": "\n    {\"input_text\": [\"bad service, slow to bring the food\"],\n    \"categories\": [\"Food Quality, Experience, Price\" ], \n    \"classification_instructions\": []}```JSON\n",
  "files": []
},
{
  "role": "assistant",
  "text": "\n    {\"keywords\": [\"bad service\", \"slow\", \"food\", \"tip\", \"terrible\", \"waitresses\"],\n    \"categories\": [\"Experience\"\"]}```\n",
  "files": []
},
YidaHu commented 7 months ago

@crazywoola The DSL file here: Customer Review Analysis Workflow .yml.txt

@jiacheo I noticed that you have an extra blank space in this category, resulting in conditions that do not match.

image

@crazywoola Of course, it is true that LLM output may also have problems, I have submitted PR #3449

jiacheo commented 7 months ago

@crazywoola The DSL file here: Customer Review Analysis Workflow .yml.txt

@jiacheo I noticed that you have an extra blank space in this category, resulting in conditions that do not match.

image

@crazywoola Of course, it is true that LLM output may also have problems, I have submitted PR #3449

@YidaHu Wow! You must have golden eyes! After delete the extra space, it works fine now. (should we have a trim() before we choose brunches?)

YidaHu commented 7 months ago

@crazywoola The DSL file here: Customer Review Analysis Workflow .yml.txt

@jiacheo I noticed that you have an extra blank space in this category, resulting in conditions that do not match.

image

@crazywoola Of course, it is true that LLM output may also have problems, I have submitted PR #3449

@YidaHu Wow! You must have golden eyes! After delete the extra space, it works fine now. (should we have a trim() before we choose brunches?)

@jiacheo I don't think trim() is necessary. The service should not modify user input. Of course that's what I think.

jiacheo commented 7 months ago

I would close this issue now.

Btw, I found this template from the cloud version( cloud.dify.ai ) also have the same 'blank space' behind the 'Negetive review' brunch, maybe you can notify the cloud platform team to update this template. @YidaHu

YidaHu commented 7 months ago

I would close this issue now.

Btw, I found this template from the cloud version( cloud.dify.ai ) also have the same 'blank space' behind the 'Negetive review' brunch, maybe you can notify the cloud platform team to update this template. @YidaHu

@crazywoola @JohnJyong When language='en-US', there is an error in the template "Customer Review Analysis Workflow", Question Classifier Node -> Category -> Negative review (space here). This results in an inability to properly execute the workflow.

I found a pull app template from https://tmpl.dify.ai' and I can't fix it.

image