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

Dify misidentified MARKDOWN file segmentation #14388

Open
5 tasks done
yu154 opened this issue Feb 26, 2025 · 2 comments
Open
5 tasks done

Dify misidentified MARKDOWN file segmentation #14388

yu154 opened this issue Feb 26, 2025 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@yu154
Copy link

yu154 commented Feb 26, 2025

Self Checks

  • This is only for bug report, if you would like to ask a question, 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

Parent segmentation:### content1
Subclass segmentation:#### content2

✔️ Expected Behavior

content1 (Parent )
content2(Subclass)

❌ Actual Behavior

content1 (Parent )
#content2(Parent )

@dosubot dosubot bot added the 🐞 bug Something isn't working label Feb 26, 2025
Copy link

dosubot bot commented Feb 26, 2025

Hello, @yu154! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to resolve the issue you're experiencing.

The issue with Dify misidentifying the segmentation of a MARKDOWN file likely stems from an incorrect JSON payload structure. Specifically, the 'parent_mode' and 'subchunk_segmentation' parameters might be misplaced. They should be placed under the 'rules' object, not directly under 'process_rule'. Here's the correct structure:

{
    "process_rule": {
        "mode": "hierarchical",
        "rules": {
            "segmentation": {
                "separator": "whatever",
                "max_tokens": 2000
            },
            "parent_mode": "paragraph",
            "subchunk_segmentation": {
                "separator": "***",
                "max_tokens": 500
            }
        }
    }
}

Ensure that the segmentation rules are set according to the document format and context requirements. Proper configuration is crucial for accurate content classification and retrieval [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@DavideDelbianco
Copy link

I confirm the same behavior; I've also tried with regular expressions.
Considering that most tools tend to convert scraped / extract content to markdown, this is an issue.
Using \n as suggested in the UI to separate chunks is a bad practice in RAG, because you will end up with very little information in each chunk vector and considering that retrieval in Dify is based only on a max TopK of 10 this ends up generating useless response from the AI.

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

2 participants