-
Notifications
You must be signed in to change notification settings - Fork 352
docs: add release note #342
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| This release simplifies the table of contents (TOC) extraction API by replacing enum-based modes with a boolean flag, while adding LLM-powered chapter title analysis capabilities for improved TOC hierarchy detection. | ||
|
|
||
| ## What's Changed | ||
|
|
||
| ### Breaking Changes | ||
|
|
||
| * **Simplified TOC API**: Replaced `TocExtractionMode` enum with a simpler `toc_assumed` boolean parameter in https://github.com/oomol-lab/pdf-craft/pull/341 | ||
| - Removed `toc_mode` parameter from `transform_markdown()` and `transform_epub()` functions | ||
| - Removed `TocExtractionMode` from public API exports | ||
| - Introduced `toc_assumed` boolean flag to control TOC detection behavior | ||
|
|
||
| ### Features | ||
|
|
||
| * **LLM-Powered Chapter Title Analysis**: Added support for LLM-based analysis of chapter titles to enhance TOC extraction accuracy in https://github.com/oomol-lab/pdf-craft/pull/341 | ||
| - Automatically analyzes chapter title hierarchies when `toc_llm` is configured | ||
| - Provides more accurate chapter level detection for complex book structures | ||
| - Intelligently falls back to standard analysis when LLM is unavailable or encounters errors | ||
|
|
||
| ### Improvements | ||
|
|
||
| * **Enhanced Error Handling**: Added robust error handling for LLM-based analysis with automatic recovery mechanisms in https://github.com/oomol-lab/pdf-craft/pull/341 | ||
| - Better error diagnostics for LLM analysis failures | ||
| - Graceful degradation when LLM analysis fails, ensuring conversion continues successfully | ||
|
|
||
| ## Migration Guide | ||
|
|
||
| If you were using `toc_mode` in previous versions, update your code as follows: | ||
|
|
||
| ### Previous API (v1.0.9 and earlier) | ||
|
|
||
| ```python | ||
| from pdf_craft import transform_markdown, TocExtractionMode | ||
|
|
||
| # For Markdown conversion | ||
| transform_markdown( | ||
| pdf_path="input.pdf", | ||
| markdown_path="output.md", | ||
| toc_mode=TocExtractionMode.NO_TOC_PAGE, # Old parameter | ||
| ) | ||
|
|
||
| # For EPUB conversion | ||
| transform_epub( | ||
| pdf_path="input.pdf", | ||
| epub_path="output.epub", | ||
| toc_mode=TocExtractionMode.AUTO_DETECT, # Old parameter | ||
| ) | ||
| ``` | ||
|
|
||
| ### New API (v1.0.10) | ||
|
|
||
| ```python | ||
| from pdf_craft import transform_markdown | ||
|
|
||
| # For Markdown conversion (assumes no TOC pages by default) | ||
| transform_markdown( | ||
| pdf_path="input.pdf", | ||
| markdown_path="output.md", | ||
| toc_assumed=False, # New boolean parameter (default: False) | ||
| ) | ||
|
|
||
| # For EPUB conversion (assumes TOC pages exist) | ||
| transform_epub( | ||
| pdf_path="input.pdf", | ||
| epub_path="output.epub", | ||
| toc_assumed=True, # New boolean parameter | ||
| ) | ||
| ``` | ||
|
|
||
| ### Migration Mapping | ||
|
|
||
| | Old `toc_mode` Value | New `toc_assumed` Value | | ||
| |---------------------|------------------------| | ||
| | `TocExtractionMode.NO_TOC_PAGE` | `False` | | ||
| | `TocExtractionMode.AUTO_DETECT` | `True` | | ||
| | `TocExtractionMode.LLM_ENHANCED` | `True` (with `toc_llm` configured) | | ||
|
|
||
| ## LLM-Enhanced TOC Extraction | ||
|
|
||
| To use LLM-powered chapter title analysis: | ||
|
|
||
| ```python | ||
| from pdf_craft import transform_epub, BookMeta, LLM | ||
|
|
||
| # Configure LLM for TOC enhancement | ||
| toc_llm = LLM( | ||
| key="your-api-key", | ||
| url="https://api.openai.com/v1", | ||
| model="gpt-4", | ||
| token_encoding="cl100k_base", | ||
| ) | ||
|
|
||
| transform_epub( | ||
| pdf_path="input.pdf", | ||
| epub_path="output.epub", | ||
| toc_assumed=True, # Enable TOC detection | ||
| toc_llm=toc_llm, # Enable LLM-powered analysis | ||
| book_meta=BookMeta( | ||
| title="Book Title", | ||
| authors=["Author"], | ||
| ), | ||
| ) | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - The `toc_assumed` parameter defaults to `False` for Markdown conversion and `True` for EPUB conversion (maintaining backward-compatible behavior) | ||
| - LLM-powered chapter title analysis is optional and automatically falls back to standard analysis if not configured or if errors occur | ||
| - The new API is simpler and more intuitive, reducing the cognitive load of choosing between multiple enum values | ||
|
|
||
| **Full Changelog**: https://github.com/oomol-lab/pdf-craft/compare/v1.0.9...v1.0.10 | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor grammar fix: use hyphenated compound adjective.
On line 16, "chapter level detection" should be "chapter-level detection" when used as a compound adjective modifying "detection".
📝 Suggested fix
📝 Committable suggestion
🧰 Tools
🪛 LanguageTool
[grammar] ~16-~16: Use a hyphen to join words.
Context: ...gured - Provides more accurate chapter level detection for complex book structu...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents