Skip to main content

synth_ai.sdk.inference.jobs

Async inference jobs for environment-backed execution. Use this for Harbor or browser inference jobs where you upload a bundle and poll job status or download artifacts. Example (Harbor inference job):
>>> from synth_ai.sdk.inference import InferenceJobRequest, InferenceJobsClient
>>>
>>> request = InferenceJobRequest(
...     environment_type="harbor",
...     bundle_path="./bundle.tar.gz",
...     harbor={"deployment_id": "dep_123"},
... )
>>>
>>> client = InferenceJobsClient(
...     base_url="https://api.usesynth.ai",
...     api_key=os.environ["SYNTH_API_KEY"],
... )
>>> job = await client.create_job_from_request(request)
>>> print(job["job_id"])

Classes

InferenceJobsClient

Client for creating and polling inference jobs. Methods:

create_job

create_job(
    self,
    *,
    environment_type: str,
    bundle_bytes: bytes,
    filename: str | None = None,
    content_type: str | None = None,
    archive_type: str | None = None,
    harbor: dict[str, Any] | None = None,
    browser: dict[str, Any] | None = None,
    policy: dict[str, Any] | None = None,
    limits: dict[str, Any] | None = None,
    container_overrides: dict[str, Any] | None = None,
    artifact: InferenceArtifactSpec | dict[str, Any] | None = None,
) -> dict[str, Any]

create_job_from_request

create_job_from_request(self, request: InferenceJobRequest) -> dict[str, Any]

create_job_from_path

create_job_from_path(
    self,
    *,
    environment_type: str,
    bundle_path: str | Path,
    filename: str | None = None,
    content_type: str | None = None,
    archive_type: str | None = None,
    harbor: dict[str, Any] | None = None,
    browser: dict[str, Any] | None = None,
    policy: dict[str, Any] | None = None,
    limits: dict[str, Any] | None = None,
    container_overrides: dict[str, Any] | None = None,
    artifact: InferenceArtifactSpec | dict[str, Any] | None = None,
) -> dict[str, Any]

list_artifacts

list_artifacts(self, job_id: str, *, artifact_type: str | None = None) -> dict[str, Any]

download_artifact

download_artifact(self, job_id: str, artifact_id: str, *, timeout: float | None = None) -> bytes

get_job

get_job(self, job_id: str) -> dict[str, Any]

InferenceJobRequest

Convenience container for inference job submissions. Use harbor for Harbor deployments, or browser for browser-backed jobs.

InferenceArtifactSpec

Artifact selection for inference jobs.

Functions

create_inference_job

create_inference_job(
    *,
    base_url: str | None = None,
    api_key: str | None = None,
    timeout: float = 60.0,
    environment_type: str,
    bundle_bytes: bytes,
    filename: str | None = None,
    content_type: str | None = None,
    archive_type: str | None = None,
    harbor: dict[str, Any] | None = None,
    browser: dict[str, Any] | None = None,
    policy: dict[str, Any] | None = None,
    limits: dict[str, Any] | None = None,
    container_overrides: dict[str, Any] | None = None,
    artifact: InferenceArtifactSpec | dict[str, Any] | None = None,
) -> dict[str, Any]

create_inference_job_from_path

create_inference_job_from_path(
    *,
    base_url: str | None = None,
    api_key: str | None = None,
    timeout: float = 60.0,
    environment_type: str,
    bundle_path: str | Path,
    filename: str | None = None,
    content_type: str | None = None,
    archive_type: str | None = None,
    harbor: dict[str, Any] | None = None,
    browser: dict[str, Any] | None = None,
    policy: dict[str, Any] | None = None,
    limits: dict[str, Any] | None = None,
    container_overrides: dict[str, Any] | None = None,
    artifact: InferenceArtifactSpec | dict[str, Any] | None = None,
) -> dict[str, Any]

get_inference_job

get_inference_job(job_id: str, *, base_url: str | None = None, api_key: str | None = None, timeout: float = 60.0) -> dict[str, Any]

download_inference_artifact

download_inference_artifact(
    job_id: str,
    artifact_id: str,
    *,
    base_url: str | None = None,
    api_key: str | None = None,
    timeout: float | None = None,
) -> bytes