Connection
Base URL, credentials and a reachable server.
Check January 31 in leap and non-leap years plus a negative shift, rejecting fractional offsets and years outside the supported range.
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.
from calendar import monthrange
from datetime import date
def add_months(day, delta):
if type(day) is not date or type(delta) is not int:
raise ValueError("month.input")
year, month0 = divmod(day.year * 12 + day.month - 1 + delta, 12)
if not 1 <= year <= 9999:
raise ValueError("month.year")
last = monthrange(year, month0 + 1)[1]
return date(year, month0 + 1, min(day.day, last))