Doc Chunker
Convert audio, video, PDFs, images, and Office documents into text chunks for your vector stores.
Doc Chunker is an optional DeepFellow component that turns diverse knowledge sources into clean, searchable text. It converts documents, presentations, spreadsheets, images, audio, and video into text and splits that text into chunks ready for embedding.
The connection between Doc Chunker and vector stores is still under development.
DeepFellow converts your files, splits them into chunks, and embeds those chunks for search. Retrieve the original text of any chunk, its neighboring context, or the whole reconstructed file with the chunk fragment endpoint.
What You Can Convert
Doc Chunker handles a wide range of formats.
- Documents and Markup:
pdf,docx,pptx,xlsx,html,md. OCR is enabled by default and extracts text from scanned PDFs and images embedded in documents. - Legacy Office formats:
doc,ppt,xls,odt,odp,ods,rtf. Doc Chunker converts these with LibreOffice before parsing. - Images:
png,jpg,jpeg,tiff,bmp. OCR reads text from the image. Optional image description adds a natural-language summary of the picture. - Audio:
mp3,wav,m4a,ogg,flac,opus,aac,wma. Doc Chunker transcribes speech to text through a speech-to-text model. - Video:
mp4,mkv,mov,avi,webm. Doc Chunker extracts the audio track and transcribes it.
Doc Chunker handles any other file type in two steps. First it tries to read the file as plain text.
If that succeeds, the text becomes a document whose paragraphs are split on blank lines. If it fails,
Doc Chunker falls back to Apache Tika, which is what happens with a format such as epub.
A file that reads as plain text, such as csv, txt, json, or yaml, never reaches Apache Tika
and never gets a structured layout. A csv file becomes flat text rather than a table, so its rows
and columns carry no structure into the chunks.
Audio and video transcription requires a speech-to-text model. Image descriptions require a vision-language model. Both reach the model through an inference gateway that you configure on the container. See Inference Gateway.
Install Doc Chunker
Install Doc Chunker from the Infra Web Panel as a model of the custom service.
In the services view, locate the custom service and open model list.
Find the doc_chunker model and open its configuration form.
Set the required fields: endpoint prefix, hardware, and the inference gateway URL.
The default prefix is doc_chunker, which exposes Doc Chunker at /custom/doc_chunker. The gateway
URL, INFRA_API_URL, arrives prefilled with http://infra:8086, the address of the gateway in a
standard deployment.
Set the environment variables you need, described in Container Configuration.
The defaults work for every format. If INFRA_API_URL points at this Infra, leave INFRA_API_KEY
empty: Infra fills in its own API key when it creates the container. For any other gateway that
requires a key, set INFRA_API_KEY yourself.
Leave "Docker image version" empty to install the image DeepFellow ships with your Infra release. Set it to a tag to pin a different image.
Leave the proxy timeout empty to use the Doc Chunker default of 7200 seconds. DeepFellow Server runs
each conversion as a Doc Chunker job: it submits the file, reads the job status every few seconds,
and downloads the result when the job ends. No gateway request lasts for the whole conversion, so the
proxy timeout only has to cover one upload or one result download. A Doc Chunker image without the job
API converts each file in one request, and the gateway cuts off any conversion that runs longer than
the proxy timeout. For such an image, keep the proxy timeout at or above
doc_chunker_convert_timeout_seconds. See Proxy Timeout and
Conversion Timeouts.
Click "Install". DeepFellow selects the CPU or GPU image automatically based on your hardware.
After a while, the model will appear with the green "Installed" label.
The GPU image needs about 15 GB of disk space and runs much faster. The CPU image needs about 5 GB. The form declares 15 GB for both, so the figure it shows for the CPU image is too high.
Doc Chunker needs no internet access. The OCR, layout, and table structure models ship in the image, so Doc Chunker converts documents, scanned PDFs included, without downloading a model. Image description and audio transcription still call the inference gateway.
Doc Chunker needs about 5 GB of RAM plus about 2.4 GB for each worker slot, about 9.7 GB with 2
slots, and refuses to start on a host with less. Leave MAX_CONCURRENT empty to let Doc Chunker
start as many slots as fit, or set it lower on a small host. Doc Chunker always starts at least one
slot, so a host with less than about 7.3 GB of RAM doesn't run it at all. See
Memory Estimate.
DeepFellow Server routes every file to Doc Chunker, whether or not the model is installed. With no
model behind it, the endpoint prefix resolves to nothing, and the Infra gateway answers 400 with
{"error": {"message": "Given url is not supported", "type": "invalid_request_error"}}.
POST /v1/vector_stores/{vector_store_id}/files still answers 200, because it only queues the
file. Ingestion runs in the background, so the failure surfaces on the file itself: its status
becomes failed, and last_error carries the gateway's message. The synchronous paths,
GET /v1/files/{file_id}/text and POST /text_converter/text, return the error directly, and
GET /v1/files/{file_id}/text/async returns it on the next request.
Install Doc Chunker before you add files to a vector store.
Doc Chunker Settings
Installing the model exposes the Doc Chunker endpoint. DeepFellow Server reads the following settings to route vector store files through it.
Doc Chunker itself holds no model configuration, and every request names the model it needs. These settings control what DeepFellow Server sends to Doc Chunker and how long it waits for an answer.
doc_chunker_prefix: Endpoint prefix the server uses to reach Doc Chunker. It must match the prefix you set when you installed the model. Defaultdoc_chunker.doc_chunker_picture_description_model: Vision-language model that describes the images of a document. DeepFellow Server calls it through DeepFellow Infra, as described in Image Descriptions in DeepFellow Server. The server does not pass it to Doc Chunker. Defaultgemma4:e4b.doc_chunker_stt_model: Speech-to-text model the server sends as thestt_modelparameter with every conversion. Doc Chunker uses it only for audio and video. DefaultSystran/faster-whisper-large-v3.doc_chunker_convert_timeout_seconds: Seconds the server waits for one conversion to finish, including the time the file waits in Doc Chunker's queue. It applies to every conversion: vector store ingestion, Document Summarization, Knowledge Graph ingestion, and file text retrieval. When the time runs out, the request fails with504. Default7200.doc_chunker_poll_interval_seconds: Seconds between two reads of a conversion job's status. Default5.doc_chunker_request_timeout_seconds: Seconds one file upload or one result download takes at most. It does not limit the conversion itself. Default300.doc_chunker_chunk_timeout_seconds: Seconds the server waits when it asks Doc Chunker to chunk a document that is already converted. When the time runs out, the request fails with504. Default300, maximum600.
All seven are dynamic settings, so a change applies immediately and never needs a restart:
deepfellow server config set doc_chunker_prefix=doc_chunkerThe Doc Chunker section of the Server Web Panel holds all seven:
doc_chunker_prefix as Prefix, doc_chunker_picture_description_model as Picture Description
Model, doc_chunker_stt_model as Speech-to-Text Model, doc_chunker_convert_timeout_seconds
as Conversion Timeout (seconds), doc_chunker_poll_interval_seconds as Conversion Poll
Interval (seconds), doc_chunker_request_timeout_seconds as Request Timeout (seconds), and
doc_chunker_chunk_timeout_seconds as Chunking Timeout (seconds).
The matching environment variables, DF_DOC_CHUNKER_PREFIX,
DF_DOC_CHUNKER_PICTURE_DESCRIPTION_MODEL, DF_DOC_CHUNKER_STT_MODEL,
DF_DOC_CHUNKER_CONVERT_TIMEOUT_SECONDS, DF_DOC_CHUNKER_POLL_INTERVAL_SECONDS,
DF_DOC_CHUNKER_REQUEST_TIMEOUT_SECONDS, and DF_DOC_CHUNKER_CHUNK_TIMEOUT_SECONDS, only seed these
settings on the server's first start.
After that the values live in the server's configuration file, and setting the environment variable
will have no effect. Use the Server Web Panel or PUT /admin/config instead.
Conversion Timeouts
A conversion of a large file, such as a long recording or a PDF with many pictures, takes up to about an hour. Five timeouts apply to it, and each one must be at least as long as the one it wraps. Otherwise an outer layer cuts the conversion short or runs it a second time:
| Timeout | Where it is set | Default |
|---|---|---|
DOCUMENT_TIMEOUT | DeepFellow Infra install form of the doc_chunker model. Caps the conversion stage inside Doc Chunker. For a PDF converted in page ranges, it caps each range. | 3600 |
doc_chunker_convert_timeout_seconds | DeepFellow Server dynamic setting. Caps a whole conversion: the wait in Doc Chunker's queue, the conversion, and the image descriptions. | 7200 |
proxy_timeout_seconds of the doc_chunker install | DeepFellow Infra install form. Caps one gateway request. It matters here only for a Doc Chunker image without the job API, where one request carries the whole conversion. | 7200 |
nightshift_jobs_timeout_seconds | DeepFellow Server dynamic setting. Caps a Nightshift job step: the conversion plus the model calls after it. | 10800 |
RabbitMQ consumer_timeout | RabbitMQ broker. Caps how long a message stays unacknowledged before the broker redelivers it. | 4h in the bundled compose.yaml, 30 min on a stock broker |
To convert files that take longer than the defaults allow, raise them together and keep them in this order. For more on the last two, see Nightshift Background Jobs.
A conversion that runs out of DOCUMENT_TIMEOUT fails with 422. Doc Chunker never returns the
pages it converted before the time ran out. The same applies when Docling fails to convert some of
the pages: the whole conversion fails, and the error lists the pages that failed. If no page failed,
the error names DOCUMENT_TIMEOUT as the likely cause. Vector store ingestion and Nightshift jobs
receive the same 422.
If long PDFs fail with this error, raise DOCUMENT_TIMEOUT. For a PDF converted in page ranges,
it applies to each range, as described in Long PDFs.
If DeepFellow Server or a Nightshift worker stops during a conversion, the retry resumes the same
Doc Chunker job instead of converting the file again. If Doc Chunker's job queue is full, Doc
Chunker no longer holds the job, or the instance that holds the job stays unavailable, the
conversion fails with 503, and Nightshift retries it. For the last case, see
Several Doc Chunker Instances.
A doc_chunker install that left proxy_timeout_seconds empty picks up the 7200-second default on
the next DeepFellow Infra restart. DOCUMENT_TIMEOUT is saved with the install, so an install made
with the earlier 600 default keeps it. To raise it, change it in Edit Settings on the model's
card in the Infra Web Panel, or reinstall the model.
Several Doc Chunker Instances
When several instances of the doc_chunker model run, locally or across a Mesh, DeepFellow Server
keeps each conversion job on the instance that holds it. It reads the route from the X-DF-Route
header of the job submission response and saves the route with the job. Every later request of the
job carries the route: each status read, the result download, and the removal of the job. DeepFellow
Infra sends these requests straight to the instance that holds the job. For how routes work, see
Send Requests to One Instance.
This needs no configuration on DeepFellow Server. It needs a DeepFellow Infra version that supports
X-DF-Route. With an older DeepFellow Infra, the submission response carries no route, and
DeepFellow Infra picks an instance for every request of the job. If a status read reaches an
instance that doesn't hold the job, DeepFellow Server takes the job for lost, and the file is
converted again.
If the instance that holds the job becomes unavailable, DeepFellow Infra answers the status read
with 503 and the route_unavailable error code. DeepFellow Server keeps reading the status. If 10
reads in a row return route_unavailable, which takes about 45 seconds with the default
doc_chunker_poll_interval_seconds, DeepFellow Server takes the job for lost. The conversion fails
with 503, and the retry uploads the file again, so another instance converts it from the start.
If only some of the 10 failed reads return route_unavailable, the conversion fails with 502.
DeepFellow Server then keeps the job, so the next conversion of the same file resumes it.
Update Doc Chunker
Updating DeepFellow Infra does not update an installed Doc Chunker. To move it to a newer image, click Update in the ⋮ menu of the doc_chunker card in the Infra Web Panel, or run deepfellow infra model update custom doc_chunker in the CLI. deepfellow infra model versions custom doc_chunker lists the available versions. See Updates.
The update recreates the container, so register your tokenizers again afterward. See Data Storage.
An update keeps the MAX_CONCURRENT saved with the installation. A Doc Chunker installed before
v2.5.0 has MAX_CONCURRENT set to 2, and from v2.5.0 on it needs about 9.7 GB of RAM to start
with 2 slots. On a host with less memory, click Edit Settings in the ⋮ menu, lower
MAX_CONCURRENT or clear it, and select the new version in Docker image version. See
Memory Estimate.
Container Configuration
Set these environment variables on the Doc Chunker model in the Infra Web Panel.
Configuration Options
The Doc Chunker installation form exposes the following fields.
Processing
| Variable | Description | Default |
|---|---|---|
MAX_CONCURRENT | Number of worker slots. Each slot runs one conversion or one chunking at a time, whether it comes from /convert, /chunk, or a conversion job. Each slot has its own Docling worker, which takes memory even when idle. See Worker Slots and Memory Estimate. Leave it empty to let Doc Chunker size it from the available memory and the CPU count. | Empty, shown as auto |
DOCUMENT_TIMEOUT | Maximum time in seconds for a single conversion, or for one page range of a long PDF. A conversion that runs out of it fails. Keep it below the server's doc_chunker_convert_timeout_seconds. See Conversion Timeouts. | 3600 |
LIBREOFFICE_TIMEOUT | Maximum time in seconds LibreOffice gets to convert one legacy Office file. | 120 |
The defaults work for every format listed in What You Can Convert. Doc Chunker holds further timeouts for its Apache Tika and Docling backends, and the form leaves them at their defaults.
LibreOffice Backend
Doc Chunker converts the legacy Office formats with LibreOffice. In the
Docker images, Doc Chunker keeps one LibreOffice service running, unoserver, and sends it every
file. That service runs on the Python that ships inside LibreOffice. On macOS, that Python starts
only when LibreOffice itself launches it, so unoserver fails to start there.
If you run Doc Chunker outside the Docker images, on a Mac for example, set LIBREOFFICE_BACKEND to
soffice. Doc Chunker then starts LibreOffice for every legacy Office file, which takes about a
second a file.
| Variable | Description | Default |
|---|---|---|
LIBREOFFICE_BACKEND | unoserver keeps one LibreOffice service running. soffice starts LibreOffice for every file and needs the soffice command on the PATH. Doc Chunker doesn't start with any other value. | unoserver |
Doc Chunker doesn't pick the value from the platform, so you set it for each deployment. The Docker
images keep unoserver, also when Docker runs them on a Mac.
The Infra install form doesn't expose LIBREOFFICE_BACKEND, so an install from the
Infra Web Panel always uses unoserver.
Worker Slots
/convert, /chunk, and conversion jobs share the
MAX_CONCURRENT worker slots. Each slot has a role, which decides what it takes first when it
frees up.
| Slot | Takes First | Then |
|---|---|---|
Async-priority, set by ASYNC_PRIORITY_WORKERS | A conversion job | /convert and /chunk |
Sync-only, set by SYNC_ONLY_WORKERS | /convert and /chunk | Nothing else |
| Every other slot | /convert and /chunk | A conversion job |
Waiting work of one kind runs in arrival order.
| Variable | Description | Default |
|---|---|---|
ASYNC_PRIORITY_WORKERS | Number of async-priority slots. | 1, or 0 when MAX_CONCURRENT is 1 |
SYNC_ONLY_WORKERS | Number of sync-only slots. | 0 |
With 2 slots, one slot prefers conversion jobs and the other prefers /convert and
/chunk. While jobs wait in the queue, /convert and /chunk effectively have one slot.
Doc Chunker refuses to start unless ASYNC_PRIORITY_WORKERS plus SYNC_ONLY_WORKERS is at most
MAX_CONCURRENT, and each of the two is below MAX_CONCURRENT. Then at least one slot takes
/convert and /chunk first, and at least one slot takes conversion jobs.
When no /convert or /chunk request waits, every slot that isn't sync-only takes a conversion
job. A /convert request that arrives then waits until one of those jobs finishes, which takes up
to an hour. DeepFellow Server sends every conversion through /convert, so vector store ingestion
waits too. To keep one slot free for /convert and /chunk at all times, set SYNC_ONLY_WORKERS
to 1. Conversion jobs then get one slot fewer.
The Infra install form exposes neither ASYNC_PRIORITY_WORKERS nor SYNC_ONLY_WORKERS, so an
install from the Infra Web Panel runs with their defaults.
Long PDFs
Doc Chunker converts a PDF longer than PDF_SPLIT_PAGES pages in page ranges, to limit the peak
memory of the Docling worker that converts it. Each range is a separate worker job, and Doc Chunker
merges the results into one document. The response has the same shape as for a PDF converted
whole, so the split is invisible to the caller.
The ranges are even, and none of them keeps more than PDF_SPLIT_PAGES pages. Each range also
converts PDF_SPLIT_OVERLAP pages past the pages it keeps, so an item that runs across a range
boundary, up to PDF_SPLIT_OVERLAP + 1 pages long, is converted whole. A range therefore converts
up to PDF_SPLIT_PAGES + PDF_SPLIT_OVERLAP pages. With the defaults, a 150-page PDF converts in two
ranges: pages 1–79, which keeps pages 1–75, and pages 76–150.
A table that spans pages stays as separate table items, the same as in a PDF converted whole, because Docling never merges tables across pages.
Each range gets its own DOCUMENT_TIMEOUT.
| Variable | Description | Default |
|---|---|---|
PDF_SPLIT_PAGES | Largest number of pages Doc Chunker converts as one job. A longer PDF is converted in page ranges that keep at most this many pages each. 0 converts every PDF whole. | 100 |
PDF_SPLIT_OVERLAP | Number of extra pages each range converts past its own. | 4 |
DOCLING_WORKER_RAM_MB | Estimated memory of one Docling worker in MB. Doc Chunker uses it only as the default of DOCLING_ADMISSION_MIN_FREE_RAM_MB, the free memory a conversion waits for before it starts on a host that doesn't report memory pressure. The default fits 100-page ranges, which peak at about 3.8 GB in a fresh worker. | 4500 |
DOCLING_WORKER_JOB_PEAK_MB | How far one job raises a worker's memory above where the previous job left it, in MB. A worker retires once its memory after a job plus this value would exceed its memory budget, so the next job's peak stays within the budget. 0 retires a worker only once its memory itself exceeds the budget. | 1300 |
Memory Estimate
Before a conversion takes a worker slot, Doc Chunker probes the file, without converting it, for the features its memory use depends on: the page count and image megapixels of a PDF, the pixels of an image, the pictures and slides of an Office document, the cells of a spreadsheet, the length of audio and video, and the size of any other file. From these features, Doc Chunker estimates how much memory the conversion needs.
Doc Chunker compares the estimate with a fixed capacity:
- The container's memory limit, or
MEMORY_CAPACITY_MAX_MBwhen that is lower. - Minus
MEMORY_SAFE_ZONE_MB. - Minus the fixed costs: Doc Chunker's main process, Apache Tika, and LibreOffice at rest, plus every
Docling worker counted warm, with its PDF models loaded, plus
PROBE_CONCURRENCYprobes.
The capacity doesn't depend on what else is running, so the same file always gets the same answer.
A file whose estimate exceeds the capacity doesn't fit even an idle instance, and Doc Chunker
refuses it at once with 413 and the detail insufficient_memory. Retrying it on the same instance
won't help, but an instance with more memory will convert it. A file that fits waits for a worker
slot as usual. A conversion job is probed in the background after it is accepted, as described in
Convert a File in the Background.
When the probe fails or runs out of PROBE_TIMEOUT_S, for example on a corrupt or encrypted PDF,
the file goes ahead without an estimate. The log states the reason.
The memory limit is the container's cgroup memory limit. Without one, Doc Chunker uses
DOCLING_MEMORY_LIMIT_MB, and without that, the host's total memory, regardless of what else runs
on the host. On a shared host, set a memory limit on the container or set DOCLING_MEMORY_LIMIT_MB.
Choose the Memory Limit
To start, Doc Chunker needs room for its own processes, every warm Docling worker, the probes, the safe zone, and one typical 100-page PDF. With the defaults, this comes to about 5 GB plus about 2.4 GB for each worker slot:
MAX_CONCURRENT | Memory Required |
|---|---|
1 | About 7.3 GB |
2 | About 9.7 GB |
4 | About 14.4 GB |
The startup log reports the figures in MB, so 7.3 GB here is 7308 MB in the log. An Infra install sets no memory limit on the container, so Doc Chunker counts the host's total memory, even when other services use part of it.
When MAX_CONCURRENT isn't set, Doc Chunker starts as many workers as fit the memory, each
warm and converting a typical PDF, but no more than the number of CPUs, and at least one. A
MAX_CONCURRENT set above that number lowers the capacity, so Doc Chunker refuses more files. Doc
Chunker logs the capacity and the terms it is made of at startup.
When the capacity doesn't fit a typical PDF, Doc Chunker refuses to start and logs
At least X MB is required, but only Y MB is available. To fix it, raise the memory limit or lower
MAX_CONCURRENT. With MEMORY_ESTIMATE_ENFORCE set to 0, Doc Chunker only logs a warning and
starts anyway.
The estimates are deliberately high. A host that ran a Doc Chunker older than v2.5.0 with more worker slots fails the startup check when it has less memory than the table shows, even though those slots fit in memory in practice.
| Variable | Description | Default |
|---|---|---|
MEMORY_SAFE_ZONE_MB | Memory in MB that Doc Chunker leaves out of the capacity, for what the estimates don't cover. | 1024 |
MEMORY_CAPACITY_MAX_MB | Caps the capacity below the container's memory limit, in MB, for a deployment that leaves part of the memory to something else. 0 sets no cap. | 0 |
MEMORY_ESTIMATE_ENFORCE | 0 still estimates and logs every file but refuses none, and starts Doc Chunker even when the memory doesn't fit a typical PDF. Use it to compare the estimates with real traffic, or on a small development machine. | 1 |
PROBE_TIMEOUT_S | Seconds the probe of one file takes at most. Past it, the file goes ahead without an estimate. | 30 |
PROBE_CONCURRENCY | Number of files probed at once. Probes run before a file takes a worker slot, so MAX_CONCURRENT doesn't limit them. | 2 |
DOCLING_MEMORY_LIMIT_MB | The container's memory limit in MB, for a host with no cgroup memory limit. Doc Chunker also sizes worker retirement against it. | None |
The Infra install form exposes none of these variables, so an install from the Infra Web Panel runs with their defaults.
Chunk Size
A chunk holds at most as many tokens as the chunking request asks for in max_tokens. A request
that omits the parameter gets the largest chunk recorded for the tokenizer that measures it, which
is 512 tokens for the built-in default. See Chunking Tokenizers.
Doc Chunker fills 70 percent of that budget with text unique to the chunk, and spends the remaining 30 percent on overlap. The overlap runs forward: Doc Chunker takes whole sentences from the start of a chunk and appends them to the chunk before it. The earlier chunk grows, and the later one stays as it was. Each overlap also stays within about 30 percent of the length of the chunk it extends, so a short chunk grows by far less than the 30 percent ceiling of the budget.
Doc Chunker overlaps only consecutive chunks of running text, so a table never bleeds into its neighbors.
Chunk boundaries are measured with the tokenizer of the embedding model the chunks are destined
for, so the token counts match the ones that model counts. Name that model in the embedding_model
parameter of a chunking request, and register its tokenizer first. See
Chunking Tokenizers.
The chunking_strategy parameter of the vector store endpoints does not set chunk boundaries. Doc
Chunker takes them from embedding_model and max_tokens. The only value that changes the result
is the skip strategy, which keeps the whole converted file as a single chunk.
Data Storage
Doc Chunker keeps everything it stores under DATA_DIR, in two subdirectories it creates there:
tokenizers/ holds the registered tokenizers, and jobs/ holds the
conversion jobs with their results. Chunking never writes to
DATA_DIR.
Doc Chunker refuses to start when it can't write to both subdirectories. It doesn't check that
DATA_DIR is a mounted volume. Without one, Doc Chunker writes to the container's own file
system, and every registered tokenizer and every job result is lost when the container is
recreated, for example on a reinstall or an upgrade.
The Infra install form of the doc_chunker model mounts no volume at DATA_DIR. An install from
the Infra Web Panel therefore keeps its tokenizers and job results only until its
container is recreated. Register your tokenizers again after a reinstall or an upgrade.
| Variable | Description | Default |
|---|---|---|
DATA_DIR | Directory holding tokenizers/ and jobs/. Mount a writable volume here. | /var/lib/doc-chunker |
MAX_TOKENIZERS | Number of registered tokenizers Doc Chunker holds, in memory and on the volume together. | 10 |
TOKENIZER_MAX_ARCHIVE_BYTES | Largest accepted tokenizer upload, in bytes. The default is 50 MB. | 52428800 |
TOKENIZER_MAX_UNPACKED_BYTES | Largest accepted unpacked size, in bytes. The default is 200 MB. | 209715200 |
Registering a tokenizer past MAX_TOKENIZERS deletes the least recently used one from memory and
from the volume. That model then answers like one that was never registered, and registering its
tokenizer again brings it back. Recency lives in memory, so right after a restart, before anything
has been used, Doc Chunker deletes the tokenizer that was registered longest ago.
Logs
Doc Chunker writes the logs of its API process and of its Docling workers to the container log.
| Variable | Description | Default |
|---|---|---|
LOG_LEVEL | Minimum level of the log records Doc Chunker writes, for example INFO or DEBUG. | INFO |
Inference Gateway
Image description and audio transcription both call an OpenAI-compatible inference gateway, so they
share one address and one key. Point INFRA_API_URL at the gateway root, not at a specific endpoint.
Doc Chunker appends /v1/chat/completions for image description and /v1/audio/transcriptions for
transcription.
| Variable | Description | Default |
|---|---|---|
INFRA_API_URL | Gateway root, for example http://ollama:11434. If empty, an install through Infra uses http://infra:8086. | |
INFRA_API_KEY | API key for the gateway, if it requires one. If empty and INFRA_API_URL is this Infra (http://infra:8086 or DF_INFRA_URL), Infra fills in its own API key. |
Infra sends its API key only to its own address, never to an external gateway. After you change
the Infra API key, Doc Chunker keeps the previous key until you restart Infra or reinstall Doc
Chunker. A duplicated Doc Chunker model doesn't get the key filled in. Set its INFRA_API_KEY
yourself.
An install through Infra fills in INFRA_API_URL with http://infra:8086 when you leave it empty.
In a Doc Chunker container run outside Infra, an empty INFRA_API_URL makes both features
unavailable, and Doc Chunker rejects a request that needs one rather than returning a document
without it.
Image Descriptions
Image description is opt-in per request. Pass describe_images=true and name the vision-language
model with vision_model. Both are required together: a request that asks for descriptions without
vision_model is rejected with 422, and so is a request naming a model the gateway doesn't offer.
Doc Chunker describes every picture the document holds. There is no size threshold, so icons and logos are described too.
| Variable | Description | Default |
|---|---|---|
PICTURE_DESCRIPTION_PROMPT | Prompt that controls how the model describes each image. | Describe this image in detail. |
PICTURE_DESCRIPTION_API_MAX_TIME | Maximum wait time in seconds for a single gateway call. | 300 |
PICTURE_DESCRIPTION_CONCURRENCY | Number of pictures described in parallel within one document. | 4 |
PICTURE_DESCRIPTION_CONCURRENCY bounds a single document, and Doc Chunker converts MAX_CONCURRENT
documents at a time. The gateway therefore sees up to the product of the two, which is 8 requests
with both at their defaults. Raise it for a gateway that takes the load.
These parameters and variables apply to requests you send to Doc Chunker yourself. DeepFellow Server never asks Doc Chunker for descriptions. It describes images on its own. See Image Descriptions in DeepFellow Server.
Audio Transcription
For audio and video, transcription is the conversion: the transcript becomes the document's text.
Name the speech-to-text model per request with stt_model. It is required, so uploading audio or video
without it is rejected with 422.
Doc Chunker splits the transcript on silence, and every piece keeps the time span it was spoken in.
A silence longer than AUDIO_SILENCE_THRESHOLD always ends a chunk, so no chunk ever spans a pause.
| Variable | Description | Default |
|---|---|---|
AUDIO_STT_MAX_TIME | Maximum wait time in seconds for a single speech-to-text call. | 600 |
AUDIO_SILENCE_THRESHOLD | Minimum duration of silence in seconds that splits the transcript. | 2.0 |
Converted Documents
When Doc Chunker is active, adding a file to a vector store with
POST /v1/vector_stores/{vector_store_id}/files converts the file through Doc Chunker first, and
the vector store stores the chunks that come back.
DeepFellow keeps the converted document next to the file, under the path set by
DF_FILESTORAGE_META_PATH, which defaults to storage/. Adding the same file again, or asking for
its text later, reuses that document instead of converting the file a second time. A conversion that
stopped halfway leaves nothing reusable behind, so the next request converts the file again.
POST /v1/metadata/expand, which extracts metadata fields from a document with an LLM, uses the
same cache. When a requested field is not present in a document's embedded metadata, DeepFellow
uses Doc Chunker to extract the document's text, converting the file if no conversion is cached
yet. To include descriptions of the document's images in that text, set image_processing_mode to
description in the request body. The default value, ignore, skips image descriptions.
Image Descriptions in DeepFellow Server
DeepFellow Server describes the images of a document itself. It sends each image to the
vision-language model named by doc_chunker_picture_description_model through DeepFellow Infra,
with the prompt Describe this image in detail.
The server describes images only when a request asks for descriptions:
POST /v1/vector_stores/{vector_store_id}/fileswithimage_processing_modeset todescriptionPOST /v1/metadata/expandwithimage_processing_modeset todescriptionGET /v1/files/{file_id}/textwithimage_modeset todescriptionsPOST /text_converter/textwithimage_modeset todescriptions
The first such request for a file computes the descriptions, and the server keeps them next to the
converted document. Later requests reuse them. A file that was converted earlier without
descriptions gains them on the first request that asks, and the server does not convert the file
again. POST /text_converter/text keeps nothing, so it describes the images on every call that asks.
The server describes up to 4 images at a time and waits up to 300 seconds for each one. Describing
a document's images stops when the time set by doc_chunker_convert_timeout_seconds runs out,
counted from the start of the conversion.
If the model fails to describe an image, the server leaves that image without a description and the
request still succeeds. The next request that asks for descriptions tries that image again. The
metric picture_description_pictures_total counts the images by outcome: described, rejected,
failed, aborted, unreadable, and error.
The unreadable outcome counts an image that the server cannot read from storage, and error
counts an image lost to an unexpected server error. Both leave the image without a description, and
a later attempt will not fix it.
With a wrong model name in doc_chunker_picture_description_model, or while the model is
unavailable, the server ingests a file that contains text without image descriptions and reports no
error. Watch picture_description_pictures_total for the failed and aborted outcomes. The
server retries a file that contains only images instead. Watch the unreadable and error
outcomes too, since the descriptions they count are lost.
After you change doc_chunker_picture_description_model, the server describes each image again
with the new model on the next request that asks for descriptions. Until the new model answers, the
server uses the description from the previous model.
A document converted before DeepFellow Server described images keeps the descriptions that the conversion wrote into it. The server uses them as they are and does not describe those images again.
Both GET /v1/files/{file_id}/text and POST /text_converter/text take an image_mode parameter.
It defaults to none on the first, and the second requires it. When it asks for descriptions, the
server describes the images with the model from doc_chunker_picture_description_model.
Besides none and descriptions, image_mode accepts embedded, which inlines each image as a
base64 data: URI. GET /v1/files/{file_id}/text also accepts referenced, which links each image
to /v1/files/{file_id}/assets/{name}. An ad-hoc conversion keeps no assets to link to, so
POST /text_converter/text doesn't offer that mode. Both modes need output_format=md and return
400 without it.
Get a File's Text
GET /v1/files/{file_id}/text holds the request open until the conversion is done, which takes up to
doc_chunker_convert_timeout_seconds, two hours by default, for a large file. Its asynchronous
variant, GET /v1/files/{file_id}/text/async, converts the file in the background and answers at
once, so you poll it until the text is ready. It takes the same authorization, path, and query
parameters, image_mode and output_format, and answers 404 and 400 in the same cases.
| Status | Meaning |
|---|---|
200 | The file is converted. The body is what GET /v1/files/{file_id}/text returns: text/plain or text/markdown. |
202 | The conversion is running. The body is {"status": "in_progress"}, and the Retry-After header holds the seconds to wait before the next request, 10. |
| Error | The background conversion failed. The next request returns the error GET /v1/files/{file_id}/text would have returned, such as 422 for a file Doc Chunker can't convert, 413 with the detail insufficient_memory for a file that needs more memory than the instance has (see Memory Estimate), or 502, 503, or 504 when Doc Chunker fails. A 503 might carry a Retry-After header. |
The first request for a file that isn't converted yet starts its conversion and answers 202:
curl -i -X 'GET' \
'https://deepfellow-server-host/v1/files/FILE_ID/text/async?output_format=md' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY'HTTP/1.1 202 Accepted
Retry-After: 10
Content-Type: application/json
{"status": "in_progress"}Wait the number of seconds in Retry-After and send the same request again. Once the conversion is
done, the request answers 200 with the file's Markdown.
- One conversion per file: While the file converts, whether for an earlier request, for
GET /v1/files/{file_id}/text, or in a Nightshift job such as vector store ingestion, requests answer202and don't start another conversion. Once that conversion is done, the request answers200with the document that conversion stored. - Shared result: The background conversion stores the converted document described in
Converted Documents, so
GET /v1/files/{file_id}/text, vector store ingestion, and the knowledge graph reuse it without converting the file again. - Failure: The request after a failed conversion returns its error, and the request after that starts the conversion again.
- Restarts: If DeepFellow Server restarts during the conversion, the next request resumes the same Doc Chunker job instead of converting the file again.
- Deletion: Deleting the file stops DeepFellow Server from waiting for its conversion. A conversion already queued or running in Doc Chunker still finishes there.
Chunking Tokenizers
Every embedding model counts tokens with its own tokenizer, so a chunk that fits one model overflows
another. Doc Chunker measures each chunking request with the tokenizer of the embedding model the
chunks are destined for. Two query parameters select it, and both POST /custom/doc_chunker/chunk
and POST /custom/doc_chunker/convert?chunk=true accept them.
| Parameter | Description | Default |
|---|---|---|
embedding_model | Embedding model the chunks are destined for. Its registered tokenizer measures the boundaries. | The built-in default |
max_tokens | Largest number of tokens a chunk will hold. | The largest chunk recorded for the selected tokenizer |
One tokenizer ships inside the image, for the mxbai-embed-large model, with a maximum of 512
tokens. A request that names no embedding_model uses it, and a request that names
mxbai-embed-large resolves to the same tokenizer. It never counts against MAX_TOKENIZERS, and
Doc Chunker never downloads it, so a container with no outbound network and an empty volume still
chunks.
To chunk for any other embedding model, register that model's tokenizer first.
Doc Chunker answers 400 when embedding_model names a model with no registered tokenizer, and
when max_tokens is above the maximum recorded for the selected tokenizer. Neither case falls back
to the default, and neither reduces max_tokens to the maximum, because chunks measured with the
wrong tokenizer look exactly like correct ones.
For a model with no registered tokenizer, the detail of the 400 response is always
tokenizer_not_registered. The same detail applies when Doc Chunker has deleted the tokenizer to
stay within MAX_TOKENIZERS. To recover, register the tokenizer and send the request again.
Register a Tokenizer
POST /custom/doc_chunker/tokenizers accepts multipart/form-data with a ZIP archive in the file
field, and registers the tokenizer it holds for one embedding model.
| Parameter | Description |
|---|---|
model | Embedding model this tokenizer belongs to. Required. |
max_tokens | Largest number of tokens this model embeds at once. Required. It becomes both the default and the ceiling for max_tokens on chunking requests. |
Spell model exactly as your inference gateway spells it, tags and namespaces included, for example
mxbai-embed-large:latest or mixedbread-ai/mxbai-embed-large-v1. Doc Chunker takes the name as a
key rather than a path and returns it verbatim, so a-model:v1 and a-model:v2 are two separate
registrations. A name that is blank or longer than 200 characters is rejected with 400.
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/tokenizers?model=nomic-embed-text&max_tokens=8192' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@nomic-embed-text-tokenizer.zip;type=application/zip'The response repeats what is now registered.
{
"model": "nomic-embed-text",
"max_tokens": 8192
}Registering a model that already has a tokenizer replaces it. Doc Chunker loads the archive before it stores anything, so a rejected upload leaves the previous tokenizer in place and usable.
What the archive holds
Pack a Hugging Face tokenizer directory with the files at the root of the archive, not inside a
folder. It is what AutoTokenizer.from_pretrained(model).save_pretrained(directory) writes:
| File | Description |
|---|---|
tokenizer.json | Required. |
tokenizer_config.json | The tokenizer class and its special tokens. Required in practice. |
special_tokens_map.json | Included when the model has one. |
Everything else in a model repository is the model rather than the tokenizer, so config.json,
model.safetensors, onnx/, and 1_Pooling/ stay out of the archive. Doc Chunker accepts only a
tokenizer backed by a tokenizer.json, and rejects a sentencepiece-only tokenizer or one that ships
its own Python class with 400. It loads tokenizers with no remote code and no network access, so
an upload never executes code and never pulls files from outside the archive.
Get a Tokenizer from Infra
DeepFellow Infra serves the tokenizer of an installed embedding model, already packed as the archive
POST /custom/doc_chunker/tokenizers accepts. GET /v1/models/{model}/tokenizer returns the archive
together with the token limit of the model, so you don't have to find the tokenizer files or the
token limit yourself.
Send the request to Infra with the Infra API key. Infra reads the model name as a path, so a
namespaced name such as BAAI/bge-m3 needs no escaping.
Download the tokenizer and print the response headers:
curl -X 'GET' \
'http://DEEPFELLOW_INFRA_HOST/v1/models/BAAI/bge-m3/tokenizer' \
-H 'Authorization: Bearer DF_INFRA_API_KEY' \
-o bge-m3-tokenizer.zip \
-D -Read the token limit from the X-Max-Tokens header:
HTTP/1.1 200 OK
content-type: application/zip
content-disposition: attachment; filename="tokenizer.zip"
x-max-tokens: 8192Register the archive unchanged, with the header value as max_tokens:
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/tokenizers?model=BAAI/bge-m3&max_tokens=8192' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@bge-m3-tokenizer.zip;type=application/zip'X-Max-Tokens is the token limit of the service, which is often lower than the context window the
model declares. A model served by more than one service gets the lowest of their token limits,
because an embedding request goes to any of them. The header is absent when Infra doesn't
know the limit.
Infra serves a tokenizer for an embedding model from one of these services:
- Ollama and Ollama External: Infra rebuilds the tokenizer from the model file, so it counts tokens exactly as Ollama does. This covers every embedding model in the Ollama catalog and models installed from outside it.
- vLLM and SGLang: Infra packs the tokenizer files from the model repository. The repository must
ship
tokenizer.jsonandtokenizer_config.json.
The model is either on this Infra or on another Infra connected through a Mesh. The first request for an Ollama model takes up to a few seconds while Infra builds the tokenizer. Infra serves later requests from memory until the model changes.
| Status | Detail | Meaning |
|---|---|---|
200 | The body is the tokenizer archive. | |
400 | Given model is not supported | The model isn't an embedding model. |
404 | Model not found | No model has this name. The error code is model_not_found. |
404 | tokenizer_not_available | Infra has no tokenizer for this model, for example a model on Docker Model Runner or a remote provider, or an alias that groups different models. Keep chunking with the built-in default tokenizer. |
503 | tokenizer_fetch_failed | A backend that may hold the tokenizer failed, for example a connected Infra is down. Send the request again later rather than falling back to the default tokenizer. |
503 | Model {model} is still loading, try again shortly | Infra is still loading the model after a start. Send the request again after the number of seconds in the Retry-After header. |
Read a Registered Tokenizer
GET /custom/doc_chunker/tokenizers/{model} returns the model name and its recorded max_tokens,
in the shape POST /custom/doc_chunker/tokenizers returns. It answers 404 when nothing is
registered for that model. The name is taken as a path, so a namespaced name needs no escaping.
curl -X 'GET' \
'https://deepfellow-server-host/custom/doc_chunker/tokenizers/nomic-embed-text' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY'Call Doc Chunker Directly
For advanced use cases, call Doc Chunker through the /custom/doc_chunker endpoint without a vector
store. The two operations are separate endpoints, and conversion never happens implicitly:
POST /convert turns a file into a Docling document, and POST /chunk turns that document into
chunks. The rest of this page shortens Doc Chunker's paths by dropping the /custom/doc_chunker
prefix, so POST /convert stands for POST /custom/doc_chunker/convert.
Address these calls to DeepFellow Server with your project API key. The server proxies them to Doc Chunker and supplies the Infra credentials itself, so your client never holds the Infra API key. See Custom Endpoints.
Your project's custom_endpoints must allow the exact path you call. It defaults to all, which
allows every custom endpoint. If you restrict it, list full paths such as doc_chunker/convert. The
prefix alone doesn't match, so a list holding only doc_chunker answers 403 for
doc_chunker/convert. DeepFellow Server answers 403 before the request reaches Doc Chunker.
The list governs only the calls you address to /custom/doc_chunker/.... Vector store ingestion and
GET /v1/files/{file_id}/text reach Doc Chunker from inside the server, which doesn't consult
custom_endpoints. See Authorization.
Convert a File
POST /custom/doc_chunker/convert accepts multipart/form-data with the file in the file field,
and returns a ZIP archive named after the uploaded file.
| Parameter | Description | Default |
|---|---|---|
describe_images | Whether to describe the pictures found in the document. Requires vision_model. Doc Chunker ignores it for audio and video. | false |
vision_model | Vision-language model the inference gateway will use to describe pictures. Required with describe_images=true. Doc Chunker ignores it otherwise. | |
stt_model | Speech-to-text model the inference gateway will use to transcribe audio and video. Required for audio and video. Doc Chunker ignores it for other files. | |
chunk | Whether to also chunk the document and add chunks.json to the archive, which saves a round trip through POST /chunk. | false |
embedding_model | Embedding model the chunks are destined for, as described in Chunking Tokenizers. Doc Chunker ignores it without chunk=true. | The built-in default |
max_tokens | Largest number of tokens a chunk will hold. Doc Chunker ignores it without chunk=true. | The largest chunk recorded for the selected tokenizer |
The archive holds document.json always, assets/ when the document has pictures, and chunks.json
when you pass chunk=true.
Doc Chunker checks embedding_model and max_tokens before it starts converting, so an
unregistered model or an impossible token limit costs one rejected request rather than a conversion
whose result never reaches you.
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/convert?chunk=true' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@report.pdf;type=application/pdf' \
-o report.zipdocument.json is the source of truth for everything downstream, so Doc Chunker produces it once and
never modifies it. Image descriptions are written while the document is being produced, so adding
them later means converting the file again.
Convert a File in the Background
POST /custom/doc_chunker/convert answers only once the conversion is done, which takes up to an
hour for a large file. A conversion job lets you submit the file, disconnect, and come back for the
result. DeepFellow Server itself always converts through POST /convert, so conversion jobs are
for direct calls only.
| Endpoint | Description |
|---|---|
POST /custom/doc_chunker/convert/jobs | Submits a conversion and answers 202 with the job's status. It takes the same file field and query parameters as POST /convert. |
GET /custom/doc_chunker/convert/jobs/{job_id} | Returns the job's status. |
GET /custom/doc_chunker/convert/jobs/{job_id}/result | Returns the ZIP archive POST /convert would have returned for the same request, named after the uploaded file. Answers 409 until the job has succeeded. |
DELETE /custom/doc_chunker/convert/jobs/{job_id} | Removes a queued job, which then never runs, or a finished job with its result, and answers 204. Answers 409 with the detail job_running for a running job. |
The status and result endpoints answer 404 for an id that Doc Chunker doesn't hold, either
because it never existed or because the job has expired.
Conversion jobs need the project's custom_endpoints set to all. DeepFellow Server matches each
path exactly, and every path after the submission holds the job's id, so no fixed list of paths
covers them. See Call Doc Chunker Directly.
Submit the file:
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/convert/jobs?chunk=true' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@report.pdf;type=application/pdf'The response, and every status request after it, returns the job's status:
{
"id": "3f9a0c1e5b7d4e8a9c217d4e5f6a8b90",
"status": "failed",
"filename": "report.pdf",
"created_at": "2026-09-29T12:00:00Z",
"started_at": "2026-09-29T12:00:04Z",
"finished_at": "2026-09-29T12:41:10Z",
"error": { "status_code": 422, "detail": "..." }
}status is queued, running, succeeded, or failed. A failed job's error holds the status
code and the detail POST /convert would have answered with for the same failure. Treat the id as
an opaque string.
Once status is succeeded, download the result and delete the job:
curl -X 'GET' \
'https://deepfellow-server-host/custom/doc_chunker/convert/jobs/JOB_ID/result' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-o report.zip
curl -X 'DELETE' \
'https://deepfellow-server-host/custom/doc_chunker/convert/jobs/JOB_ID' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY'Job Lifecycle
- Retention: Doc Chunker removes a finished job and its result
JOB_RESULT_TTLseconds after the job finished. Delete a job once you have downloaded its result, so it doesn't occupy the volume until then. - Restarts: Finished jobs survive a restart of Doc Chunker. A job that was queued or running
when Doc Chunker stopped becomes
failed, with the detailinterrupted by restart. Doc Chunker doesn't run it again, so submit the file again if you still need the result. - Too large for the instance: The submission still answers
202. Doc Chunker probes the file in the background, and the job staysqueuedmeanwhile. A file that doesn't fit the instance even with nothing else running becomesfailedwith the status413and the detailinsufficient_memory, without taking a worker slot. See Memory Estimate. - Full queue: When
MAX_QUEUED_JOBSjobs already wait for a slot, a submission answers503with the detailqueue_full_retry_laterand noRetry-Afterheader, because Doc Chunker has no estimate of when a slot frees up. - Full volume: When the volume has no room for the uploaded file, a submission answers
507. - Unregistered tokenizer: With
chunk=true, a submission for anembedding_modelwith no registered tokenizer answers400with the detailtokenizer_not_registered, and Doc Chunker doesn't queue the job. If Doc Chunker deletes the tokenizer while the job waits, the job becomesfailedwith the same status code and detail.
| Variable | Description | Default |
|---|---|---|
JOB_RESULT_TTL | Seconds a finished job's status and result stay available, counted from when the job finished. The default is 24 hours. | 86400 |
MAX_QUEUED_JOBS | Number of jobs that wait for a slot before Doc Chunker refuses new submissions. | 100 |
Conversion jobs run on the same worker slots as /convert and /chunk, as described in
Worker Slots. The Infra install form doesn't expose JOB_RESULT_TTL or
MAX_QUEUED_JOBS, so an install from the Infra Web Panel runs with their
defaults. Job results live under DATA_DIR, as described in Data Storage.
Chunk a Document
POST /custom/doc_chunker/chunk accepts multipart/form-data with the document.json from a
POST /convert archive in the file field, and returns JSON. It converts nothing and contacts no
inference gateway, so it needs no conversion model and leaves the document untouched. The assets
aren't needed, because chunk content comes from the document's own text and metadata.
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/chunk' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@document.json;type=application/json'The embedding_model and max_tokens parameters decide the chunk boundaries. This call measures
with the built-in default tokenizer, at its own maximum. To measure for another embedding model, add
both parameters, as described in Chunking Tokenizers.
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/chunk?embedding_model=nomic-embed-text&max_tokens=2048' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-F 'file=@document.json;type=application/json'The response holds the chunks and a total count.
{
"chunks": [
{
"text": "Quarterly revenue grew by 12 percent compared to the previous period.",
"meta": {
"headings": ["Financial Summary"],
"pages": [3],
"bboxes": [{ "page": 3, "l": 72.0, "t": 120.5, "r": 540.0, "b": 200.3 }],
"self_refs": ["#/texts/12"],
"labels": ["text"]
},
"start_index": 0,
"end_index": 69
}
],
"count": 1
}Every key in meta is conditional, and a chunk carries only the ones that apply to it.
| Key | Description |
|---|---|
headings | The headings the chunk sits under. |
pages | The pages the chunk's text comes from. |
bboxes | The bounding boxes of the chunk's text, as page, l, t, r, and b. |
self_refs | The references to the chunk's source items in document.json, for example #/texts/12. |
labels | The layout labels of the chunk's source items, for example text. |
start | For audio and video only, the start of the transcript window in seconds. |
end | For audio and video only, the end of the transcript window in seconds. |
start_index and end_index are character offsets into the concatenation of the chunk texts, in the
order Doc Chunker emitted them. They are not positions in the original file. Because the overlap
extends the earlier chunk, one chunk's end_index reaches past the next chunk's start_index, and
the difference is the length of the duplicated text, which is what you drop when you join chunks back
together. To locate a chunk within the original document, use self_refs, bboxes, or pages.
Count a Text's Tokens
POST /tokenize counts the tokens of a text with the tokenizer registered for an
embedding model, and returns the largest number of tokens that model accepts at once. To check a
text, such as a search query, against the model's limit in tokens, use this endpoint instead of
estimating that limit in characters.
The request takes a JSON body.
| Field | Description | Default |
|---|---|---|
model | Embedding model to count for. Doc Chunker selects its tokenizer the same way as for embedding_model in Chunking Tokenizers. A null or empty model also selects the built-in default. | The built-in default |
text | Text to count. Required. It holds at most TOKENIZE_MAX_TEXT_CHARS characters. |
curl -X 'POST' \
'https://deepfellow-server-host/custom/doc_chunker/tokenize' \
-H 'Authorization: Bearer DEEPFELLOW_PROJECT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"model": "mxbai-embed-large", "text": "how to configure the server"}'{
"model": "mxbai-embed-large",
"tokens": 10,
"max_tokens": 512
}| Field | Description |
|---|---|
model | Embedding model the text was counted for. |
tokens | Number of tokens in the text, including the special tokens the tokenizer adds around a sequence, such as [CLS] and [SEP]. |
max_tokens | Largest number of tokens the model accepts at once, as recorded for its tokenizer. |
Because tokens includes the special tokens, compare it directly with max_tokens. The
max_tokens budget of POST /chunk excludes them, so the same text counts a few tokens more here
than in a chunk.
Doc Chunker answers 400 with the detail tokenizer_not_registered when model names a model with
no registered tokenizer. It doesn't fall back to the built-in default tokenizer. Register the model's
tokenizer, as described in Register a Tokenizer, and send the request
again.
Counting takes no worker slot, so a count never waits for a running conversion. The first count for a newly registered model loads its tokenizer, which takes a few seconds.
| Variable | Description | Default |
|---|---|---|
TOKENIZE_MAX_TEXT_CHARS | Longest text that POST /tokenize counts, in characters. Doc Chunker answers 422 to a longer one before it loads a tokenizer. | 100000 |
The Infra install form doesn't expose TOKENIZE_MAX_TEXT_CHARS, so an install from the
Infra Web Panel counts texts of up to 100,000 characters.
Errors
| Status | Meaning |
|---|---|
400 | The request names or carries something Doc Chunker will not use: an embedding model with no registered tokenizer (tokenizer_not_registered), a max_tokens above the maximum recorded for that tokenizer, an unusable model name, or an upload that is not a loadable tokenizer or is over the size limits. |
404 | GET /tokenizers/{model} finds nothing registered for that model, or /convert/jobs/{job_id} finds no job held under that id. |
409 | GET /convert/jobs/{job_id}/result asks for the result of a job that hasn't succeeded, or DELETE /convert/jobs/{job_id} targets a running job (job_running). |
413 | insufficient_memory: converting the file needs more memory than this instance has, even with nothing else running. Retrying on the same instance won't help, but an instance with more memory will convert the file. See Memory Estimate. |
422 | Doc Chunker rejects the request: a missing file field, an unreadable file, a failed or partial conversion, a missing or unknown vision_model or stt_model, a malformed document.json, or a POST /tokenize body without text or with a text over TOKENIZE_MAX_TEXT_CHARS. |
500 | An unhandled error inside Doc Chunker, for example a registered tokenizer whose stored metadata is no longer readable. |
502 | The inference gateway refused the request or was unreachable. |
503 | Nothing is wrong with the request, so retry it later. No worker slot was free and host memory stayed too tight to admit the conversion, a conversion backend failed on every attempt, or POST /convert/jobs found the queue full (queue_full_retry_later). |
504 | The conversion, one of its subprocesses such as LibreOffice or ffmpeg, or the inference gateway didn't finish in time. |
507 | POST /convert/jobs found no room on the volume for the uploaded file. |
Doc Chunker enforces no size limit in bytes on the files it converts. It refuses a file only by its
estimated memory, with 413. The size limit on the files you add to DeepFellow comes from
DeepFellow Server. A tokenizer upload is the one exception: Doc Chunker rejects an archive over TOKENIZER_MAX_ARCHIVE_BYTES with 400, from the
Content-Length header, before it reads the archive into memory.
Doc Chunker also exposes GET /custom/doc_chunker/health, which returns {"status": "ok"} when the
service is ready. It returns 503 when one of the conversion backends has exited or a conversion
has been running past its soft timeout. The soft timeout counts from the last step the conversion
finished, such as a page range, a picture description, or a chunk, so a long conversion that keeps
making progress never trips it. GET /custom/doc_chunker/version returns the version of the
running container.
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.