Connection
Base URL, credentials and a reachable server.
Measure Levenshtein distance by Unicode code point without normalizing the strings.
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 edit_distance(a, b):
if not isinstance(a, str) or not isinstance(b, str):
raise ValueError("text.required")
previous = list(range(len(b) + 1))
for i, left in enumerate(a, 1):
current = [i]
for j, right in enumerate(b, 1):
current.append(min(current[-1] + 1, previous[j] + 1,
previous[j - 1] + (left != right)))
previous = current
return previous[-1]