Spaces:
Sleeping
Sleeping
File size: 470 Bytes
b5d3a91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from typing import List, Union
def is_flat_embedding(x: Union[List[float], List[List[float]]]) -> bool:
"""
Check if the embeddings represent a single flat list of floats
rather than a list of list of float.
Args:
x (List[float] or List[List[float]]): Embeddings to check.
Returns:
bool: True if x is a flat list of floats, False otherwise.
"""
return isinstance(x, list) and all(isinstance(i, (int, float)) for i in x)
|