<mxfile host="app.diagrams.net" type="device">
  <diagram name="RAG Architecture" id="rag-arch">
    <mxGraphModel dx="900" dy="600" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="600" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="title" value="OfferReady — RAG Architecture" style="text;html=1;fontSize=18;fontStyle=1;align=left;" vertex="1" parent="1">
          <mxGeometry x="40" y="20" width="400" height="30" as="geometry" />
        </mxCell>
        <mxCell id="ingest" value="Ingestion (offline)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;verticalAlign=top;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="80" width="500" height="180" as="geometry" />
        </mxCell>
        <mxCell id="docs" value="Documents (S3)" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#6c8ebf;" vertex="1" parent="1">
          <mxGeometry x="60" y="130" width="90" height="90" as="geometry" />
        </mxCell>
        <mxCell id="chunk" value="Chunk&#10;(size + overlap)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#6c8ebf;" vertex="1" parent="1">
          <mxGeometry x="190" y="145" width="110" height="60" as="geometry" />
        </mxCell>
        <mxCell id="embedc" value="Embed chunks" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#6c8ebf;" vertex="1" parent="1">
          <mxGeometry x="330" y="145" width="90" height="60" as="geometry" />
        </mxCell>
        <mxCell id="vdb" value="Vector store&#10;(vectors + text + metadata)" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
          <mxGeometry x="450" y="130" width="70" height="90" as="geometry" />
        </mxCell>
        <mxCell id="e1" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="docs" target="chunk"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="e2" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="chunk" target="embedc"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="e3" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="embedc" target="vdb"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="query" value="Query (online)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;verticalAlign=top;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="40" y="300" width="1020" height="220" as="geometry" />
        </mxCell>
        <mxCell id="user" value="User question" style="ellipse;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#d6b656;" vertex="1" parent="1">
          <mxGeometry x="60" y="380" width="100" height="60" as="geometry" />
        </mxCell>
        <mxCell id="embq" value="Embed query" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#d6b656;" vertex="1" parent="1">
          <mxGeometry x="200" y="385" width="100" height="50" as="geometry" />
        </mxCell>
        <mxCell id="retr" value="Hybrid retrieve&#10;(vector + keyword)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#d6b656;" vertex="1" parent="1">
          <mxGeometry x="340" y="380" width="130" height="60" as="geometry" />
        </mxCell>
        <mxCell id="rerank" value="Re-rank&#10;top-k" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#d6b656;" vertex="1" parent="1">
          <mxGeometry x="510" y="385" width="90" height="50" as="geometry" />
        </mxCell>
        <mxCell id="prompt" value="Prompt:&#10;question + chunks&#10;&quot;answer only from context&quot;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#d6b656;" vertex="1" parent="1">
          <mxGeometry x="640" y="375" width="160" height="70" as="geometry" />
        </mxCell>
        <mxCell id="llm" value="LLM" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;" vertex="1" parent="1">
          <mxGeometry x="840" y="385" width="80" height="50" as="geometry" />
        </mxCell>
        <mxCell id="ans" value="Answer + citations" style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
          <mxGeometry x="950" y="380" width="100" height="60" as="geometry" />
        </mxCell>
        <mxCell id="q1" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="user" target="embq"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q2" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="embq" target="retr"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q3" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="retr" target="rerank"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q4" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="rerank" target="prompt"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q5" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="prompt" target="llm"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q6" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;" edge="1" parent="1" source="llm" target="ans"><mxGeometry relative="1" as="geometry" /></mxCell>
        <mxCell id="q7" value="top-k chunks" style="edgeStyle=orthogonalEdgeStyle;html=1;endArrow=block;dashed=1;" edge="1" parent="1" source="vdb" target="retr"><mxGeometry relative="1" as="geometry" /></mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
