= embedder.embed_documents(["welcome", "goodbye"])embeddings = embedder.embed_documents(["welcome", "goodbye"])list(store.yield_keys())list(store.client.scan(0))Redis Store‚Äãfrom langchain.storage import RedisStore# For cache isolation can use a separate DB# Or additional namepacestore = RedisStore(redis_url="redis://localhost:6379", client_kwargs={'db': 2}, namespace='embedding_caches')underlying_embeddings = OpenAIEmbeddings()embedder = CacheBackedEmbeddings.from_bytes_store(    underlying_embeddings, store, namespace=underlying_embeddings.model)embeddings = embedder.embed_documents(["hello", "goodbye"])    CPU times: user 3.99 ms, sys: 0 ns, total: 3.99 ms    Wall time: 3.5 msembeddings = embedder.embed_documents(["hello", "goodbye"])    CPU times: user 2.47 ms, sys: 767 ¬µs, total: 3.24 ms    Wall time: 2.75 mslist(store.yield_keys())    ['text-embedding-ada-002e885db5b-c0bd-5fbc-88b1-4d1da6020aa5',     'text-embedding-ada-0026ba52e44-59c9-5cc9-a084-284061b13c80']list(store.client.scan_iter())    [b'embedding_caches/text-embedding-ada-002e885db5b-c0bd-5fbc-88b1-4d1da6020aa5',     b'embedding_caches/text-embedding-ada-0026ba52e44-59c9-5cc9-a084-284061b13c80']PreviousText embedding modelsNextVector storesUsing with a vector storeIn MemoryFile systemUpstash Redis StoreRedis StoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Embeddings can be stored or temporarily cached to avoid needing to recompute them.
Embeddings can be stored or temporarily cached to avoid needing to recompute them. ->: = embedder.embed_documents(["welcome", "goodbye"])embeddings = embedder.embed_documents(["welcome", "goodbye"])list(store.yield_keys())list(store.client.scan(0))Redis Store‚Äãfrom langchain.storage import RedisStore# For cache isolation can use a separate DB# Or additional namepacestore = RedisStore(redis_url="redis://localhost:6379", client_kwargs={'db': 2}, namespace='embedding_caches')underlying_embeddings = OpenAIEmbeddings()embedder = CacheBackedEmbeddings.from_bytes_store(    underlying_embeddings, store, namespace=underlying_embeddings.model)embeddings = embedder.embed_documents(["hello", "goodbye"])    CPU times: user 3.99 ms, sys: 0 ns, total: 3.99 ms    Wall time: 3.5 msembeddings = embedder.embed_documents(["hello", "goodbye"])    CPU times: user 2.47 ms, sys: 767 ¬µs, total: 3.24 ms    Wall time: 2.75 mslist(store.yield_keys())    ['text-embedding-ada-002e885db5b-c0bd-5fbc-88b1-4d1da6020aa5',     'text-embedding-ada-0026ba52e44-59c9-5cc9-a084-284061b13c80']list(store.client.scan_iter())    [b'embedding_caches/text-embedding-ada-002e885db5b-c0bd-5fbc-88b1-4d1da6020aa5',     b'embedding_caches/text-embedding-ada-0026ba52e44-59c9-5cc9-a084-284061b13c80']PreviousText embedding modelsNextVector storesUsing with a vector storeIn MemoryFile systemUpstash Redis StoreRedis StoreCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.