Connection
Base URL, credentials and a reachable server.
Keep leading zeros and test both parity lengths, rejecting spaces and non-ASCII digits without claiming account validity.
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.
def luhn_valid(text):
if type(text) is not str or not 2 <= len(text) <= 64:
raise ValueError("luhn.length")
if any(char < "0" or char > "9" for char in text):
raise ValueError("luhn.alphabet")
total = 0
for index, char in enumerate(reversed(text)):
digit = ord(char) - ord("0")
if index % 2:
digit *= 2
if digit > 9:
digit -= 9
total += digit
return total % 10 == 0