Python client configuration
The Client class allows a client to obtain outputs from a Konduit Serving instance given a named set of inputs via the predict() method.
Data formats
Data formats define how data is transported between the Client and the Konduit Serving instance. In addition to JSON
, Konduit Serving also supports NUMPY
, ARROW
, RAW
and IMAGE
data formats. Specify data formats as strings.
input_data_format
defines the data format of inputs sent to the server via thepredict()
method.output_data_format
defines the data format returned by the API endpoint.
If you want to convert the result of your endpoint to another data format on return, change the convert_to_format
attribute of the Client
object:
Input and output names
Both the input_names
and output_names
arguments accept a list of strings. Input and output names are defined by the inputs and outputs to the first and last pipeline steps in the Konduit Serving pipeline configuration respectively.
For ModelStep
, input and output names should be configured when defining the model for training, or may need to be obtained by inspecting the model file. See the examples for details.
For PythonStep
, input names are defined in the step()
method of a PythonStep
object.
Other arguments
timeout
: Integer. Defaults to 60 (seconds).host
: String. If the model is hosted locally, the host should be specified ashttp://localhost
(the default argument)port
: Integer.
The arguments output_data_format
, input_data_format
and prediction_type
are obtained from the server when the Client object is initialized. Refer to the Server documentation for details.
.predict()
method
.predict()
methodThe .predict()
method takes a dictionary withinput_names
as keys and the data inputs as values.
Example
Assume a Server object has been fully configured as server
. Start the server:
Define a Client:
Request for a prediction:
YAML configuration
Refer to the YAML configuration page.
Last updated