Skip to main content

KServe Python SDK

Project description

KServe Python SDK

Python SDK for KServe Server and Client.

Installation

KServe Python SDK can be installed by pip or uv.

pip install

pip install kserve

To install Kserve with storage support

pip install kserve[storage]

UV

Install via uv.

make dev_install

To install Kserve with storage support

uv install --extra storage

KServe Python Server

KServe's python server libraries implement a standardized library that is extended by model serving frameworks such as Scikit Learn, XGBoost and PyTorch. It encapsulates data plane API definitions and storage retrieval for models.

It provides many functionalities, including among others:

  • Registering a model and starting the server
  • Prediction Handler
  • Pre/Post Processing Handler
  • Liveness Handler
  • Readiness Handlers

It supports the following storage providers:

  • Google Cloud Storage with a prefix: "gs://"
    • By default, it uses GOOGLE_APPLICATION_CREDENTIALS environment variable for user authentication.
    • If GOOGLE_APPLICATION_CREDENTIALS is not provided, anonymous client will be used to download the artifacts.
  • S3 Compatible Object Storage with a prefix "s3://"
    • By default, it uses S3_ENDPOINT, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY environment variables for user authentication.
  • Azure Blob Storage with the format: "https://{$STORAGE_ACCOUNT_NAME}.blob.core.windows.net/{$CONTAINER}/{$PATH}"
  • Local filesystem either without any prefix or with a prefix "file://". For example:
    • Absolute path: /absolute/path or file:///absolute/path
    • Relative path: relative/path or file://relative/path
    • For local filesystem, we recommended to use relative path without any prefix.
  • Persistent Volume Claim (PVC) with the format "pvc://{$pvcname}/[path]".
    • The pvcname is the name of the PVC that contains the model.
    • The [path] is the relative path to the model on the PVC.
    • For e.g. pvc://mypvcname/model/path/on/pvc
  • Generic URI, over either HTTP, prefixed with http:// or HTTPS, prefixed with https://. For example:
    • https://<some_url>.com/model.joblib
    • http://<some_url>.com/model.joblib

Metrics

For latency metrics, send a request to /metrics. Prometheus latency histograms are emitted for each of the steps (pre/postprocessing, explain, predict). Additionally, the latencies of each step are logged per request.

Metric Name Description Type
request_preprocess_seconds pre-processing request latency Histogram
request_explain_seconds explain request latency Histogram
request_predict_seconds prediction request latency Histogram
request_postprocess_seconds pre-processing request latency Histogram

KServe Client

Getting Started

KServe's python client interacts with KServe control plane APIs for executing operations on a remote KServe cluster, such as creating, patching and deleting of a InferenceService instance. See the Sample for Python SDK Client to get started.

Documentation for Client API

Please review KServe Client API docs.

Documentation For Models

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kserve-0.20.0rc0.tar.gz (407.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kserve-0.20.0rc0-py3-none-any.whl (559.6 kB view details)

Uploaded Python 3

File details

Details for the file kserve-0.20.0rc0.tar.gz.

File metadata

  • Download URL: kserve-0.20.0rc0.tar.gz
  • Upload date:
  • Size: 407.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for kserve-0.20.0rc0.tar.gz
Algorithm Hash digest
SHA256 b4ed2c17fd12011d3a778f12966e8eb56aab8ab3cf611f2329f9a5db622e3911
MD5 81456fe608d7bf19617a475068523b5b
BLAKE2b-256 25932d56e080acfddb1a96b4103e918ca02947f09ec6ecce3c95e0ea928b2efd

See more details on using hashes here.

File details

Details for the file kserve-0.20.0rc0-py3-none-any.whl.

File metadata

  • Download URL: kserve-0.20.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 559.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for kserve-0.20.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6126e74025b0767e8db902fd2ec03f1a3e2e98e9228656a51a917f95a6d39cb
MD5 27599a4682b53b66610554a1064ba5e7
BLAKE2b-256 e41d179877143f95044c13cb662ecd443d82f1a5c0c7b45547440c66cf8f8d17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page