Skip to content

InferenceRequest converting to dict is not documented on the Codecs page #958

Description

@smolendawid

I had the problem:

TypeError: Object of type InferenceRequest is not JSON serializable

with code similar to this:

request = PandasCodec.encode_request(data)

endpoint = ""
response = requests.post(endpoint, json=request)

Since the requests library doesn't know how to serialise an InferenceRequest object, it is needed to convert it to a dict, which is the expected value of the json kwarg on requests.post. We can do this with request.dict().

It would be useful if we can document it better on this page:
https://mlserver.readthedocs.io/en/latest/user-guide/content-type.html

because I think the problem with input data / codecs is a big blocker for many people that want to try mlserver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions