Support bytes/Path inputs, presigned URLs, and multipart uploads#165
Closed
majcheradam wants to merge 4 commits intozai-org:mainfrom
Closed
Support bytes/Path inputs, presigned URLs, and multipart uploads#165majcheradam wants to merge 4 commits intozai-org:mainfrom
majcheradam wants to merge 4 commits intozai-org:mainfrom
Conversation
…loads Extend parse() to accept bytes and pathlib.Path in addition to str. Add HTTP(S) URL support (including presigned URLs) in PageLoader and image_utils. Add multipart/form-data endpoint to the Flask server so clients can upload files directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds information extraction support using GLM-OCR's native extraction mode. Accepts schemas as empty-value templates, JSON Schema (Zod-compatible via zodToJsonSchema), or Pydantic model classes. - GlmOcr.extract() method and glmocr.extract() convenience function in api.py - POST /glmocr/extract endpoint in server.py (JSON + multipart/form-data) - PDF extraction uses two-phase approach: full parse then single VLM call - Image extraction sends image + prompt directly to VLM Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When no schema is provided, the extract endpoint now parses the document first to get markdown, then sends it to the VLM to produce structured JSON automatically instead of returning a 400 error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Let vLLM use its full context window (--max-model-len) instead of artificially capping output tokens with a heuristic estimator. Also add gunicorn to server extras. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.
Summary
GlmOcr.parse()to acceptbytes,pathlib.Path, and presigned URLs in addition to plainstrpathsPageLoaderandimage_utils(including presigned S3/GCS URLs)multipart/form-datasupport to the Flask/glmocr/parseendpoint so clients can upload files directly alongside URL stringsTest plan
parse()with local file path (str),Pathobject, rawbytes, and presigned URLapplication/jsonbody (existing behavior)multipart/form-data(file uploads + URL fields)🤖 Generated with Claude Code