CacheBackedEmbeddings(
self,
underlying_embeddings: Embeddings,
document_embedding_store: BaseStore[str, list[float]],Interface for caching results from embedding models.
The interface allows works with any store that implements the abstract store interface accepting keys of type str and values of list of floats.
If need be, the interface can be extended to accept other implementations of the value serializer and deserializer, as well as the key encoder.
Note that by default only document embeddings are cached. To cache query embeddings too, pass in a query_embedding_store to constructor.
The number of documents to embed between store updates.
The store to use for caching query embeddings.
If None, query embeddings are not cached.