Skip to content
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

fix: client response deserialization when the output is string #4762

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/_bentoml_impl/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,15 @@ def is_file_field(k: str) -> bool:

def _deserialize_output(self, payload: Payload, endpoint: ClientEndpoint) -> t.Any:
data = iter(payload.data)
if endpoint.output_spec is not None:
if (ot := endpoint.output.get("type")) == "string":
return bytes(next(data)).decode("utf-8")
elif ot == "bytes":
return bytes(next(data))
elif endpoint.output_spec is not None:
model = self.serde.deserialize_model(payload, endpoint.output_spec)
if isinstance(model, RootModel):
return model.root # type: ignore
return model
elif (ot := endpoint.output.get("type")) == "string":
return bytes(next(data)).decode("utf-8")
elif ot == "bytes":
return bytes(next(data))
else:
return self.serde.deserialize(payload, endpoint.output)

Expand Down
Loading