Improve API and Configuration#4
Merged
Merged
Conversation
- Changed `process_document` signature to `(file_path, settings=None, ...)`. - Allowed `file_path` to be a string. - Exposed `process_document` and `Settings` at the top-level package. - Updated `Settings` to load from environment variables and provided better defaults. - Updated tests to match API changes and added new settings tests.
- Add return type annotations to `tests/test_settings.py`. - Combine nested `with` statements in `tests/test_settings.py`. - Fix argument order for `process_document` in `run_ocr.py`.
Owner
Author
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the API usability and configuration management of the gemini-ocr package. The changes, such as refining the process_document signature, exposing key components at the top level, and enabling configuration from environment variables, are well-implemented. The accompanying test updates and additions are also thorough. My review includes a few suggestions for further refinement, mainly around improving code maintainability by reducing duplication and enhancing the new configuration loading mechanism. Overall, this is a strong contribution that enhances the library's flexibility.
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.
This PR addresses several usability improvements and configuration enhancements:
API Changes:
process_documentsignature updated to standard(file_path, settings, ...)order.file_pathnow accepts strings.process_documentandSettingsare now exposed at the top level (from gemini_ocr import process_document).Configuration:
Settingsclass now supports loading from environment variables (e.g.,GEMINI_OCR_PROJECT).Tests:
tests/test_settings.py.