You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a bento with an endpoint that takes a PandasDataFrame. I'm using .from_sample to provide example data. Now when I actually try to make network requests against that endpoint passing JSON data I get an exception:
Traceback (most recent call last):
File "/Users/mike.kuhlen/.virtualenvs/alyssum-bento/lib/python3.8/site-packages/bentoml/_internal/server/http_app.py", line 311, in api_func
input_data = await api.input.from_http_request(request)
File "/Users/mike.kuhlen/.virtualenvs/alyssum-bento/lib/python3.8/site-packages/bentoml/_internal/io_descriptors/pandas.py", line 520, in from_http_request
assert not isinstance(self._dtype, bool)
AssertionError
The solution would seem to be to either not default to self._dtype = True (a) or to remove the assertion (b). Happy to submit a PR, but please let me know which of these options you would prefer.
Thank you! When adding dtype validation, it would be great to continue to honor enforce_dtype. Imo, simply providing sample data should not automatically turn that on. (This is the current status quo, just saying that I would like to maintain that.)
Describe the bug
I have a bento with an endpoint that takes a
PandasDataFrame
. I'm using.from_sample
to provide example data. Now when I actually try to make network requests against that endpoint passing JSON data I get an exception:The reason for this error is that (a) using
.from_sample
setsself._dtype = True
(https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/io_descriptors/pandas.py#L421-L422), yet (b) infrom_http_request
we have an assertion thatself._dtype
may not be of typebool
(https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/io_descriptors/pandas.py#L519-L520).The solution would seem to be to either not default to
self._dtype = True
(a) or to remove the assertion (b). Happy to submit a PR, but please let me know which of these options you would prefer.To reproduce
No response
Expected behavior
No response
Environment
Environment variable
System information
bentoml
: 1.0.10python
: 3.8.14platform
: macOS-12.6-x86_64-i386-64bituid_gid
: 502:20pip_packages
The text was updated successfully, but these errors were encountered: