Connection
Base URL, credentials and a reachable server.
Review simplex_projection.py as a constrained numerical projection, checking feasibility separately from the nearest-point calculation.
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 math
def simplex_projection(values):
if type(values) is not list or not 1 <= len(values) <= 256:
raise ValueError("simplex.input")
if any(type(x) not in (int, float) or not -10**6 <= x <= 10**6 or not math.isfinite(x) for x in values):
raise ValueError("simplex.value")
ranked = sorted(values, reverse=True)
total, theta = 0.0, 0.0
for count, value in enumerate(ranked, 1):
total += value
candidate = (total-1)/count
if value > candidate:
theta = candidate
return [max(0.0, value-theta) for value in values]