from landingai_ade.types import ParseGroundingBox, ParseMetadataTypes:
from landingai_ade.types import (
ClassifyResponse,
ExtractResponse,
ExtractBuildSchemaResponse,
ParseResponse,
SectionResponse,
SplitResponse,
)Methods:
client.classify(**params) -> ClassifyResponseclient.extract(**params) -> ExtractResponseclient.extract_build_schema(**params) -> ExtractBuildSchemaResponseclient.parse(**params) -> ParseResponseclient.section(**params) -> SectionResponseclient.split(**params) -> SplitResponse
Types:
from landingai_ade.types import ParseJobCreateResponse, ParseJobListResponse, ParseJobGetResponseMethods:
client.parse_jobs.create(**params) -> ParseJobCreateResponseclient.parse_jobs.list(**params) -> ParseJobListResponseclient.parse_jobs.get(job_id) -> ParseJobGetResponse
Types:
from landingai_ade.types import (
ExtractJobCreateResponse,
ExtractJobListResponse,
ExtractJobGetResponse,
)Methods:
client.extract_jobs.create(**params) -> ExtractJobCreateResponseclient.extract_jobs.list(**params) -> ExtractJobListResponseclient.extract_jobs.get(job_id) -> ExtractJobGetResponse
The client.v2 sub-client targets LandingAI's next-generation ADE gateway, which lives on its own host (api.ade.[env].landing.ai) rather than the V1 host (api.va.[env].landing.ai). It is additive: client.v2.* is a separate surface from the top-level client.* (V1) methods documented above, and using it does not change any V1 behavior. See the README for environment selection and usage examples.
client.v2.parse_jobs and client.v2.extract_jobs both return a single, unified Job shape, even though the underlying parse/extract job envelopes differ upstream -- Job.raw retains the full original envelope as an escape hatch for any field not surfaced on the typed model.
Types:
from landingai_ade.types.v2 import (
Job,
JobError,
JobStatus,
V2BuildSchemaBilling,
V2BuildSchemaMetadata,
V2BuildSchemaResponse,
V2BuildSchemaWarning,
V2ExtractBilling,
V2ExtractMetadata,
V2ExtractResult,
V2GroundBilling,
V2GroundMetadata,
V2GroundResult,
V2ParseBilling,
V2ParseBox,
V2ParseElement,
V2ParseGrounding,
V2ParseGroundingElement,
V2ParseGroundingEntry,
V2ParseGroundingPage,
V2ParseMetadata,
V2ParseNodeGrounding,
V2ParsePage,
V2ParseRange,
V2ParseResponse,
V2ParseStructure,
)Job-- unified job shape:job_id,status(JobStatus:pending/processing/completed/failed/cancelled),created_at,completed_at,progress,result(aV2ParseResponsefor parse jobs, aV2ExtractResultfor extract jobs, aV2BuildSchemaResponsefor build-schema jobs, orNoneuntil completion),error(JobError),metadata(the result's metadata receipt as adict, populated top-level only whenoutput_save_urlwas set and the result was delivered tooutput_urlinstead of inline;Noneotherwise, since inline jobs carry it onresult.metadata),raw(the full original envelope as adict), and the.is_terminalproperty.V2ParseResponse--markdown,structure,grounding,metadata(V2ParseMetadata, which nestsV2ParseBillingand carriesoutput_markdown_chars,range_units, andopenapi_spec).structureis a typedV2ParseStructuretree (document→V2ParsePage→V2ParseElement); each node below the root carries its spatial data inline in aV2ParseNodeGrounding(page,V2ParseRange,V2ParseBox, normalized page coordinates), and leaf elements additionally carry anatomic_groundinglist. Withoptions.inline_markdown, each node also carries itsmarkdownslice. The legacy top-levelgroundingtree (V2ParseGrounding→V2ParseGroundingPage→V2ParseGroundingElement→V2ParseGroundingEntry) is retained for older gateway responses. Elementtype/pagestatusare permissive strings and unknown keys are retained.V2ExtractResult--extraction,extraction_metadata,markdown,output_ref,schema_violation_error(set whenstrict=Falseand the schema had unextractable fields),warnings, andmetadata(V2ExtractMetadata, which carriesmodel_version,input_markdown_chars,output_extraction_chars,range_units,openapi_spec, and nestsV2ExtractBilling).V2BuildSchemaResponse--extraction_schema(the generated JSON Schema serialized as a string) andmetadata(V2BuildSchemaMetadata:job_id,duration_ms,openapi_spec,filename/org_id/version(retained for compatibility), awarningslist ofV2BuildSchemaWarning(code,msg), and nestedV2BuildSchemaBilling).V2GroundResult--grounding(a tree mirroring the inputextraction_metadata, each{value, ranges}leaf replaced by the list ofstructureblocks its ranges overlap) andmetadata(V2GroundMetadata:job_id,duration_ms,openapi_spec, and nestedV2GroundBilling).
Methods:
-
client.v2.parse(*, document=..., document_url=..., model=..., options=..., password=..., save_to=...) -> V2ParseResponseSynchronous parse. Provide exactly one of
document(file) ordocument_url. Returns aV2ParseResponseon both full success (HTTP 200) and partial success (HTTP 206, whereresult.metadata.failed_pageslists unparsed pages). RaisesV2SyncTimeoutError(fromlandingai_ade.lib.v2_errors) on a 504; useparse_jobsfor long-running documents. -
client.v2.parse_jobs.create(*, document=..., document_url=..., model=..., options=..., password=..., output_save_url=..., service_tier=...) -> Job -
client.v2.parse_jobs.list(*, page=..., page_size=..., status=...) -> JobList[Job] -
client.v2.parse_jobs.wait(job_id, *, timeout=600, poll_interval=None, raise_on_failure=False) -> JobBlocks, polling
.get(job_id)with exponential backoff, until the job reaches a terminal status. RaisesJobWaitTimeoutErroriftimeoutseconds elapse first, andJobFailedErrorifraise_on_failure=Trueand the terminal job carries anerror(not simply everyfailed/cancelledstatus). -
client.v2.extract(*, schema, markdown=..., markdown_url=..., model=..., strict=..., save_to=...) -> V2ExtractResultSynchronous extract.
schemaaccepts a pydanticBaseModelsubclass, adict, or a JSON-encoded string -- all are coerced to a JSON Schema object. Provide exactly one ofmarkdownormarkdown_url.strict=Truerejects schemas with unsupported fields (HTTP 422) instead of silently pruning them. RaisesV2SyncTimeoutErroron a 504; useextract_jobsfor long-running documents. -
client.v2.extract_jobs.create(*, schema, markdown=..., markdown_url=..., model=..., strict=..., output_save_url=..., service_tier=...) -> Job -
client.v2.extract_jobs.list(*, page=..., page_size=..., status=...) -> JobList[Job] -
client.v2.extract_jobs.wait(job_id, *, timeout=600, poll_interval=None, raise_on_failure=False) -> JobSame polling/timeout semantics as
parse_jobs.wait. Extract jobs have nocancelledstatus, soraise_on_failureonly ever triggers onfailed. -
client.v2.ground(*, extraction_metadata, structure) -> V2GroundResultSynchronous ground. Maps each extracted field back to the
structureblocks it was quoted from by overlappingextraction_metadataranges against every block's inlinegrounding.range. Bothextraction_metadata(e.g.client.v2.extract(...).extraction_metadata) andstructure(e.g.client.v2.parse(...).structure) accept adictor a pydantic model. Block ids resolve only against thestructuresupplied here, so pass the parse result the extraction actually came from./v2/groundis synchronous-only (no async jobs route).
Notes:
parse_jobs.listandextract_jobs.listboth return aJobList(alist[Job]subclass) carrying pagination metadata:.has_more,.org_id,.page,.page_size.- All
client.v2.*methods accept the usualextra_headers,extra_query,extra_body, andtimeoutoverrides; sync methods additionally acceptsave_to(parse/extract only, not the job-creation methods) to write the response to disk, mirroring V1'ssave_to.