Connection
Base URL, credentials and a reachable server.
Keep the accepted token grammar beside the millisecond cap and review leading zeros, whitespace and unit spelling at the parser boundary.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
import re
def duration_ms(text):
if not isinstance(text, str):
raise ValueError("duration.text")
match = re.fullmatch(r"(0|[1-9][0-9]{0,8})(ms|s|m|h)", text)
if not match:
raise ValueError("duration.syntax")
result = int(match[1]) * {"ms": 1, "s": 1000, "m": 60000, "h": 3600000}[match[2]]
if result > 86400000:
raise ValueError("duration.range")
return result