-
Notifications
You must be signed in to change notification settings - Fork 28
[FSTORE-1820] Documentation for REST API model deployments #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4614f37
adding documentation for model serving
manu-sj 7ad6c3d
removing dummy file
manu-sj 3562707
Update docs/user_guides/mlops/serving/rest-api.md
manu-sj 13be470
Update docs/user_guides/mlops/serving/index.md
manu-sj 96d99ed
Update docs/user_guides/mlops/serving/rest-api.md
manu-sj 8a7c9d3
updated based on review comments
manu-sj 7dae412
Update docs/user_guides/mlops/serving/index.md
manu-sj 3fb9140
addressing review comments
manu-sj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Hopsworks Model Serving REST API | ||
|
|
||
| ## Introduction | ||
|
|
||
| Hopsworks provides model serving capabilities by leveraging [KServe](https://kserve.github.io/website/) as the model serving platform and [Istio](https://istio.io/) as the ingress gateway to the model deployments. | ||
|
|
||
| This document explains how to interact with a model deployment via REST API. | ||
|
|
||
| ## Base URL | ||
|
|
||
| Deployed models are accessible through the Istio ingress gateway. The URL to interact with a model deployment is provided on the model deployment page in the Hopsworks UI. | ||
|
|
||
| The URL follows the format `http://<ISTIO_GATEWAY_IP>/<RESOURCE_PATH>`, where `RESOURCE_PATH` depends on the [model server](https://kserve.github.io/website/docs/intro#supported-model-frameworks) (e.g. vLLM, TensorFlow Serving, SKLearn ModelServer). | ||
|
|
||
| <p align="center"> | ||
| <figure> | ||
| <img style="max-width: 100%; margin: 0 auto" src="../../../../assets/images/guides/mlops/serving/deployment_endpoints.png" alt="Endpoints"> | ||
| <figcaption>Deployment Endpoints</figcaption> | ||
| </figure> | ||
| </p> | ||
|
|
||
|
|
||
| ## Authentication | ||
|
|
||
| All requests must include an API Key for authentication. You can create an API by following this [guide](../../projects/api_key/create_api_key.md). | ||
|
|
||
| Include the key in the Authorization header: | ||
| ```text | ||
| Authorization: ApiKey <API_KEY_VALUE> | ||
| ``` | ||
|
|
||
| ## Headers | ||
|
|
||
| | Header | Description | Example Value | | ||
| | --------------- | ------------------------------------------- | ------------------------------------ | | ||
| | `Host` | Model’s hostname, provided in Hopsworks UI. | `fraud.test.hopsworks.ai` | | ||
| | `Authorization` | API key for authentication. | `ApiKey <your_api_key>` | | ||
| | `Content-Type` | Request payload type (always JSON). | `application/json` | | ||
|
|
||
| ## Request Format | ||
|
|
||
| The request must be sent as a JSON object containing an `inputs` or `instances` field. You can find more information on the request format [here](https://kserve.github.io/website/docs/concepts/architecture/data-plane/v1-protocol#request-format). | ||
|
|
||
| === "Python" | ||
| ```python | ||
| import requests | ||
|
|
||
| data = { | ||
| "inputs": [ | ||
| [ | ||
| 4641025220953719, | ||
| 4920355418495856 | ||
| ] | ||
| ] | ||
| } | ||
|
|
||
| headers = { | ||
| "Host": "fraud.test.hopsworks.ai", | ||
| "Authorization": "ApiKey 8kDOlnRlJU4kiV1Y.RmFNJY3XKAUSqmJZ03kbUbXKMQSHveSBgMIGT84qrM5qXMjLib7hdlfGeg8fBQZp", | ||
| "Content-Type": "application/json" | ||
| } | ||
|
|
||
| response = requests.post( | ||
| "http://10.87.42.108/v1/models/fraud:predict", | ||
| headers=headers, | ||
| json=data | ||
| ) | ||
| print(response.json()) | ||
|
|
||
| ``` | ||
| === "Curl" | ||
| ```bash | ||
| curl -X POST "http://10.87.42.108/v1/models/fraud:predict" \ | ||
| -H "Host: fraud.test.hopsworks.ai" \ | ||
| -H "Authorization: ApiKey 8kDOlnRlJU4kiV1Y.RmFNJY3XKAUSqmJZ03kbUbXKMQSHveSBgMIGT84qrM5qXMjLib7hdlfGeg8fBQZp" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "inputs": [ | ||
| [ | ||
| 4641025220953719, | ||
| 4920355418495856 | ||
| ] | ||
| ] | ||
| }' | ||
| ``` | ||
|
|
||
| ## Response | ||
|
|
||
| The model returns predictions in a JSON object. The response depends on the model server implementation. You can find more information regarding specific model servers in the [Kserve documentation](https://kserve.github.io/website/docs/intro). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.