Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting correct results with Classification (bug in 3+ categories) #4111

Open
4 tasks done
AndyMik90 opened this issue May 6, 2024 · 7 comments
Open
4 tasks done
Assignees
Labels
🐞 bug Something isn't working

Comments

@AndyMik90
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a quesion, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.6

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Create a classification node with 3 classes:
CleanShot 2024-05-06 at 08 26 06

✔️ Expected Behavior

The flow goes into the correct node.

❌ Actual Behavior

The output from the classification is correct, but the flow continues in the wrong direction.

@dosubot dosubot bot added the 🐞 bug Something isn't working label May 6, 2024
Copy link

dosubot bot commented May 6, 2024

It sounds like the issue you're encountering with the classification node not directing the flow correctly in a 3+ category setup might be due to how the classification results are being handled and mapped to the workflow nodes. Here's a more focused approach to troubleshoot and potentially resolve the issue:

  1. Verify and Debug Variable Handling: Ensure that the variables for "Business", "Casual", and "Everyday Talk" are correctly defined, accessible, and their values are accurately populated based on the classification results. Adding logging within the AnswerNode's execution can help inspect if variables are correctly replaced with their intended values.

  2. Review Classification Result Mapping: The issue might also lie in how the classification results are mapped to direct the workflow. Specifically, ensure that the parsing of classification results is accurate and that the mapping logic correctly identifies and directs the flow based on these results. The assumption that the first category in the classification result is the correct one to direct the flow might not always hold true, so reviewing this logic is crucial.

  3. Inspect Code for Handling Classification Results: In the QuestionClassifierNode, there's logic intended to parse and act upon the classification results. If there's a mismatch or error in parsing these results, or if the expected 'categories' field is not correctly handled, the workflow might not proceed as expected. Ensure that the parsing and handling of these results are robust and error-tolerant.

  4. Check Configuration and Execution Logic: Double-check the configuration of your nodes, especially how the AnswerNode is set up to receive inputs and how it's supposed to act based on those inputs. The correct setup is essential for the workflow to proceed as expected.

By focusing on these areas, you should be able to diagnose and correct the issue where the flow is not proceeding to the correct node after classification. This involves a careful review of how variables are managed and how classification results are mapped and used to direct the workflow.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@AndyMik90
Copy link
Author

The issue seems to be with double quotas, as removing them did make the classification go to the correct node.

@natarajan0007
Copy link

@AndyMik90 I am also facing the same issue. Can you explain in brief how you overcome with this?

@AndyMik90
Copy link
Author

@AndyMik90 I am also facing the same issue. Can you explain in brief how you overcome with this?

Check if you are using double quotes or single quotes in your class descriptions, I had "hi" in my class and the " was making the formatting of the class_name output wrong.

@JohnJyong
Copy link
Contributor

optimized by below PR: #4147 @AndyMik90 @natarajan0007

@natarajan0007
Copy link

@AndyMik90 I am also facing the same issue. Can you explain in brief how you overcome with this?

Check if you are using double quotes or single quotes in your class descriptions, I had "hi" in my class and the " was making the formatting of the class_name output wrong.

Just saw your discord messages . I got it . let me try with that approach. @JohnJyong I am not when it will be released.

@natarajan0007
Copy link

natarajan0007 commented May 7, 2024

I updated this code directly on docker still I am facing issue with the classification in the api logs it shows correct classification in the exception line number 81. However on the front end it still going to first class
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants