{
  "format": 4,
  "name": "rag-handbook",
  "nodes": [
    {
      "id": "Index",
      "type": "core.trigger.manual",
      "config": {},
      "pos": [
        0,
        -40
      ]
    },
    {
      "id": "Handbook",
      "type": "core.file.read",
      "config": {
        "path": "handbook.md"
      },
      "pos": [
        0,
        330
      ]
    },
    {
      "id": "Chunks",
      "type": "core.data.chunk",
      "config": {
        "size": 800,
        "overlap": 120,
        "by": "chars"
      },
      "pos": [
        396,
        330
      ]
    },
    {
      "id": "Vector Store",
      "type": "core.store.vectors",
      "config": {},
      "pos": [
        0,
        650
      ]
    },
    {
      "id": "Clear",
      "type": "core.vectors",
      "config": {
        "operation": "clear",
        "namespace": "handbook"
      },
      "pos": [
        396,
        -40
      ]
    },
    {
      "id": "Each chunk",
      "type": "core.flow.for_each",
      "config": {},
      "pos": [
        792,
        0
      ]
    },
    {
      "id": "Embed chunk",
      "type": "core.ai.embed",
      "config": {},
      "pos": [
        1188,
        -260
      ]
    },
    {
      "id": "Add",
      "type": "core.vectors",
      "config": {
        "operation": "index",
        "namespace": "handbook"
      },
      "pos": [
        1668,
        400
      ]
    },
    {
      "id": "Question",
      "type": "core.trigger.chat",
      "config": {
        "placeholder": "Ask the handbook..."
      },
      "pos": [
        0,
        2340
      ]
    },
    {
      "id": "Embed question",
      "type": "core.ai.embed",
      "config": {},
      "pos": [
        396,
        1980
      ]
    },
    {
      "id": "Excerpts",
      "type": "core.vectors",
      "config": {
        "operation": "search",
        "namespace": "handbook",
        "top_k": 4,
        "min_score": 0.3
      },
      "pos": [
        792,
        1280
      ]
    },
    {
      "id": "Prompt",
      "type": "core.data.template",
      "config": {
        "template": "Answer from the handbook excerpts below in plain text, with no markdown. Write two parts: a one-sentence answer, then the rule you used, quoted on its own line starting with \"Handbook:\". If they do not cover it, say so.\n\nExcerpts:\n{excerpts}\n\nQuestion: {question}"
      },
      "pos": [
        1188,
        1678
      ]
    },
    {
      "id": "LLM",
      "type": "core.ai.llm",
      "config": {},
      "pos": [
        1584,
        1700
      ]
    },
    {
      "id": "Chat",
      "type": "core.output.chat",
      "config": {},
      "pos": [
        1980,
        2340
      ]
    }
  ],
  "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": "Handbook",
      "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": "Excerpts",
      "dst_port": "trigger"
    },
    {
      "src": "Vector Store",
      "src_port": "vectors",
      "dst": "Excerpts",
      "dst_port": "vectors"
    },
    {
      "src": "Embed question",
      "src_port": "embedding",
      "dst": "Excerpts",
      "dst_port": "embedding"
    },
    {
      "src": "Excerpts",
      "src_port": "trigger",
      "dst": "Prompt",
      "dst_port": "trigger"
    },
    {
      "src": "Excerpts",
      "src_port": "results",
      "dst": "Prompt",
      "dst_port": "excerpts"
    },
    {
      "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"
    }
  ]
}
