feat(targets): add Turbopuffer target connector#1647
Open
costajohnt wants to merge 3 commits intococoindex-io:mainfrom
Open
feat(targets): add Turbopuffer target connector#1647costajohnt wants to merge 3 commits intococoindex-io:mainfrom
costajohnt wants to merge 3 commits intococoindex-io:mainfrom
Conversation
Add a new target connector for Turbopuffer vector database. The implementation follows the same pattern as the ChromaDB connector with turbopuffer-specific adaptations: - Namespaces are created implicitly on first write (no explicit setup) - distance_metric is passed on every upsert call - Row-oriented write format via ns.write(upsert_rows=[...]) - Supports cosine, euclidean, and dot product distance metrics Includes 30 unit tests covering all connector logic and helper functions, with no turbopuffer account required. Closes cocoindex-io#1562
58d9ee3 to
f4d2cb3
Compare
Member
|
thanks a lot @costajohnt john! we'll get to this shortly! |
Author
sounds good, thanks @badmonster0 |
Move the top-level `import turbopuffer` behind a TYPE_CHECKING guard and add a _get_turbopuffer() helper for runtime imports. This matches the existing pattern in the doris connector and fixes CI failures where turbopuffer is not installed in the CI dependency group. Also run `uv lock` to include turbopuffer and sniffio in the lock file.
georgeh0
approved these changes
Feb 16, 2026
Member
georgeh0
left a comment
There was a problem hiding this comment.
Most parts look good! Left one minor comment. Thanks!
Comment on lines
+260
to
+271
| # Execute upserts | ||
| if rows_to_upsert: | ||
| context.namespace.write( | ||
| upsert_rows=rows_to_upsert, | ||
| distance_metric=context.distance_metric, | ||
| ) | ||
|
|
||
| # Execute deletes | ||
| if ids_to_delete: | ||
| context.namespace.write( | ||
| deletes=ids_to_delete, | ||
| ) |
Member
There was a problem hiding this comment.
If they support upserts and deletes happening in the same call, we can merge them, to make these mutations happen atomically.
Author
There was a problem hiding this comment.
thanks @georgeh0 sorry for the late reply. i missed this comment. pushed a refactor
Combine the separate upsert and delete write() calls into a single atomic call, since turbopuffer supports both upsert_rows and deletes in the same write request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
python/cocoindex/targets/turbopuffer.py— Connector implementation withTurbopufferspec class and_Connectorwith all 7 required static methodspython/cocoindex/tests/targets/test_turbopuffer_unit.py— Unit tests for persistent key, setup state validation, state compatibility, describe, and all helper functionspyproject.toml— Addedturbopufferoptional dependency, added toallgroup, added to mypy ignore listTest plan
ruff checkpasses with no issuesmypypasses with no issuespytest python/cocoindex/tests/targets/test_turbopuffer_unit.py -v— 30/30 tests passpython -c "import cocoindex.targets.turbopuffer"succeedsCloses #1562