Querying an endpoint

Once the endpoint has finished updating:

endpoint.update(model_version, strategy, wait=True)

Users can make queries to it. This tutorial will explore several ways to do this, using the client and CLI.

Using the client

Given an endpoint (which has a model deployed to it), we can make queries as follows:

deployed_model = endpoint.get_deployed_model()
results = deployed_model.predict(test_data)

We can also make queries via cURL requests. An example request is given in the string representation of the endpoint object:

print(endpoint)

# This should print out similar to:
# path: <some-path>
# id: <some-id>
# curl: curl -X POST <prediction-url> -d '' -H "Content-Type: application/json"
# ...

Endpoint metadata

Endpoint query responses will contain metadata about the endpoint configuration in the response headers. For example:

$ curl -H "Access-token: a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6" -X POST https://myenv.verta.ai/api/v1/predict/my-endpoint -d '""' -H "Content-Type: application/json" -i
HTTP/2 200
date: Tue, 13 Dec 2022 05:14:26 GMT
content-type: application/json
content-length: 25
verta-build-id: 453277
verta-endpoint-id: 393054
verta-endpoint-owner-id: 151001
verta-endpoint-owner-name:  myuser_name
verta-endpoint-path: /my-endpoint
verta-model-name: my-model
verta-model-version: v3
verta-request-id: 20c40599-659e-4752-97b0-93afc23a8706

These are the headers currently provided:

  • verta-build-id: The build ID of the registered model being executed by the queried endpoint

  • verta-endpoint-id: The UUID of the endpoint

  • verta-endpoint-owner-id: The UUID of the owner of the endpoint

  • verta-endpoint-owner-name: The name of the owner of the endpoint

  • verta-endpoint-path: The URI path configured for the endpoint

  • verta-model-name: The registered model being executed by the queried endpoint

  • verta-model-version: The version of the registered model being executed by the queried endpoint

  • verta-request-id: The UUID generated by Verta for each prediction request

Last updated