import os
from samplehc import SampleHealthcare
client = SampleHealthcare(
api_key=os.environ.get("SAMPLEHC_API_KEY"), # This is the default and can be omitted
)
response = client.v2.documents.extract(
documents=[{
"id": "id",
"file_name": "fileName",
}],
prompt="prompt",
response_json_schema={
"foo": "bar"
},
)
print(response.async_result_id){
"asyncResultId": "<string>"
}{
"error": "<string>",
"message": "<string>",
"statusCode": 123,
"details": {}
}{
"error": "<string>"
}{
"error": "<string>"
}Document extraction (async)
Initiates a modern, flexible asynchronous data extraction process using a JSON schema for the desired output and a prompt. Returns an ID for tracking.
import os
from samplehc import SampleHealthcare
client = SampleHealthcare(
api_key=os.environ.get("SAMPLEHC_API_KEY"), # This is the default and can be omitted
)
response = client.v2.documents.extract(
documents=[{
"id": "id",
"file_name": "fileName",
}],
prompt="prompt",
response_json_schema={
"foo": "bar"
},
)
print(response.async_result_id){
"asyncResultId": "<string>"
}{
"error": "<string>",
"message": "<string>",
"statusCode": 123,
"details": {}
}{
"error": "<string>"
}{
"error": "<string>"
}Body
An array of documents to extract data from.
Show child attributes
Show child attributes
A JSON schema defining the structure of the desired extraction output.
Show child attributes
Show child attributes
A prompt guiding the extraction process.
Optional control over the reasoning effort for extraction. Supported effort levels vary by model; GPT-5.6 supports up to max.
minimal, low, medium, high, xhigh, max The model to use for extraction.
reasoning-3-mini, reasoning-3, base-5, base-5-mini, base-5-nano, base-4.1, base-4.1-mini, base-4.1-nano, base-5.2, base-5.2-chat-latest, base-5.4, base-5.4-mini, base-5.5, base-5.6-sol, base-5.6-terra, base-5.6-luna, qwen3-next-80b-thinking, qwen3-next-80b-instruct, glm-5, glm-4.7, deepseek-v3.2, kimi-k2-thinking, gemini-3-pro, gemini-3-flash, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite Optional reranker model ID override for relevance filtering.
cohere.rerank-v3-5:0, amazon.rerank-v1:0 Force using the reranker for relevance filtering even with smaller document sets.
Deprecated. Accepted for backwards compatibility and ignored.
Deprecated. Accepted for backwards compatibility and ignored.
The priority of the extraction task. Non-interactive is lower priority. Background are tasks that can be run in the background while the user is doing other things.
interactive, non-interactive, background, background-v3 OCR enhancement configuration for figure, text, and table analysis.
Show child attributes
Show child attributes
OCR quality setting
high, low Filter out failed pdfs
Response
Accepted. Advanced extraction process initiated.
The ID to track the asynchronous extraction task.