replicate/replicate-python

Bug: parsing error when creating prediction with stream=True

joehoover opened this issue · 1 comments

I tried to set stream=True when creating a prediction like:

prediction = replicate.predictions.create(
    version=version, 
    input={'tps':10},
    stream=True
)

and received the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/joe/.pyenv/versions/3.10.9/envs/lm-infra-sims/lib/python3.10/site-packages/replicate/prediction.py", line 210, in create
    resp = self._client._request(
  File "/Users/joe/.pyenv/versions/3.10.9/envs/lm-infra-sims/lib/python3.10/site-packages/replicate/client.py", line 81, in _request
    raise ReplicateError(resp.json()["detail"])
replicate.exceptions.ReplicateError: Failed to parse request body as JSON: json: cannot unmarshal string into Go struct field Prediction.stream of type bool
>>> 

Assuming there's not user error and/or this isn't already fixed, happy to open a PR.

@joehoover Thanks for reporting this, and apologies for the inconvenience. This is resolved by #178, and is fixed in version 0.15.5.