Contact Us 1-800-596-4880

Lab 3 [Optional]: One Flow RAG

Overview

We saw in previous Lab how to perform RAG with 3 flows. But what if you wanted to perform RAG with only one flow? That’s where you can use the "Rag load document" component.

Step 1: Create a Simple RAG flow

  1. In your current project add a new flow and name this flow “ 4-RAGFlow ”. Add an HTTP Listener to the flow (just like for the previous flow). Reuse the same Connection Config (HTTP_Listener_config), and set path to “ /rag ”

    img 34

  2. Add the MuleSoft AI Chain’s “ Rag load document ” component to the flow. Click on the new components and set the properties to the following values:

    • Module configuration: MuleSoft_AI_Chain_Config (Reuse the same config created earlier)

      Parameterize “Data” and “Context Path properties by clicking ”fx” and specifying the following values:

    • Data: payload.data

    • Context path: payload.contextFile

    • File type: any

      img 35

  3. Run the project and check that it is deployed without any errors:

  4. Run the following:

    curl --location --request GET "http://localhost:8081/rag"  --header "Content-Type: application/json" --data "{\"data\":\"What is the weight of TXY?\",\"contextFile\":\"C:\\Users\\workshop\\Downloads\\MulesoftTXY.pdf\"}"

The response should look like this:

{"response":"The weight of Mulesoft TXY Noise-Cancelling Headphones is 250g, making them lightweight and travel-friendly."}

You can Download the full example from exchange.

Congratulations! You have completed this Module.

Please proceed to next Module