vllm_mlx.audio_limits¶
Resource limits for optional audio endpoints.
View the complete module source at #L1-L77.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
vllm_mlx.audio_limits
¶
Resource limits for optional audio endpoints.
vllm_mlx.audio_limits.DEFAULT_MAX_AUDIO_UPLOAD_MB
module-attribute
¶
vllm_mlx.audio_limits.DEFAULT_MAX_AUDIO_UPLOAD_BYTES
module-attribute
¶
DEFAULT_MAX_AUDIO_UPLOAD_BYTES = DEFAULT_MAX_AUDIO_UPLOAD_MB * 1024 * 1024
vllm_mlx.audio_limits.DEFAULT_MAX_TTS_INPUT_CHARS
module-attribute
¶
vllm_mlx.audio_limits.AsyncReadableUpload
¶
Bases: Protocol
Structural type for an asynchronously readable uploaded file.
vllm_mlx.audio_limits.AsyncReadableUpload.read
async
¶
vllm_mlx.audio_limits.save_upload_with_limit
async
¶
save_upload_with_limit(file: AsyncReadableUpload, *, max_bytes: int, default_suffix: str = '.wav', chunk_size: int = UPLOAD_CHUNK_SIZE) -> str
Stream an uploaded file to disk while enforcing a hard byte limit.
This prevents large audio uploads from being buffered entirely in memory.
Source code in vllm_mlx/audio_limits.py
vllm_mlx.audio_limits.validate_tts_input_length
¶
Reject oversized TTS requests before synthesis starts.
Source code in vllm_mlx/audio_limits.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
vllm_mlx.audio_limits.AsyncReadableUpload · class
Structural type for an asynchronously readable uploaded file.
Parameters
This callable has no explicit inputs.
Returns
- Constructs:
vllm_mlx.audio_limits.AsyncReadableUpload
Exceptions and behavior
Class AsyncReadableUpload derives from Protocol and declares 1 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.audio_limits.AsyncReadableUpload.read · method
Read at most size bytes, or all remaining bytes when negative.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
size |
int |
no |
-1 |
Optional positional or keyword input; defaults to -1. |
Returns
- Type:
bytes
Exceptions and behavior
Method AsyncReadableUpload.read contains no state mutation, call, raise, return, await, or yield.
No direct raise statement appears in this definition.
vllm_mlx.audio_limits.save_upload_with_limit · function
async vllm_mlx.audio_limits.save_upload_with_limit(file: AsyncReadableUpload, *, max_bytes: int, default_suffix: str = '.wav', chunk_size: int = UPLOAD_CHUNK_SIZE) -> str
Stream an uploaded file to disk while enforcing a hard byte limit.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
file |
AsyncReadableUpload |
yes |
none |
Required positional or keyword input. |
max_bytes |
int |
yes |
none |
Required keyword-only input. |
default_suffix |
str |
no |
'.wav' |
Optional keyword-only input; defaults to '.wav'. |
chunk_size |
int |
no |
UPLOAD_CHUNK_SIZE |
Optional keyword-only input; defaults to UPLOAD_CHUNK_SIZE. |
Returns
- Type:
str - Direct return expressions:
tmp_path
Exceptions and behavior
Function save_upload_with_limit calls Path, tempfile.NamedTemporaryFile, file.read, len; awaits asynchronous work; can raise HTTPException; returns tmp_path.
Directly raised exceptions: HTTPException.
vllm_mlx.audio_limits.validate_tts_input_length · function
Reject oversized TTS requests before synthesis starts.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text |
str |
yes |
none |
Required positional or keyword input. |
max_chars |
int |
yes |
none |
Required keyword-only input. |
Returns
- Type:
None
Exceptions and behavior
Function validate_tts_input_length calls len, HTTPException; can raise HTTPException.
Directly raised exceptions: HTTPException.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
AsyncReadableUpload |
class | AsyncReadableUpload() |
Structural type for an asynchronously readable uploaded file. | #L17-L25 |
AsyncReadableUpload.read |
method | async AsyncReadableUpload.read(size: int = -1) -> bytes |
Read at most size bytes, or all remaining bytes when negative. |
#L22-L25 |
save_upload_with_limit |
function | async save_upload_with_limit(file: AsyncReadableUpload, *, max_bytes: int, default_suffix: str = '.wav', chunk_size: int = UPLOAD_CHUNK_SIZE) -> str |
Stream an uploaded file to disk while enforcing a hard byte limit. | #L28-L65 |
validate_tts_input_length |
function | validate_tts_input_length(text: str, *, max_chars: int) -> None |
Reject oversized TTS requests before synthesis starts. | #L68-L77 |