From 6933a8bf8a6babf9ea986aad954a4f348723c5e7 Mon Sep 17 00:00:00 2001 From: Roko Date: Tue, 22 Sep 2026 20:57:38 -0700 Subject: [PATCH] fix: don't base64-encode vector arrays --- src/turbopuffer/_utils/_transform.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/turbopuffer/_utils/_transform.py b/src/turbopuffer/_utils/_transform.py index 25e3c643..ac2c41de 100644 --- a/src/turbopuffer/_utils/_transform.py +++ b/src/turbopuffer/_utils/_transform.py @@ -182,10 +182,11 @@ class Params(TypedDict, total=False): It should be noted that the transformations that this function does are not represented in the type system. """ # turbopuffer: Use simple vector encoding instead of generic type-based transform. - data = cast(_T, _turbopuffer_transform(data)) + # Encode vectors before walking the body so the walk sees one base64 string + # per vector instead of recursing into every float. if expected_type is NamespaceWriteParams: - return cast(_T, _encode_write_vectors(data)) - return data + data = cast(_T, _encode_write_vectors(data)) + return cast(_T, _turbopuffer_transform(data)) @lru_cache(maxsize=8096) @@ -404,10 +405,11 @@ class Params(TypedDict, total=False): It should be noted that the transformations that this function does are not represented in the type system. """ # turbopuffer: Use simple vector encoding instead of generic type-based transform. - data = cast(_T, _turbopuffer_transform(data)) + # Encode vectors before walking the body so the walk sees one base64 string + # per vector instead of recursing into every float. if expected_type is NamespaceWriteParams: - return cast(_T, _encode_write_vectors(data)) - return data + data = cast(_T, _encode_write_vectors(data)) + return cast(_T, _turbopuffer_transform(data)) async def _async_transform_recursive(