Connection
Base URL, credentials and a reachable server.
Expand byte-and-count runs only after checking the total output limit.
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 expand_runs(runs, limit):
if type(limit) is not int or limit < 0:
raise ValueError("limit.invalid")
total = 0
for value, count in runs:
if type(value) is not int or not 0 <= value <= 255:
raise ValueError("byte.invalid")
if type(count) is not int or count <= 0:
raise ValueError("count.invalid")
total += count
if total > limit:
raise ValueError("output.limit")
return bytes(value for value, count in runs for _ in range(count))