Skip to content
API Errors

Document is too long

This error occurs when you're sending a document that exceeds the size limitations of the API.

We advise to use a library to split your text into small chunks. (e.g. with the npm i embedbase-js splitText function)

import { splitText } from 'embedbase-js/dist/main/split';
 
const text = `some very long text`
 
splitText(text, { maxTokens: 500, }, async ({chunk}) => {
    // do whatever you want with the chunks
    // in this case we sent it to https://embedbase.xyz
    const data = await embedbase.dataset('some-data-set').add(chunk)
})

Read more (opens in a new tab)