-
Notifications
You must be signed in to change notification settings - Fork 398
Description
Product
BAML
Describe the bug
When running baml-cli serv (mode BAML-over-HTTP API server that exposes your BAML functions via HTTP endpoint), there is a limitation on the size of the files that can be uploaded for processing (such as PDFs). Project code uses Axum - web application framework https://github.com/BoundaryML/baml/blob/0.218.0/engine/baml-runtime/src/cli/serve/mod.rs#L299
By default, Axum uses with DefaultBodyLimit , which restricts the request body to 2 MB (see the documentation: https://docs.rs/axum/latest/axum/extract/struct.DefaultBodyLimit.html).
This limitation makes it impossible to upload or process PDF files larger than 2 MB in baml-cli serve mode (see documentation: https://docs.boundaryml.com/ref/baml-cli/serve). When using models such as Gemini, which accepts files up to 50 MB, the current default greatly limits the ability to work with files more 2 MB.
There is currently no way to configure or disable this limit when running baml-cli serve mode, which prevents use cases that require uploading larger documents.
Suggestion:
- Make the DefaultBodyLimit value configurable via an environment variable or CLI flag, so that users can set an explicit body size limit according to their needs.
- Allow an option to disable the DefaultBodyLimit entirely when necessary.
References:
Reproduction Steps
- Run BAML in serv mode
baml-cli serve - Attempt to upload a PDF file larger than 2 MB for processing.
- Observe that the request fails due to body size limitation imposed by Axum DefaultBodyLimit with error:
Failed to buffer the request body: length limit exceeded
BAML Version
0.218.0
Language/Framework
No response
LLM Provider
LLM Model
No response
Operating System
Linux
Browser
Chrome
Code Editor
VS Code