{
  "format": 1,
  "name": "rag-notes",
  "nodes": [
    {
      "id": "Index",
      "type": "core.trigger.manual",
      "config": {},
      "pos": [
        0,
        0
      ]
    },
    {
      "id": "Notes",
      "type": "core.file.read",
      "config": {
        "path": "notes.md"
      },
      "pos": [
        0,
        300
      ]
    },
    {
      "id": "Chunks",
      "type": "core.data.chunk",
      "config": {
        "size": 800,
        "overlap": 120,
        "by": "chars"
      },
      "pos": [
        440,
        340
      ]
    },
    {
      "id": "Vector Store",
      "type": "core.store.vectors",
      "config": {},
      "pos": [
        0,
        660
      ]
    },
    {
      "id": "Clear",
      "type": "core.vectors",
      "config": {
        "operation": "clear",
        "namespace": "notes"
      },
      "pos": [
        440,
        0
      ]
    },
    {
      "id": "Each chunk",
      "type": "core.flow.for_each",
      "config": {},
      "pos": [
        880,
        120
      ]
    },
    {
      "id": "Embed chunk",
      "type": "core.ai.embed",
      "config": {},
      "pos": [
        1320,
        220
      ]
    },
    {
      "id": "Add",
      "type": "core.vectors",
      "config": {
        "operation": "index",
        "namespace": "notes"
      },
      "pos": [
        1760,
        0
      ]
    },
    {
      "id": "Question",
      "type": "core.trigger.chat",
      "config": {
        "placeholder": "Ask about your notes..."
      },
      "pos": [
        0,
        1220
      ]
    },
    {
      "id": "Embed question",
      "type": "core.ai.embed",
      "config": {},
      "pos": [
        440,
        1380
      ]
    },
    {
      "id": "Relevant notes",
      "type": "core.vectors",
      "config": {
        "operation": "search",
        "namespace": "notes",
        "top_k": 4,
        "min_score": 0.3
      },
      "pos": [
        880,
        1340
      ]
    },
    {
      "id": "Prompt",
      "type": "core.data.template",
      "config": {
        "template": "Answer the question using the notes below. If they do not cover it, say so.\n\nNotes:\n{relevant_notes}\n\nQuestion: {question}"
      },
      "pos": [
        1320,
        1200
      ]
    },
    {
      "id": "LLM",
      "type": "core.ai.llm",
      "config": {},
      "pos": [
        1760,
        1140
      ]
    },
    {
      "id": "Chat",
      "type": "core.output.chat",
      "config": {},
      "pos": [
        2200,
        1000
      ]
    }
  ],
  "edges": [
    {
      "src": "Index",
      "src_port": "trigger",
      "dst": "Clear",
      "dst_port": "trigger"
    },
    {
      "src": "Vector Store",
      "src_port": "vectors",
      "dst": "Clear",
      "dst_port": "vectors"
    },
    {
      "src": "Clear",
      "src_port": "trigger",
      "dst": "Each chunk",
      "dst_port": "trigger"
    },
    {
      "src": "Notes",
      "src_port": "text",
      "dst": "Chunks",
      "dst_port": "text"
    },
    {
      "src": "Chunks",
      "src_port": "out",
      "dst": "Each chunk",
      "dst_port": "list"
    },
    {
      "src": "Each chunk",
      "src_port": "each",
      "dst": "Embed chunk",
      "dst_port": "trigger"
    },
    {
      "src": "Each chunk",
      "src_port": "item",
      "dst": "Embed chunk",
      "dst_port": "text"
    },
    {
      "src": "Embed chunk",
      "src_port": "trigger",
      "dst": "Add",
      "dst_port": "trigger"
    },
    {
      "src": "Vector Store",
      "src_port": "vectors",
      "dst": "Add",
      "dst_port": "vectors"
    },
    {
      "src": "Embed chunk",
      "src_port": "embedding",
      "dst": "Add",
      "dst_port": "embedding"
    },
    {
      "src": "Each chunk",
      "src_port": "item",
      "dst": "Add",
      "dst_port": "text"
    },
    {
      "src": "Add",
      "src_port": "trigger",
      "dst": "Each chunk",
      "dst_port": "loop"
    },
    {
      "src": "Question",
      "src_port": "trigger",
      "dst": "Embed question",
      "dst_port": "trigger"
    },
    {
      "src": "Question",
      "src_port": "text",
      "dst": "Embed question",
      "dst_port": "text"
    },
    {
      "src": "Embed question",
      "src_port": "trigger",
      "dst": "Relevant notes",
      "dst_port": "trigger"
    },
    {
      "src": "Vector Store",
      "src_port": "vectors",
      "dst": "Relevant notes",
      "dst_port": "vectors"
    },
    {
      "src": "Embed question",
      "src_port": "embedding",
      "dst": "Relevant notes",
      "dst_port": "embedding"
    },
    {
      "src": "Relevant notes",
      "src_port": "trigger",
      "dst": "Prompt",
      "dst_port": "trigger"
    },
    {
      "src": "Relevant notes",
      "src_port": "results",
      "dst": "Prompt",
      "dst_port": "relevant_notes"
    },
    {
      "src": "Question",
      "src_port": "text",
      "dst": "Prompt",
      "dst_port": "question"
    },
    {
      "src": "Prompt",
      "src_port": "trigger",
      "dst": "LLM",
      "dst_port": "trigger"
    },
    {
      "src": "Prompt",
      "src_port": "out",
      "dst": "LLM",
      "dst_port": "prompt"
    },
    {
      "src": "Question",
      "src_port": "trigger",
      "dst": "Chat",
      "dst_port": "user_trigger"
    },
    {
      "src": "Question",
      "src_port": "text",
      "dst": "Chat",
      "dst_port": "user"
    },
    {
      "src": "LLM",
      "src_port": "trigger",
      "dst": "Chat",
      "dst_port": "reply_trigger"
    },
    {
      "src": "LLM",
      "src_port": "response",
      "dst": "Chat",
      "dst_port": "reply"
    }
  ]
}
