2/ Creating the chatbot with Retrieval Augmented Generation (RAG) and DBRX Instruct

Our Vector Search Index is now ready!
Let's now create and deploy a new Model Serving Endpoint to perform RAG.
The flow will be the following:
- A user asks a question
- The question is sent to our serverless Chatbot RAG endpoint
- The endpoint compute the embeddings and searches for docs similar to the question, leveraging the Vector Search Index
- The endpoint creates a prompt enriched with the doc
- The prompt is sent to the DBRX Instruct Foundation Model Serving Endpoint
- We display the output to our users!

*Note: RAG performs document searches using Databricks Vector Search. In this notebook, we assume that the search index is ready for use. Make sure you run the previous [01-Data-Preparation-and-Index]($./01-Data-Preparation-and-Index [DO NOT EDIT]) notebook.*
Building our Chain
In this example, we'll assume you already have a basic understanding of langchain. Check our [previous notebook]($../00-first-step/01-First-Step-RAG-On-Databricks) to take it one step at a time!Let's deploy our RAG application and open it for external expert users
Grant stakeholders access to the Mosaic AI Agent Evaluation App
Now, grant your stakeholders permissions to use the Review App. To simplify access, stakeholders do not require to have Databricks accounts.Find review app name
If you lose this notebook's state and need to find the URL to your Review App, you can list the chatbot deployed:Congratulations! You have deployed your first GenAI RAG model!
You're now ready to deploy the same logic for your internal knowledge base leveraging Lakehouse AI.
We've seen how the Lakehouse AI is uniquely positioned to help you solve your GenAI challenge:
- Simplify Data Ingestion and preparation with Databricks Engineering Capabilities
- Accelerate Vector Search deployment with fully managed indexes
- Leverage Databricks DBRX Instruct foundation model endpoint
- Deploy realtime model endpoint to perform RAG and provide Q&A capabilities
Lakehouse AI is uniquely positioned to accelerate your GenAI deployment.
Next: Deploying our GenAI Assistant application to end users with Databricks Lakehouse Application
We are now ready to build a front end application so that our users can ask questions to the chatbot.
Open the [03-Deploy-Frontend-Lakehouse-App]($./03-Deploy-Frontend-Lakehouse-App) how to deploy your first Lakehouse Application.Cleanup
To free up resources, please delete uncomment and run the below cell.