Skip to content
SupportLogin
Launch document preprocessing

Launch document preprocessing

datasets.launch_preprocessing(strdataset_id, DatasetLaunchPreprocessingParams**kwargs) -> DatasetLaunchPreprocessingResponse
POST/api/v1/datasets/{dataset_id}/launch-preprocessing

Extracts the text, tables and figures of an uploaded document dataset (pdf, docx, pptx, xlsx, html, or a zip of them) into rows. After the upload completes, such a dataset reports awaiting_input until this is called. Reserves credits from the page count of the selected documents — quote them first with GET /datasets/{dataset_id}/preprocessing-credits — then starts extraction. Poll GET /datasets/{dataset_id}/status: it reports pending while extracting and awaiting_input once the rows are ready, at which point call POST /datasets/{dataset_id}/adapt.

ParametersExpand Collapse
dataset_id: str
pages_to_process: Optional[float]

Maximum number of pages to process. Documents are included until this budget is reached. If omitted, all pages are processed.

minimum1
documents_to_process: Optional[float]

Maximum number of documents to process. If omitted, all documents are processed.

minimum1
preprocessing_mode: Optional[Literal["per_document", "per_page"]]

How extracted content becomes rows: per_document (default) makes one row per document, per_page one row per page. Omit to keep the mode already set on the dataset.

One of the following:
"per_document"
"per_page"
ReturnsExpand Collapse
class DatasetLaunchPreprocessingResponse: …
dataset_id: str

ID of the dataset

status: str

Dataset status after the launch. Poll GET /datasets/{dataset_id}/status until it reports awaiting_input, then call POST /datasets/{dataset_id}/adapt.

credits_escrowed: Optional[float]

Credits reserved for extracting the selected documents

pages_to_process: Optional[float]

Total pages across the documents selected for extraction

documents_selected: Optional[float]

Number of documents selected for extraction

documents_total: Optional[float]

Number of documents in the dataset

Launch document preprocessing

import os
from adaption import Adaption

client = Adaption(
    api_key=os.environ.get("ADAPTION_API_KEY"),  # This is the default and can be omitted
)
response = client.datasets.launch_preprocessing(
    dataset_id="dataset_id",
)
print(response.dataset_id)
{
  "dataset_id": "dataset_id",
  "status": "pending",
  "credits_escrowed": 0,
  "pages_to_process": 0,
  "documents_selected": 0,
  "documents_total": 0
}
Returns Examples
{
  "dataset_id": "dataset_id",
  "status": "pending",
  "credits_escrowed": 0,
  "pages_to_process": 0,
  "documents_selected": 0,
  "documents_total": 0
}