{
  "id": 0,
  "title": "Chat bot",
  "description": "A general chat bot. It is based on Self-RAG mechanism. What you need to do is setting up knowleage base in 'Retrieval'",
  "canvas_type": "chatbot",
  "dsl": {
      "answer": [],
      "components": {
        "answer:0": {
          "downstream": ["retrieval:0"],
          "obj": {
            "component_name": "Answer",
            "params": {}
          },
          "upstream": ["begin", "generate:0"]
        },
        "begin": {
          "downstream": ["answer:0"],
          "obj": {
            "component_name": "Begin",
            "params": {
              "prologue": "Hi there!"
            }
          },
          "upstream": []
        },
        "generate:0": {
          "downstream": ["answer:0"],
          "obj": {
            "component_name": "Generate",
            "params": {
              "llm_id": "deepseek-chat",
              "prompt": "You are an intelligent assistant. Please answer the question based on content of knowledge base. When all knowledge base content is irrelevant to the question, your answer must include the sentence \"The answer you are looking for is not found in the knowledge base!\". Answers need to consider chat history.\n      Knowledge base content is as following:\n      {input}\n      The above is the content of knowledge base."
            }
          },
          "upstream": ["relevant:0"]
        },
        "relevant:0": {
          "downstream": ["rewrite:0", "generate:0"],
          "obj": {
            "component_name": "Relevant",
            "params": {
              "llm_id": "deepseek-chat",
              "no": "rewrite:0",
              "temperature": 0.02,
              "yes": "generate:0"
            }
          },
          "upstream": ["retrieval:0"]
        },
        "retrieval:0": {
          "downstream": ["relevant:0"],
          "obj": {
            "component_name": "Retrieval",
            "params": {
              "empty_response": "Sorry, knowledge base has noting related information.",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "rerank_id": "BAAI/bge-reranker-v2-m3",
              "similarity_threshold": 0.2,
              "top_k": 1024,
              "top_n": 6
            }
          },
          "upstream": ["answer:0", "rewrite:0"]
        },
        "rewrite:0": {
          "downstream": ["retrieval:0"],
          "obj": {
            "component_name": "RewriteQuestion",
            "params": {
              "llm_id": "deepseek-chat",
              "temperature": 0.8
            }
          },
          "upstream": ["relevant:0"]
        }
      },
      "graph": {
        "edges": [
          {
            "id": "81de838d-a541-4b3f-9d68-9172ffd7c6b4",
            "label": "",
            "source": "begin",
            "target": "answer:0"
          },
          {
            "id": "reactflow__edge-answer:0b-retrieval:0c",
            "markerEnd": "logo",
            "source": "answer:0",
            "sourceHandle": "b",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "retrieval:0",
            "targetHandle": "c",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-generate:0d-answer:0a",
            "markerEnd": "logo",
            "source": "generate:0",
            "sourceHandle": "d",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "answer:0",
            "targetHandle": "a",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-retrieval:0a-relevant:0b",
            "markerEnd": "logo",
            "source": "retrieval:0",
            "sourceHandle": "a",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "relevant:0",
            "targetHandle": "b",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-rewrite:0d-retrieval:0b",
            "markerEnd": "logo",
            "source": "rewrite:0",
            "sourceHandle": "d",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "retrieval:0",
            "targetHandle": "b",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-relevant:0no-rewrite:0a",
            "markerEnd": "logo",
            "source": "relevant:0",
            "sourceHandle": "no",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "rewrite:0",
            "targetHandle": "a",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-relevant:0yes-generate:0b",
            "markerEnd": "logo",
            "source": "relevant:0",
            "sourceHandle": "yes",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "generate:0",
            "targetHandle": "b",
            "type": "buttonEdge"
          }
        ],
        "nodes": [
          {
            "data": {
              "form": {
                "prologue": "Hi there!"
              },
              "label": "Begin",
              "name": "Opening"
            },
            "dragging": false,
            "height": 50,
            "id": "begin",
            "position": {
              "x": -304.50000000000006,
              "y": -2.9994670375766646
            },
            "positionAbsolute": {
              "x": -304.50000000000006,
              "y": -2.9994670375766646
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "beginNode",
            "width": 50
          },
          {
            "data": {
              "form": {},
              "label": "Answer",
              "name": "Interface"
            },
            "dragging": false,
            "height": 100,
            "id": "answer:0",
            "position": {
              "x": -89.78929141627594,
              "y": -29.530900170597448
            },
            "positionAbsolute": {
              "x": -89.78929141627594,
              "y": -29.530900170597448
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "ragNode",
            "width": 100
          },
          {
            "data": {
              "form": {
                "empty_response": "Sorry, knowledge base has noting related information.",
                "kb_ids": [],
                "keywords_similarity_weight": 0.3,
                "rerank_id": "BAAI/bge-reranker-v2-m3",
                "similarity_threshold": 0.2,
                "top_k": 1024,
                "top_n": 6
              },
              "label": "Retrieval",
              "name": "Search KB"
            },
            "dragging": false,
            "height": 100,
            "id": "retrieval:0",
            "position": {
              "x": 225.1100159655728,
              "y": -28.569259485130402
            },
            "positionAbsolute": {
              "x": 225.1100159655728,
              "y": -28.569259485130402
            },
            "selected": true,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "ragNode",
            "width": 100
          },
          {
            "data": {
              "form": {
                "llm_id": "deepseek-chat",
                "no": "rewrite:0",
                "temperature": 0.02,
                "yes": "generate:0"
              },
              "label": "Relevant",
              "name": "Relevant?"
            },
            "dragging": false,
            "height": 70,
            "id": "relevant:0",
            "position": {
              "x": 225.36494412049518,
              "y": 307.7194989687223
            },
            "positionAbsolute": {
              "x": 225.36494412049518,
              "y": 307.7194989687223
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "relevantNode",
            "width": 70
          },
          {
            "data": {
              "form": {
                "llm_id": "deepseek-chat",
                "prompt": "You are an intelligent assistant. Please answer the question based on content of knowledge base. When all knowledge base content is irrelevant to the question, your answer must include the sentence \"The answer you are looking for is not found in the knowledge base!\". Answers need to consider chat history.\n      Knowledge base content is as following:\n      {input}\n      The above is the content of knowledge base.",
                "temperature": 0.02
              },
              "label": "Generate",
              "name": "LLM"
            },
            "dragging": false,
            "height": 150,
            "id": "generate:0",
            "position": {
              "x": -90.09669656497177,
              "y": 192.12280240375043
            },
            "positionAbsolute": {
              "x": -90.09669656497177,
              "y": 192.12280240375043
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "ragNode",
            "width": 150
          },
          {
            "data": {
              "form": {
                "llm_id": "deepseek-chat",
                "temperature": 0.8
              },
              "label": "RewriteQuestion",
              "name": "Refine Ques"
            },
            "dragging": false,
            "height": 70,
            "id": "rewrite:0",
            "position": {
              "x": 416.0628662660416,
              "y": 144.09722952739514
            },
            "positionAbsolute": {
              "x": 416.0628662660416,
              "y": 144.09722952739514
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "ragNode",
            "width": 70
          }
        ]
      },
      "history": [],
      "messages": [],
      "path": [],
      "reference": []
    },
  "avatar": "data:image/jpeg;base64,[encoded data, 37028 characters]"
}