Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/turbopuffer/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
Loading