fix(rag): split oversized markdown header chunks#3085
Open
wolfkill wants to merge 1 commit into
Open
Conversation
babd3d6 to
c181185
Compare
Contributor
Author
|
Follow-up update:
Local verification:
GitHub CI is now green on this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chunk_size.chunk_sizewithout overriding the splitter's default overlap.Why
Markdown documents can contain large fenced YAML/TOML/config blocks under a single header. The header splitter previously returned that whole section as one chunk, which can exceed embedding provider input limits even when
chunk_sizeis configured.Tests
.venv/bin/python -m pytest packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.py::test_md_header_text_splitter_splits_oversized_code_block -q.venv/bin/python -m pytest packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.py::test_md_header_text_splitter_splits_oversized_code_block -q.venv/bin/python -m pytest packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.py packages/dbgpt-ext/src/dbgpt_ext/rag/knowledge/tests/test_markdown.py -qMarkdownKnowledge + ChunkManager + ChunkParameters(chunk_strategy="Automatic", chunk_size=128, chunk_overlap=16):17chunks, max length127, header/source metadata preserved..venv/bin/python -m ruff check packages/dbgpt-core/src/dbgpt/rag/text_splitter/text_splitter.py packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.py.venv/bin/python -m ruff format --check packages/dbgpt-core/src/dbgpt/rag/text_splitter/text_splitter.py packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.py.venv/bin/python -m compileall -q packages/dbgpt-core/src/dbgpt/rag/text_splitter/text_splitter.py packages/dbgpt-core/src/dbgpt/rag/text_splitter/tests/test_splitters.pygit diff --check