This page describes how Memorystore for Valkey supports storing and querying vector data for generative AI applications, such as Retrieval Augmented Generation (RAG) and LangChain, by using vector search capabilities.
Use vector search for generative AI with LangChain
Vector search on Memorystore for Valkey is compatible with the open-source LLM framework LangChain. Using vector search with LangChain lets you build solutions for the following use cases:
- RAG
- LLM cache
- Recommendation engine
- Semantic search
- Image similarity search
Benefits of vector search for generative AI in Memorystore for Valkey
The advantage of using Memorystore to store your generative AI data, compared to other Google Cloud databases is its speed. Vector search on Memorystore for Valkey leverages multi-threaded queries, resulting in high query throughput (QPS) at low latency.
Approaches to using vector search for generative AI in Memorystore for Valkey
Memorystore also provides two distinct search approaches to help
you find the right balance between speed and accuracy. The Hierarchical
Navigable Small World (HNSW) option delivers fast, approximate results — ideal
for large datasets where a close match is sufficient. If you require absolute
precision, the FLAT approach produces exact answers, though it might take
slightly longer to process.
If you want to optimize your application for the fastest vector data read and write speeds, then Memorystore for Valkey is likely the best option for you.