Repository navigation
feat: [CMPS-1256] add bulk delete_documents to the clients - #239
Merged
Merged
Conversation
Retention policies and other clean-up jobs need to delete many documents
at once. Deleting them one by one costs a request per document; the new
POST /v1/indexes/{index_name}/documents/_delete endpoint takes up to 1000
IDs in a single request and reports per-document status.
The SDK rejects empty or oversized batches client-side and leaves
batching to callers.
luca-cohere
approved these changes
Oct 6, 2026
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.
SDK counterpart for the API change for supporting bulk deletion of documents.
[🤖 Rafid's Bot · opencode · cohere-llm-gateway/claude-opus-5-5] Everything below this line is AI generated.
Adds
delete_documents(*, index_name, document_ids, ...)toCompassClientandCompassAsyncClient, for the new Compass endpointPOST /v1/indexes/{index_name}/documents/_delete(cohere-ai/compass#3542). Retention jobs can then delete up to 1,000 documents in a single request instead of sending one request per document.DeleteDocumentsResult, which gives each unique ID a status ofdeletedornot_found.MAX_BULK_DELETE_DOCUMENT_IDS = 1000is exported fromcohere_compass.constants. An empty list, or more than 1,000 IDs, raisesValueErrorbefore any request is sent. Callers do their own batching.examples/fern_documentation/python/core/delete_docs.pyis the target of the endpoint's OpenAPIx-codeSampleslink.Merge order: the API PR should land first. Before then, calling this method returns 404.
Tested with mocked-HTTP tests for both clients, plus a manual round trip of the sync and async clients against a local API built from the compass branch.
CMPS-1256