Connection
Base URL, credentials and a reachable server.
Reduce a fraction of two integers to a positive denominator and coprime terms.
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 math import gcd
def reduce_fraction(numerator, denominator):
if any(type(v) is not int for v in (numerator, denominator)):
raise ValueError("integer.required")
if denominator == 0:
raise ValueError("denominator.zero")
if denominator < 0:
numerator, denominator = -numerator, -denominator
divisor = gcd(numerator, denominator)
return numerator // divisor, denominator // divisor