MCPcopy Create free account
hub / github.com/BAI-LAB/MemoryOS / normalize_vector

Function normalize_vector

memoryos-pypi/utils.py:220–225  ·  view source on GitHub ↗
(vec)

Source from the content-addressed store, hash-verified

218 print("Embedding cache cleared")
219
220def normalize_vector(vec):
221 vec = np.array(vec, dtype=np.float32)
222 norm = np.linalg.norm(vec)
223 if norm == 0:
224 return vec
225 return vec / norm
226
227# ---- Time Decay Function ----
228def compute_time_decay(event_timestamp_str, current_timestamp_str, tau_hours=24):

Callers 6

add_sessionMethod · 0.90
search_sessionsMethod · 0.90
add_knowledge_entryMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected