MCPcopy Create free account
hub / github.com/tirth8205/code-review-graph / _decode_vector

Function _decode_vector

code_review_graph/embeddings.py:760–763  ·  view source on GitHub ↗

Decode a binary blob back to a float vector.

(blob: bytes)

Source from the content-addressed store, hash-verified

758
759
760def _decode_vector(blob: bytes) -> list[float]:
761 """Decode a binary blob back to a float vector."""
762 n = len(blob) // 4 # 4 bytes per float32
763 return list(struct.unpack(f"{n}f", blob))
764
765
766def _cosine_similarity(a: list[float], b: list[float]) -> float:

Callers 3

test_roundtripMethod · 0.90
test_empty_vectorMethod · 0.90
searchMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_roundtripMethod · 0.72
test_empty_vectorMethod · 0.72