Class InferenceResponse

Class Documentation

class InferenceResponse

Creates an inference response object based on KServe’s V2 spec that is used to respond back to clients.

Public Functions

InferenceResponse()

Constructs a new InferenceResponse object.

explicit InferenceResponse(const std::string &error)

Constructs a new InferenceResponse error object.

std::vector<InferenceResponseOutput> getOutputs() const

Gets a vector of the requested output information.

void addOutput(const InferenceResponseOutput &output)

Adds an output tensor to the response.

Parameters

output – an output tensor

inline std::string getID() const

Gets the ID of the response.

void setID(const std::string &id)

Sets the ID of the response.

void setModel(const std::string &model)

sets the model name of the response

std::string getModel()

gets the model name of the response

bool isError() const

Checks if this is an error response.

std::string getError() const

Gets the error message if it exists. Defaults to an empty string.

inline RequestParameters *getParameters()

Gets a pointer to the parameters associated with this response.

Friends

inline friend std::ostream &operator<<(std::ostream &os, InferenceResponse const &my_class)

Provides an implementation to print the class with std::cout to an ostream.