Skip to content

Commit

Permalink
Better error resilience. (#538)
Browse files Browse the repository at this point in the history
* Better error resilience.

* Updated for pr feedback.
  • Loading branch information
squidarth authored Aug 10, 2023
1 parent e1da8a5 commit 0d299e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "truss"
version = "0.5.7rc2"
version = "0.5.7rc3"
description = "A seamless bridge from model development to model delivery"
license = "MIT"
readme = "README.md"
Expand Down
7 changes: 7 additions & 0 deletions truss/remote/baseten/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def decode_content():

return decode_content()

parsed_response = response.json()

if "error" in parsed_response:
# In the case that the model is in a non-ready state, the response
# will be a json with an `error` key.
return parsed_response

return response.json()["model_output"]

def authenticate(self) -> dict:
Expand Down

0 comments on commit 0d299e3

Please sign in to comment.