One common concern of developers building AI applications is how fast answers from LLMs will be served to their end users, as well as how much these answers can be reused. To address this, caches are often used, and Redis is certainly one of the best options to implement this at the speed and scale developers need. However, reusing exact matches from the cache is just part of the history. There is also the need for some special type of cache capable of reusing answers based on the semantic meaning of questions, so different users asking for the same thing can leverage the same response. This is why Redis created a semantic cache: a special type of cache capable of applying vector searches on previously stored answers. In this video, Ricardo Ferreira, Developer Advocate at Redis, shows how to implement a semantic cache using LangChain. He shows how to integrate this cache with a LLM powered by OpenAI to reuse answers stored at Redis.
00:00 What is the use case?
01:45 Setting up Redis
03:50 Redis as standard cache
10:00 Redis as semantic cache
17:00 Deleting the data
🧑🏻💻 GitHub repository:
▪️ LangChain apps with Redis: https://github.com/redis-developer/langchain-apps-with-redis
💡 Creating an OpenAI API key:
▪️ https://platform.openai.com/docs/quickstart