{
  "name": "Ask Your Docs",
  "description": "Ask questions about your indexed documents and get answers from a local model — on-device RAG, no account.",
  "tags": [
    "rag",
    "knowledge base",
    "on-device ai",
    "documents",
    "search",
    "questions"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "📚 Ask questions about your own documents.\n\nType a question, press Run, and a local model answers from the documents you've indexed into a knowledge base — nothing leaves your device. Pick a knowledge base and a model the first time.\n\nNeeds live QA: RAG dependency wiring is unverified."
      },
      "type": "stickyNote",
      "width": 360,
      "height": 230
    },
    {
      "id": "trigger-run",
      "position": {
        "x": 100,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:whenStarted"
        },
        "label": "Run now",
        "inputs": {},
        "parameters": {
          "notes": "Starts the workflow when you press Run."
        }
      },
      "type": "trigger"
    },
    {
      "id": "question",
      "position": {
        "x": 420,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:editFields"
        },
        "label": "Your question",
        "inputs": {
          "fields": {
            "question": {
              "type": "string",
              "value": "What are the key points from my indexed documents about onboarding?"
            }
          }
        },
        "parameters": {
          "notes": "Type the question you want answered from your documents. Replace the sample with your own."
        }
      },
      "type": "basic"
    },
    {
      "id": "rag",
      "position": {
        "x": 740,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:agent:ragAgent"
        },
        "label": "Answer from your docs",
        "inputs": {
          "prompt": "{{ $input.question }}",
          "options": {
            "systemMessage": "Answer using only the retrieved documents. If they don't cover it, say so.",
            "retrieverK": 4
          }
        },
        "parameters": {
          "notes": "Retrieves the most relevant chunks from your knowledge base and answers from them.\n\nUNVERIFIED: model on dependency-0 and knowledge on dependency-2 per the node map; needs live QA."
        }
      },
      "type": "agent"
    },
    {
      "id": "local-model",
      "position": {
        "x": 660,
        "y": 560
      },
      "data": {
        "instance": {
          "id": "af-base-node:dependency:webLLM"
        },
        "label": "Local AI model",
        "inputs": {
          "model": "",
          "options": {
            "temperature": 0.3
          }
        },
        "parameters": {
          "notes": "Runs the answers locally in your browser. Pick a model the first time — it downloads once, then works offline."
        }
      },
      "type": "dependency"
    },
    {
      "id": "knowledge",
      "position": {
        "x": 900,
        "y": 560
      },
      "data": {
        "instance": {
          "id": "af-base-node:dependency:localKnowledge"
        },
        "label": "Local knowledge base",
        "inputs": {
          "knowledge": ""
        },
        "parameters": {
          "notes": "The knowledge base your documents are indexed into. Pick one the first time you run this."
        }
      },
      "type": "dependency"
    },
    {
      "id": "show-answer",
      "position": {
        "x": 1080,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Show the answer",
        "inputs": {
          "title": "Answer",
          "content": "{{ $input.response }}"
        },
        "parameters": {
          "notes": "Displays the answer drawn from your documents."
        }
      },
      "type": "basic"
    },
    {
      "id": "sticky-model",
      "position": {
        "x": 660,
        "y": 720
      },
      "data": {
        "color": "#c9f0d1",
        "content": "Setup needed: pick a local model and a knowledge base the first time. Index your documents first with the Index Notes to Knowledge workflow, then ask questions here. Everything stays on your device."
      },
      "type": "stickyNote",
      "width": 340,
      "height": 140
    }
  ],
  "edges": [
    {
      "id": "e-run-question",
      "type": "flowEdge",
      "source": "trigger-run",
      "target": "question"
    },
    {
      "id": "e-question-rag",
      "type": "flowEdge",
      "source": "question",
      "target": "rag"
    },
    {
      "id": "e-rag-model",
      "type": "flowEdge",
      "source": "rag",
      "target": "local-model",
      "sourceHandle": "dependency-0"
    },
    {
      "id": "e-rag-knowledge",
      "type": "flowEdge",
      "source": "rag",
      "target": "knowledge",
      "sourceHandle": "dependency-2"
    },
    {
      "id": "e-rag-show",
      "type": "flowEdge",
      "source": "rag",
      "target": "show-answer"
    }
  ]
}