-
Notifications
You must be signed in to change notification settings - Fork 9
Add new RAG tutorial #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| ### Using Redis for Retrieval Augmented Generation (RAG) use cases | ||
|
|
||
| RAG is a method that enhances the capabilities of generative AI models by integrating them with Redis vector databases. | ||
| This approach allows the AI to retrieve relevant information in real-time, improving the accuracy and relevance of generated content. | ||
| Redis, with its high performance and versatile data structures, is an excellent choice for implementing RAG. | ||
| Here's an overview of how Redis can be leveraged in a RAG use case. | ||
|
|
||
| ### The role of Redis in RAG | ||
|
|
||
| Redis provides a robust platform for managing the data retrieval process in RAG. | ||
| It supports the storage and retrieval of vectors, which are essential for handling large-scale, unstructured data and performing similarity searches. | ||
| Here are some key features and components of Redis that make it suitable for RAG: | ||
|
|
||
| 1. **Redis as a vector database**: The following set of tutorials provide examples of how to use Redis as a vector database: | ||
| - [Basic vector search ](redisinsight:_?tutorialId=vss-vectors-basic) | ||
| - [Advanced vector search](redisinsight:_?tutorialId=vss-vectors-adv-hash) | ||
|
|
||
| 1. **Redis Vector Library (RedisVL)**: This library is designed to enhance the development of generative AI applications by efficiently managing vector data. It allows the storage of embeddings (vector representations of text) and facilitates fast similarity searches, which are crucial for retrieving relevant information in RAG. | ||
|
|
||
| 1. **Integration with AI frameworks**: Redis integrates seamlessly with various AI frameworks and tools. For instance, combining Redis with LangChain, a library for building language models, enables developers to create sophisticated RAG pipelines. This integration allows for efficient data management and retrieval operations that support real-time AI applications. | ||
|
|
||
| 1. **High performance and scalability**: Redis is known for its low latency and high throughput, which are essential for real-time applications. Its in-memory data store ensures quick access to data, making it ideal for applications requiring rapid data retrieval and generation. | ||
|
|
||
| 1. **Spring AI and Redis**: Using Spring AI with Redis simplifies the process of building RAG applications. Spring AI provides a structured approach to integrating AI capabilities into applications, while Redis handles the data management aspect, ensuring that the RAG pipeline is efficient and scalable. | ||
|
|
||
| ### Benefits of Using Redis for RAG | ||
|
|
||
| - **Efficiency**: The in-memory data store of Redis ensures that retrieval operations are performed with minimal latency, which is crucial for real-time applications. | ||
| - **Scalability**: Redis can handle large volumes of data and scale horizontally, making it suitable for applications with growing data needs. | ||
| - **Flexibility**: The support for various data structures and integration with different AI frameworks in Redis allows for flexible and adaptable RAG pipelines. | ||
|
|
||
| ### Build a RAG application with Redis | ||
|
|
||
| To build a RAG application with Redis, the following are some general steps: | ||
|
|
||
| 1. **Set up Redis**: Start by setting up a Redis instance and configuring it to handle vector data. [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials) is a great way to get started quickly. The RedisVL library will be instrumental here, as it provides the necessary tools for storing vector embeddings and simplifying vector search. | ||
|
|
||
| 1. **Embed and store data**: Convert your data into vector embeddings using a suitable model (e.g., BERT, GPT). Store these embeddings in Redis, where they can be quickly retrieved based on vector searches. | ||
|
|
||
| 1. **Integrate with a generative model**: Use a generative AI model that can leverage the retrieved data. The model will use the vectors stored in Redis to augment its generation process, ensuring that the output is informed by relevant, up-to-date information. | ||
|
|
||
| 1. **Query and generate**: Implement the query logic that retrieves relevant vectors from Redis based on the input prompt. Feed these vectors into the generative model to produce augmented outputs. | ||
|
|
||
| In summary, Redis offers a powerful and efficient platform for implementing Retrieval Augmented Generation. Its vector management capabilities, high performance, and seamless integration with AI frameworks make it an ideal choice if you are looking to enhance your generative AI applications with real-time data retrieval. | ||
|
|
||
| ### Resources | ||
|
|
||
| - [RAG defined](https://redis.io/glossary/retrieval-augmented-generation/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials). | ||
| - [RAG overview](https://redis.io/kb/doc/2ok7xd1drq/how-to-perform-retrieval-augmented-generation-rag-with-redis?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials). | ||
| - [Redis Vector Library (RedisVL)](https://redis.io/docs/latest/integrate/redisvl/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials) and [introductory article](https://redis.io/blog/introducing-the-redis-vector-library-for-enhancing-genai-development/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials). | ||
| - [RAG with Redis and SpringAI](https://redis.io/blog/building-a-rag-application-with-redis-and-spring-ai/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.