add()
Add a single document.Signature
Parameters
Example
Errors
addMany()
Add multiple documents in a batch.Signature
Parameters
Example
Errors
Validation
addMany performs these validations before processing:
- No duplicate IDs within the batch
- No IDs that already exist in the database
- All texts are non-empty
- All texts are within
maxDocumentSize - Batch size doesn’t exceed
maxBatchSize - All
metadata.idvalues match document IDs
Performance
addManyis significantly faster than callingaddin a loop due to batch embedding generation.- Embeddings are generated at ~100-200 documents/second.
- Use appropriate
maxBatchSizeto avoid memory spikes.
Related
search()
Query documents
update()
Update documents
remove()
Remove documents