Document Collections

Add Document Chunks To Collection

POST

/ Add the specified document chunks to a document collection. Credal automatically runs the collection’s embeddings model on each chunk.

Request

This endpoint expects an object.
documentId
UUIDRequired
documentCollectionId
UUIDRequired
chunks
list of stringsRequired
The document chunks to add to the document collection. Credal will run the collection's embeddings model on each chunk.
customMetadata
map from strings to stringsRequired
The custom metadata for the document. The fields must match the custom metadata schema for the document collection.
POST
$curl -X POST https://api.credal.ai/api/v0/documentCollections/addDocumentChunksToCollection \
> -H "Authorization: Bearer <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "documentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
> "documentCollectionId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
> "chunks": [
> "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
> "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
> "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
> ],
> "customMetadata": {
> "customerName": "Credal",
> "meetingDate": "2023-11-06T23:03:42.056Z"
> }
>}'