This page describes how Memorystore for Redis Cluster supports storing and querying vector
data for generative AI applications, such as Retrieval Augmented Generation
(RAG) and LangChain, by using vector search capabilities.

> [!IMPORTANT]
> **Important:** If you [created your cluster](https://docs.cloud.google.com/memorystore/docs/cluster/create-instances) before the feature launch date of September 13, 2024, then to use vector search, you must create another cluster.

## Use vector search for generative AI with LangChain

Vector search on Memorystore for Redis Cluster is compatible with the open-source LLM
framework [LangChain](https://python.langchain.com/docs/get_started/introduction).
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 Redis Cluster

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 Redis Cluster leverages multi-threaded queries,
resulting in high query throughput (QPS) at low latency.

## Approaches to using vector search for generative AI in Memorystore for Redis Cluster

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, then 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 Redis Cluster is likely the best option for you.