Fix/pr 375 chunking import#383
Open
ASuresh0524 wants to merge 4 commits into
Open
Conversation
- Add max_tokens_per_chunk param to create_traditional_chunks() and create_text_chunks() — auto-scales chunk_size using existing calculate_safe_chunk_size() and validates with validate_chunk_token_limits() - Also scales AST chunk_size when token limit is given - Revalidate chunk_overlap after scaling to avoid SentenceSplitter errors - Add BaseRAGExample._resolve_chunk_token_limit() helper to resolve the embedding model's token limit from CLI args - build_index() now warns if existing chunks exceed the model's token limit Backward compat: default max_tokens_per_chunk=None (no-op, identical behavior)
- Delete _traditional_chunks_as_dicts() — it was a pure alias for create_traditional_chunks(). Replace all 6 call sites with direct calls. - Extract _parse_ast_chunk_output() — normalizes the 4 different chunk output shapes (object, str, dict with content, dict with text) into a uniform (text, metadata) tuple. Removes 20 lines of inline dispatch from create_ast_chunks(). - Net: +28/−35 lines, no behaviour change
PR #375 renamed the helper to create_traditional_chunks but apps/chunking still imports the old name, breaking test collection on all platforms. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What does this PR do?
Related Issues
Fixes #
Checklist
uv run pytest)ruff formatandruff check)pre-commit run --all-files)