Skip to content

SDK reference

Auto-generated from the incheck Python package.

Clients

incheck.Client

Client(
    api_key: str | None = None,
    *,
    environment: Environment | None = None,
    base_url: str | None = None,
    timeout: float = 120.0,
    http_client: Client | None = None,
)

Synchronous InCheck API client.

Example

from incheck import Client

with Client() as client: # INCHECK_API_KEY from env for org in client.documents.list_orgs().org_ids: print(org)

Point at the staging (acceptance) environment:

with Client(environment="staging") as client: ...

incheck.AsyncClient

AsyncClient(
    api_key: str | None = None,
    *,
    environment: Environment | None = None,
    base_url: str | None = None,
    timeout: float = 120.0,
    http_client: AsyncClient | None = None,
)

Asynchronous InCheck API client.

Example

import asyncio from incheck import AsyncClient

async def main(): async with AsyncClient(environment="staging") as client: orgs = await client.documents.list_orgs() print(orgs.org_ids)

asyncio.run(main())

Documents resource

incheck.resources.documents.DocumentsResource

DocumentsResource(client: 'Client')

list_orgs

list_orgs() -> OrgListResponse

Every org_id under your namespace.

list

list(org_id: str) -> DocumentListResponse

All documents in an org_id's current version (with presigned GETs).

wait_for_job

wait_for_job(
    job_id: str,
    *,
    timeout: float = 600.0,
    poll_interval: float = 10.0,
) -> JobStatus

Block until the job reaches a terminal state or timeout elapses.

Raises :class:~incheck.exceptions.JobFailedError on failed and :class:~incheck.exceptions.JobTimeoutError if the deadline is hit.

upload

upload(
    org_id: str,
    files: Iterable[FileSpec],
    *,
    batch_size: int = 6,
    wait: bool = True,
    timeout: float = 600.0,
    poll_interval: float = 10.0,
) -> JobStatus | UploadCompleted

Initiate → PUT to S3 → complete → (optionally) poll until done.

Parameters:

Name Type Description Default
org_id str

Hierarchical org_id (must start with your namespace).

required
files Iterable[FileSpec]

Local paths or (filename, file_like) tuples.

required
batch_size int

Document-chunking batch size (1-20).

6
wait bool

When True (default), block until the processing job reaches a terminal state and return the final :class:JobStatus. When False, return the :class:UploadCompleted from complete-upload and let the caller poll.

True
timeout float

Max seconds to wait when wait=True.

600.0
poll_interval float

Seconds between status polls.

10.0

incheck.resources.documents.AsyncDocumentsResource

AsyncDocumentsResource(client: 'AsyncClient')

Chat resource

incheck.resources.chat.ChatResource

ChatResource(client: 'Client')

send

send(
    content: str,
    *,
    org_id: str | None = None,
    user_id: str = "sdk",
    conversation_id: str | None = None,
    scope: str = "ALS",
    state: str = "Massachusetts",
    conversation_hx: str | None = None,
) -> ChatResponse

Send a chat message and return the aggregated reply.

Parameters:

Name Type Description Default
content str

The user message.

required
org_id str | None

Optional. Pass your Pod's hierarchical org_id to run in unified mode (retrieval-aware against the documents onboarded into that Pod via the Documents API). Omit it to run in EMS mode (general EMS knowledge, no retrieval). First segment must equal your namespace.

None
user_id str

An identifier for the end-user. Audit trail only.

'sdk'
conversation_id str | None

Optional — a UUID is generated if omitted.

None
scope str

EMS scope ("ALS", "BLS", …).

'ALS'
state str

US state for state-specific protocols.

'Massachusetts'
conversation_hx str | None

Optional prior conversation context.

None

Returns:

Name Type Description
A ChatResponse

class:~incheck.models.ChatResponse with content

ChatResponse

joined and the raw chunks available on raw.

Example

EMS mode — no Pod needed

client.chat.send("Adult atropine dose for bradycardia?")

Unified mode — answer from your onboarded Pod

client.chat.send( ... "Per our SOP, what's the hazmat escalation path?", ... org_id="acme_dispatch", ... )

stream

stream(
    content: str,
    *,
    org_id: str | None = None,
    user_id: str = "sdk",
    conversation_id: str | None = None,
    scope: str = "ALS",
    state: str = "Massachusetts",
    conversation_hx: str | None = None,
) -> Iterator[ChatChunk]

Stream chat chunks as they arrive (SSE).

Identical contract to :meth:send, but yields each :class:~incheck.models.ChatChunk as it lands. Terminates on the type='complete' marker.

Example

for chunk in client.chat.stream( ... "Summarize the dispatch SOP.", ... org_id="acme_dispatch", ... ): ... if chunk.content: ... print(chunk.content, end="", flush=True)

incheck.resources.chat.AsyncChatResource

AsyncChatResource(client: 'AsyncClient')

send async

send(
    content: str,
    *,
    org_id: str | None = None,
    user_id: str = "sdk",
    conversation_id: str | None = None,
    scope: str = "ALS",
    state: str = "Massachusetts",
    conversation_hx: str | None = None,
) -> ChatResponse

Async counterpart of :meth:ChatResource.send.

stream async

stream(
    content: str,
    *,
    org_id: str | None = None,
    user_id: str = "sdk",
    conversation_id: str | None = None,
    scope: str = "ALS",
    state: str = "Massachusetts",
    conversation_hx: str | None = None,
) -> AsyncIterator[ChatChunk]

Async counterpart of :meth:ChatResource.stream.

Models

incheck.models.UploadInitiated

Bases: _IncheckModel

Result of a successful documents.initiate_upload call.

incheck.models.PresignedUpload

Bases: _IncheckModel

One file's presigned-POST credentials, returned by initiate-upload.

Pass upload_fields verbatim as multipart form fields, then attach the file under the file field, and POST to upload_url. S3 will respond with 204 No Content on success.

incheck.models.UploadCompleted

Bases: _IncheckModel

Result of documents.complete_upload — processing has been triggered.

incheck.models.UpdateInitiated

Bases: _IncheckModel

Result of documents.initiate_update for an existing org_id.

incheck.models.OrgListResponse

Bases: _IncheckModel

Result of documents.list_orgs() — always filtered to your namespace.

incheck.models.OrgInfo

Bases: _IncheckModel

A single org_id discovered under your namespace.

incheck.models.DocumentListResponse

Bases: _IncheckModel

incheck.models.DocumentInfo

DocumentInfo(**data: Any)

Bases: _IncheckModel

A single document inside an org_id's current version.

download_url exposes the short-lived presigned GET URL (the API field name is presigned_url; the SDK normalises to download_url for symmetry with other SDKs).

incheck.models.VersionInfo

Bases: _IncheckModel

incheck.models.JobStatus

Bases: _IncheckModel

Status of a document-processing job.

status is one of: initiated, pending, processing, completed, failed. Use :meth:is_terminal to check.

incheck.models.JobProgress

Bases: _IncheckModel

incheck.models.DeleteResponse

Bases: _IncheckModel

incheck.models.ChatResponse

Bases: _IncheckModel

Aggregated non-streaming chat reply.

incheck.models.ChatChunk

Bases: _IncheckModel

A single Server-Sent-Event payload from streaming /chat.

Streamed chunks carry content deltas. The final event has type='complete' and no content.

Errors

incheck.exceptions.IncheckError

IncheckError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: Exception

Base class for all InCheck SDK errors.

incheck.exceptions.AuthenticationError

AuthenticationError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

401 — missing or invalid API key.

incheck.exceptions.PermissionError

PermissionError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

403 — caller is authenticated but not allowed (often a namespace mismatch).

incheck.exceptions.NotFoundError

NotFoundError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

404 — resource (org, job, version) does not exist.

incheck.exceptions.ValidationError

ValidationError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

400 / 422 — request did not pass validation.

incheck.exceptions.RateLimitError

RateLimitError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
    retry_after: float | None = None,
)

Bases: IncheckError

429 — per-key rate limit exceeded.

incheck.exceptions.APIError

APIError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

5xx response from the gateway or an upstream service.

incheck.exceptions.APIConnectionError

APIConnectionError(
    message: str,
    *,
    status_code: int | None = None,
    response_body: Any = None,
)

Bases: IncheckError

Network-level failure reaching the gateway.

incheck.exceptions.JobFailedError

JobFailedError(message: str, *, job_id: str, status: str)

Bases: IncheckError

A document-processing job ended in a failed/error state.

incheck.exceptions.JobTimeoutError

JobTimeoutError(
    message: str, *, job_id: str, last_status: str | None
)

Bases: IncheckError

wait_for_job exceeded its deadline before the job reached a terminal state.