Connection
Base URL, credentials and a reachable server.
Separate zero-width shapes from missing rows while inspecting multiplication dimensions and the newly allocated result rows.
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 matrix_product(left, right):
left, right = [tuple(r) for r in left], [tuple(r) for r in right]
widths = []
for matrix in (left, right):
width = len(matrix[0]) if matrix else 0
if len(matrix) > 64 or width > 64 or any(len(r) != width for r in matrix):
raise ValueError("matrix.shape")
if any(type(v) is not int for r in matrix for v in r):
raise ValueError("cell.integer")
widths.append(width)
if widths[0] != len(right):
raise ValueError("matrix.incompatible")
return [[sum(row[k] * right[k][j] for k in range(widths[0]))
for j in range(widths[1])] for row in left]