Spaces:
Runtime error
Runtime error
CIP-5: Large Batch Handling Improvements Proposal
Status
Current Status: Under Discussion
Motivation
As users start putting Chroma in its paces and storing ever-increasing datasets, we must ensure that errors
related to significant and potentially expensive batches are handled gracefully. This CIP proposes to add a new
setting, max_batch_size API, on the local segment API and use it to split large batches into smaller ones.
Public Interfaces
The following interfaces are impacted:
- New Server API endpoint -
/pre-flight-checks - New
max_batch_sizeproperty on theAPIinterface - Updated
_add,_updateand_upsertmethods onchromadb.api.segment.SegmentAPI - Updated
_add,_updateand_upsertmethods onchromadb.api.fastapi.FastAPI - New utility library
batch_utils.py - New exception raised when batch size exceeds
max_batch_size
Proposed Changes
We propose the following changes:
- The new
max_batch_sizeproperty is now available in theAPIinterface. The property relies on the underlyingProducerclass to fetch the actual value. The property will be implemented by bothchromadb.api.segment.SegmentAPIandchromadb.api.fastapi.FastAPI chromadb.api.segment.SegmentAPIwill implement themax_batch_sizeproperty by fetching the value from theProducerclass.chromadb.api.fastapi.FastAPIwill implement themax_batch_sizeby fetching it from a new/pre-flight-checksendpoint on the Server.- New
/pre-flight-checksendpoint on the Server will return a dictionary with pre-flight checks the client must fulfil to integrate with the server side. For now, we propose using this only formax_batch_size, but we can add more checks in the future. The pre-flight checks will be only fetched once per client and cached for the duration of the client's lifetime. - Updated
_add,_updateand_upsertmethod onchromadb.api.segment.SegmentAPIto validate batch size. - Updated
_add,_updateand_upsertmethod onchromadb.api.fastapi.FastAPIto validate batch size (client-side validation) - New utility library
batch_utils.pywill contain the logic for splitting batches into smaller ones.
Compatibility, Deprecation, and Migration Plan
The change will be fully compatible with existing implementations. The changes will be transparent to the user.
Test Plan
New tests:
- Batch splitting tests for
chromadb.api.segment.SegmentAPI - Batch splitting tests for
chromadb.api.fastapi.FastAPI - Tests for
/pre-flight-checksendpoint
Rejected Alternatives
N/A