cpu-tts / app /utils /text.py
grimshaw's picture
Upload current hf-space contents
8986c3d verified
Raw
History Blame Contribute Delete
356 Bytes
from app.errors import OpenAICompatibleError
def ensure_max_length(text: str, max_length: int) -> None:
if len(text) > max_length:
raise OpenAICompatibleError(
status_code=400,
message=f"Input exceeds maximum length of {max_length} characters.",
param="input",
code="input_too_long",
)