Expand description
Shared utilities for embedding input sanitization and response handling.
Functionsยง
- compute_
norm - Compute L2 norm of a vector
- handle_
embedding_ response - Replace embeddings for originally-invalid inputs with zero vectors.
- is_
embeddable - Returns
trueifsis non-empty after stripping ASCII whitespace. - l2_
normalize - L2 normalize a vector to unit length
- mean_
pool - Mean pooling over sequence dimension with attention mask
- sanitize_
embedding_ inputs - Replace empty/whitespace-only strings with
"."to prevent API errors.