Repository navigation
feat(hosted): let callers choose the Parse mode - #199
Open
erikengervall wants to merge 2 commits into
Open
erikengervall wants to merge 2 commits into
erikengervall wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This branch has not been deployed
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.
Hosted OCR always asks Parse for
mode: 'auto', so a caller who knows the document is scanned cannot force OCR, and one who wants text-only extraction cannot ask forfast.Node takes
parseMode: 'auto' | 'fast' | 'ocr', Pythonparse_mode(exported asParseMode), the CLI--parse-mode. The default staysauto, so the request body is unchanged for existing callers. The value is checked when the call starts, before any conversion or request: a bad one rejects withcode: 'hosted'in Node and raisesHostedErrorin Python, and the CLI exits 2 like other usage errors.The Rust crate and the Wasm binding never call Parse, so they are untouched.
Tests against the local
/v2/parsestub now also read the options each request sent: the default isauto, a custom mode is sent as given, an invalid mode raises with no request made.Summary by cubic
Lets hosted OCR callers choose the Parse PDF mode instead of always sending
auto.Node takes
parseMode, Python takesparse_mode(exported asParseMode), and the CLI takes--parse-mode, each accepting'auto','fast', or'ocr'. The default staysauto, so existing callers see no change in the request body. Invalid values are rejected before any conversion or request, even when the document would convert locally: in Node withcode: 'hosted', in Python withHostedError, and in the CLI with exit code 2.The Rust crate and Wasm binding never call Parse, so they are untouched.
Written for commit 139087f. Summary will update on new commits.