Skip to content

Encode NumPy boolean scalars in prediction inputs - #482

Open
Twiink wants to merge 1 commit into
replicate:mainfrom
Twiink:fix/numpy-boolean-input-20261127-r3
Open

Twiink wants to merge 1 commit into
replicate:mainfrom
Twiink:fix/numpy-boolean-input-20261127-r3

Conversation

@Twiink

@Twiink Twiink commented Nov 27, 2026

Copy link
Copy Markdown

A boolean option computed from NumPy data can be a numpy.bool_. Passing it in a prediction input currently raises TypeError when the JSON request body is encoded. NumPy boolean scalars do not enter the existing integer or floating-point branches.

Convert these scalars to Python bool in the synchronous and asynchronous encoders. The optional NumPy dependency remains optional. The regression checks true and false values, including a nested list, using a JSON encode/decode round trip.

With NumPy installed, the full local suite passed with 160 tests and 6 skips. Ruff lint and format checks passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant