Skip to content

Update Python client to support batch insert and search#80

Open
peopleig wants to merge 1 commit into
refactorfrom
client-batch
Open

Update Python client to support batch insert and search#80
peopleig wants to merge 1 commit into
refactorfrom
client-batch

Conversation

@peopleig

Copy link
Copy Markdown
Contributor

batch_insert() takes a list of (DenseVector, Payload) tuples

batch_search() supports multiple formats of input

  • List of SearchQuery objects
  • List of (DenseVector, Similarity, Limit) tuples
  • List of (DenseVector, Similarity) tuples with a global Limit
  • List of (DenseVector, Limit) tuples with a global Similarity
  • List of DenseVector with global Similarity and Limit

SearchQuery model introduced because using tuples will get cumbersome if the number of fields in a query were to increase

@peopleig peopleig requested a review from SK1PPR June 13, 2026 00:05
@peopleig

Copy link
Copy Markdown
Contributor Author

Very similar to SK1PPR's batch insert and search implementation.
But with slightly stricter checks and multiple input format support. Added tests.

Point,
Similarity,
SearchQuery,
to_dense_vectors,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this to __all__

@SK1PPR

SK1PPR commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Also can we add batch support for the Async client as well?

We can also add a test like:

from vortexdb.client import VortexDB
from vortexdb.async_client import AsyncVortexDB


IGNORED_METHODS = {
    "__enter__",
    "__exit__",
    "__aenter__",
    "__aexit__",
}


def public_methods(cls):
    return {
        name
        for name, value in cls.__dict__.items()
        if callable(value)
        and not name.startswith("_")
        and name not in IGNORED_METHODS
    }


def test_sync_async_client_api_parity():
    sync_methods = public_methods(VortexDB)
    async_methods = public_methods(AsyncVortexDB)

    assert sync_methods == async_methods, (
        "Sync and async clients expose different APIs. "
        f"Only sync: {sorted(sync_methods - async_methods)}. "
        f"Only async: {sorted(async_methods - sync_methods)}."
    )

So that if there's a public api for one it should be present for the other, avoiding drift

@peopleig

Copy link
Copy Markdown
Contributor Author

Yes, sorry, I forgot to update it here, I was sleepy.
I made a PR which resolves the merge conflicts and also adds batch support to the async client: #85 . We can continue on that one
I'll add the parity check in tests/

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.

2 participants