Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch with two restrictions - requests_per_minute and batch_size #982

Open
sebawita opened this issue Mar 26, 2024 · 0 comments
Open

Batch with two restrictions - requests_per_minute and batch_size #982

sebawita opened this issue Mar 26, 2024 · 0 comments

Comments

@sebawita
Copy link

Can we add an option to configure batch with requests_per_minute and batch_size?

This would be useful, when I am limited to i.e. 120 rpms, but also each object is quite big (like when working with images and videos) and the vectorization is slow (so sending 120 objects each time could result in timeouts or network issues).

One example, where I would use this is with multi2vec modules.

source = os.listdir("./source/video/")

animals = client.collections.get("Animals")

with animals.batch.rate_limit(requests_per_minute=100) as batch:
    for name in source:
        print(f"Adding {name}")
        
        path = "./source/video/" + name
    
        batch.add_object({
            "name": name,            # name of the file
            "path": path,            # path to the file to display result
            "video": toBase64(path), # image to vectorize
        })

I would like to add batch_size in there:

source = os.listdir("./source/video/")

animals = client.collections.get("Animals")
with animals.batch.rate_limit(requests_per_minute=100, batch_size=5) as batch:
...
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

No branches or pull requests

1 participant