Python SDK interface¶
- class modelz.client.ModelzClient(key: str, endpoint: str | None = None, timeout: float | Timeout = Timeout(connect=5, read=300, write=300, pool=5))[source]¶
Create a Modelz Client for standalone commands.
- Parameters:
endpoint – endpoint URL
key – API key
timeout – request timeout (second)
- build(repo: str)[source]¶
Build a Docker image and push it to the registry.
- Parameters:
repo – git repo url
- inference(params: Any, serde: str = 'json') ModelzResponse [source]¶
Get the inference result.
- Parameters:
params – request params, will be serialized by
serde
serde – serialize/deserialize method, choose from (“json”, “msgpack”, “raw”)
- metrics(deployment: str | None = None) ModelzResponse [source]¶
Get deployment metrics.
- Parameters:
deployment – deployment ID
- class modelz.client.ModelzResponse(resp: ~httpx.Response, serde: ~modelz.serde.Serde = <modelz.serde.TextSerde object>)[source]¶
Modelz internal response.
The initialization will raise an error if the response status code is not 200.
- property data: Any¶
Access the response data.
It will be decoded by the serde method provided.
- class modelz.openapi_client.DeploymentClient(login_name: str, key: str, host: str = 'https://cloud.modelz.ai/api/v1', cluster_id: str = 'modelz')[source]¶
- create(req: DeploymentCreateRequest) Response[DeploymentResponse] [source]¶
Create a new deployment.
- Parameters:
req – spec of request body
- delete(deployment_id: str) Response[None] [source]¶
Delete any exist deployments.
- Parameters:
deployment_id – deployment id
- get(deployment_id: str) Response[DeploymentResponse] [source]¶
Get exist deployment by id
- Parameters:
deployment_id – deployment id
- list() Response[DeploymentListResponse] [source]¶
Create all exist deployments.
- update(deployment_id: str, req: DeploymentUpdateRequest) Response[DeploymentResponse] [source]¶
Update editable spec of any exist deployments.
- Parameters:
deployment_id – deployment id
req – spec of request body