Skip to content

Guard against empty input in chunk_markdown()#5

Merged
fabriziosalmi merged 1 commit into
fabriziosalmi:mainfrom
fabgpt-coder:fabgpt/quality-e909b7dd
Jun 6, 2026
Merged

Guard against empty input in chunk_markdown()#5
fabriziosalmi merged 1 commit into
fabriziosalmi:mainfrom
fabgpt-coder:fabgpt/quality-e909b7dd

Conversation

@fabgpt-coder

Copy link
Copy Markdown
Contributor

FabGPT — code quality

File: agent/rag/chunker.py

Rationale: The function currently proceeds to split an empty string into sections, which results in a single empty chunk that is then filtered out by the min_chars check. This triggers unnecessary regex compilation and list processing for no gain. Adding an early return for empty input improves performance and prevents the creation of transient empty state.

Proposed by FabGPT OS and approved by a human before opening.


🤖 FabGPT OS · source quality · model qwen/qwen3.5-9b · task 28fd64433c92ead9 · HITL-approved before opening.

The function currently proceeds to split an empty string into sections, which results in a single empty chunk that is then filtered out by the `min_chars` check. This triggers unnecessary regex compilation and list processing for no gain. Adding an early return for empty input improves performance and prevents the creation of transient empty state.
@fabriziosalmi fabriziosalmi self-assigned this Jun 6, 2026
@fabriziosalmi fabriziosalmi merged commit e98fef0 into fabriziosalmi:main Jun 6, 2026
1 of 3 checks passed
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