Wire up Valyu Contents extraction with the Python SDK.
Basic usage
Common patterns
extract_effort="high" for JS-heavy pages or complex layouts, and response_length ("short" 25k, "medium" 50k, "large" 100k, "max", or an int) to control content per URL.
For arXiv, PubMed Central, bioRxiv, medRxiv, and ChemRxiv papers, Valyu serves clean processed markdown (with figures and equations) from its academic index when your plan covers the source - otherwise it uses the live crawler. Pass the paper URL (a
/pdf/ arXiv link or a DOI works best) or bare id. See Academic Papers.Reference
Parameters
Parameters
urls (List[str], required) - URLs to process (max 10 sync, max 50 async).| Parameter | Type | Description | Default |
|---|---|---|---|
summary | bool | str | dict | False (none), True (auto), a string instruction, or a JSON schema for structured extraction | False |
extract_effort | "normal" | "high" | "auto" | Extraction effort. Use "high" for JS-heavy pages | ”auto” |
response_length | str | int | "short" (25k), "medium" (50k), "large" (100k), "max", or a custom character count | ”short” |
screenshot | bool | Request page screenshots. When True, results include screenshot_url | False |
Response format
Response format
Async jobs (11-50 URLs)
Async mode is required above 10 URLs. Max 50 URLs per request, processed in batches of 5 with a 120s timeout per URL (vs 25s sync). Jobs expire after 7 days.Submit, then wait with progress and webhooks
Submit, then wait with progress and webhooks
"{timestamp}.{json_body}". See the Content Extraction guide for verification.For full control, poll valyu.get_contents_job(job_id) yourself until status is completed, partial, or failed.Async parameters and response types
Async parameters and response types
| Parameter | Type | Description | Default |
|---|---|---|---|
async_mode | bool | Process URLs asynchronously. Required above 10 URLs | False |
webhook_url | str | HTTPS URL to receive results via webhook POST | None |
wait | bool | Block until the job completes (SDK handles polling) | False |
poll_interval | int | Seconds between polls | 5 |
max_wait_time | int | Max seconds to wait before timing out | 3600 |
on_progress | Callable | Callback invoked on each poll with the current status dict | None |
Async client (AsyncValyu)
Async client (AsyncValyu)
The You can combine both: submit a server-side async job through
AsyncValyu client calls Contents with async/await inside your event loop - distinct from the server-side async jobs above (async_mode=True). It’s the natural fit for many single-URL extractions in parallel:AsyncValyu and await valyu.wait_for_contents_job(job.job_id) without parking a thread. See the Python SDK overview for constructor options and lifecycle.
