Summary This post will cover the usage of guardrails in the context of an RAG application using Redis Stack as the vector store. Nvidia's guardrail package is used for the railed implementation. Langchain LCEL is used for the non-railed implementation. Content from the online Redis vector search documentation is used for the RAG content GUI is implemented with Chainlit Application Architecture This bot is operating within a Chainlit app. It has two modes of operation: 'chain' - no guardrails 'rails' - NeMo guardrails in place for both user inputs and LLM outputs Screenshots Bot without rails This first screenshot shows the bot operating with no guardrails. It does just fine until an off-topic question is posed - then it cheerfully deviates from its purpose. Bot with rails Same series of questions here with guardrails enabled. Note that it keeps the user on topic now. Code Snippets Non-railed chain (LCEL) Railed with NeMO Guardrails Source https://github.com/redis-developer/llm-redisrail Copyright ©2024 Joey E Whelan, All rights reserved.