Skip to content

fix: preserve zero LlamaIndex chunk overlap#602

Merged
pancacake merged 1 commit into
HKUDS:devfrom
VectorPeak:codex/fix-chunk-overlap-zero
Jun 30, 2026
Merged

fix: preserve zero LlamaIndex chunk overlap#602
pancacake merged 1 commit into
HKUDS:devfrom
VectorPeak:codex/fix-chunk-overlap-zero

Conversation

@VectorPeak

Copy link
Copy Markdown
Contributor

Fix LlamaIndex chunk geometry so an explicit chunk_overlap of 0 is preserved instead of falling back to DeepTutor's default overlap.

Description

chunk_geometry() previously used settings.get("chunk_overlap", 50) or 50, which treated a valid configured 0 as missing and silently returned 50. The runtime settings layer and UI already allow chunk_overlap=0, so this made the indexing runtime ignore a user's attempt to disable overlap.

This change distinguishes None from other falsy values when applying defaults, preserving explicit zero overlap while keeping the existing 512/50 fallback for missing or unreadable settings.

Related Issues

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: services/rag/pipelines/llamaindex

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Evidence:

Before this change, this runtime settings payload:

{"chunk_size": 512, "chunk_overlap": 0}

was interpreted by chunk_geometry() as (512, 50) because 0 or 50 selected the fallback. After this change, the same payload returns (512, 0).

Possible call chain / impact:

deeptutor/services/rag/pipelines/llamaindex/config.py
  -> chunk_geometry()
  -> deeptutor/services/rag/pipelines/llamaindex/embedding_adapter.py
  -> Settings.chunk_overlap
  -> deeptutor/services/rag/pipelines/llamaindex/ingestion.py
  -> SentenceSplitter(chunk_overlap=Settings.chunk_overlap)

This PR is scoped to LlamaIndex chunk geometry configuration. It does not change document loading, parser selection, vector indexing, reranking, or chat retrieval UI behavior.

Validation:

  • mamba run -n prw-deeptutor-py311 pytest -q tests/services/config/test_llamaindex_settings.py - passed, 5 tests
  • mamba run -n prw-deeptutor-py311 python -m ruff check deeptutor/services/rag/pipelines/llamaindex/config.py tests/services/config/test_llamaindex_settings.py - passed
  • mamba run -n prw-deeptutor-py311 ruff format --check deeptutor/services/rag/pipelines/llamaindex/config.py tests/services/config/test_llamaindex_settings.py - passed
  • git diff --check - passed

Limitation: I did not run the full pre-commit run --all-files; validation was focused on the touched Python files and the relevant configuration tests.

@VectorPeak VectorPeak marked this pull request as ready for review June 30, 2026 02:47
@pancacake pancacake merged commit 85756d0 into HKUDS:dev Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants