feat: add async extract jobs support to SDK#93
Open
erdanzhang wants to merge 2 commits into
Open
Conversation
- Add ExtractJobsResource and AsyncExtractJobsResource classes - Implement create(), get(), and list() methods for extract jobs - Add proper multipart form data handling for markdown files - Export all extract jobs resources in __init__.py - Integrate extract_jobs into main client classes - Add support for raw response and streaming response wrappers - Include test script to verify functionality Following the same pattern as parse_jobs implementation.
Test script was for local testing only and should not be included in the PR
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new extract_jobs resource (sync + async) to the landingai_ade SDK, intended to mirror the existing parse_jobs job-style API for asynchronous extract operations.
Changes:
- Introduces
ExtractJobsResource/AsyncExtractJobsResourcewithcreate(),get(), andlist()plus raw/streaming wrappers. - Adds new extract-job request/response type models.
- Wires
extract_jobsinto the main client and resource exports; adds a standalone local test script.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test_async_extract.py | Standalone script exercising sync/async extract jobs against a local server. |
| src/landingai_ade/types/extract_job_create_params.py | TypedDict params for creating extract jobs (schema + markdown inputs + options). |
| src/landingai_ade/types/extract_job_create_response.py | Model for create-job response (job_id, message). |
| src/landingai_ade/types/extract_job_get_response.py | Model for job status/result payload returned by get(). |
| src/landingai_ade/types/extract_job_list_params.py | Query params for listing extract jobs. |
| src/landingai_ade/types/extract_job_list_response.py | Model for list response (pagination + collection field). |
| src/landingai_ade/resources/extract_jobs.py | New sync/async resource implementation + raw/streaming wrapper classes. |
| src/landingai_ade/resources/init.py | Exports extract-jobs resources and wrapper variants. |
| src/landingai_ade/_client.py | Adds extract_jobs cached properties across sync/async clients and wrapper clients. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """Whether there are more results available.""" | ||
|
|
||
| list: List[ExtractJobGetResponse] | ||
| """List of extract jobs.""" No newline at end of file |
|
|
||
| id: str | ||
| """The unique identifier for the extract job.""" | ||
|
|
| extra_body: Add additional JSON properties to the request | ||
|
|
||
| timeout: Override the client-level default timeout for this request, in seconds | ||
| """ |
| extra_body: Add additional JSON properties to the request | ||
|
|
||
| timeout: Override the client-level default timeout for this request, in seconds | ||
| """ |
Comment on lines
+7
to
+15
| __all__ = ["ExtractJobCreateResponse"] | ||
|
|
||
|
|
||
| class ExtractJobCreateResponse(BaseModel): | ||
| job_id: str | ||
| """The unique identifier for the extract job.""" | ||
|
|
||
| message: Optional[str] = None | ||
| """Optional message about the job creation.""" No newline at end of file |
Comment on lines
+50
to
+66
| def create( | ||
| self, | ||
| *, | ||
| schema: str, | ||
| markdown: Optional[FileTypes | str] | Omit = omit, | ||
| markdown_url: Optional[str] | Omit = omit, | ||
| model: Optional[str] | Omit = omit, | ||
| output_save_url: Optional[str] | Omit = omit, | ||
| strict: bool | Omit = omit, | ||
| # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | ||
| # The extra values given here take precedence over values defined on the client or passed to this method. | ||
| extra_headers: Headers | None = None, | ||
| extra_query: Query | None = None, | ||
| extra_body: Body | None = None, | ||
| timeout: float | httpx.Timeout | None | NotGiven = not_given, | ||
| ) -> ExtractJobCreateResponse: | ||
| """ |
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
This PR adds async extract jobs support to the ade-python SDK, following the same pattern as the existing parse_jobs implementation.
Changes
1. New Extract Jobs Resource (
src/landingai_ade/resources/extract_jobs.py)ExtractJobsResourceandAsyncExtractJobsResourceclassescreate(),get(), andlist()methods for both sync and async versions2. Client Integration (
src/landingai_ade/_client.py)extract_jobsproperty to bothLandingAIADEandAsyncLandingAIADEclasses3. Type Definitions
extract_job_create_params.py- Parameters for creating extract jobsextract_job_create_response.py- Response from job creationextract_job_get_response.py- Response from getting job statusextract_job_list_params.py- Parameters for listing jobsextract_job_list_response.py- Response from listing jobs4. Resource Exports (
src/landingai_ade/resources/__init__.py)Features Supported
markdown_url)output_save_urlUsage Example
Testing
A test script
test_async_extract.pyis included to verify both sync and async functionality.Related PRs
This PR completes the SDK support for async extract operations, providing feature parity with the async parse functionality.