Version: 0.0.4
agrag.embedding.base.EmbeddingCache
Bases: ABC
A content-addressed cache for embedding vectors.
normalize is part of the cache key alongside text and model
because it changes the vector an embedder produces for the same text and
model: without it, embedders sharing one cache but configured with
opposite EmbeddingSettings.normalize values would read back the wrong
output mode. Any future embedder setting that changes output values must
join this key the same way.
Functions:
- get – Return the cached vector for
(text, model, normalize). - set – Store
vectorunder(text, model, normalize).
get
get(*, text:str, model:str, normalize:bool) -> list[float] | None
Return the cached vector for (text, model, normalize).
Returns:
list[float] | None– The cached vector, orNoneon a miss.
set
set(*, text:str, model:str, normalize:bool, vector:list[float]) -> None
Store vector under (text, model, normalize).