{
  "id": 5,
  "title": "Text To SQL",
  "description": "An agent that converts user queries into SQL statements. You must prepare three knowledge bases: 1: DDL for your database; 2: Examples of user queries converted to SQL statements; 3: A comprehensive description of your database, including but not limited to tables and records.",
  "canvas_type": "chatbot",
  "dsl": {
    "answer": [],
    "components": {
      "Answer:SocialAdsWonder": {
        "downstream": [
          "Retrieval:TrueCornersJam",
          "Retrieval:EasyDryersShop",
          "Retrieval:LazyChefsWatch"
        ],
        "obj": {
          "component_name": "Answer",
          "inputs": [],
          "output": null,
          "params": {
            "debug_inputs": [],
            "inputs": [],
            "message_history_window_size": 22,
            "output": null,
            "output_var_name": "output",
            "post_answers": [],
            "query": []
          }
        },
        "upstream": [
          "begin",
          "Generate:CurlyFalconsWorry"
        ]
      },
      "Generate:CurlyFalconsWorry": {
        "downstream": [
          "Answer:SocialAdsWonder"
        ],
        "obj": {
          "component_name": "Generate",
          "inputs": [],
          "output": null,
          "params": {
            "cite": false,
            "debug_inputs": [],
            "frequency_penalty": 0.7,
            "inputs": [],
            "llm_id": "deepseek-chat@DeepSeek",
            "max_tokens": 0,
            "message_history_window_size": 1,
            "output": null,
            "output_var_name": "output",
            "parameters": [],
            "presence_penalty": 0.4,
            "prompt": "##The user provides a question and you provide SQL. You will only respond with SQL code and not with any explanations.\n\n##Respond with only SQL code. Do not answer with any explanations -- just the code.\n\n##You may use the following DDL statements as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:TrueCornersJam}.\n\n##You may use the following documentation as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:LazyChefsWatch}.\n\n##You may use the following SQL statements as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:EasyDryersShop}.\n\n",
            "query": [],
            "temperature": 0.1,
            "top_p": 0.3
          }
        },
        "upstream": [
          "Retrieval:LazyChefsWatch",
          "Retrieval:EasyDryersShop",
          "Retrieval:TrueCornersJam"
        ]
      },
      "Retrieval:EasyDryersShop": {
        "downstream": [
          "Generate:CurlyFalconsWorry"
        ],
        "obj": {
          "component_name": "Retrieval",
          "inputs": [],
          "output": null,
          "params": {
            "debug_inputs": [],
            "empty_response": "Nothing found in Q-SQL!",
            "inputs": [],
            "kb_ids": [],
            "keywords_similarity_weight": 0.3,
            "message_history_window_size": 22,
            "output": null,
            "output_var_name": "output",
            "query": [],
            "rerank_id": "",
            "similarity_threshold": 0.2,
            "top_k": 1024,
            "top_n": 8
          }
        },
        "upstream": [
          "Answer:SocialAdsWonder"
        ]
      },
      "Retrieval:LazyChefsWatch": {
        "downstream": [
          "Generate:CurlyFalconsWorry"
        ],
        "obj": {
          "component_name": "Retrieval",
          "inputs": [],
          "output": null,
          "params": {
            "debug_inputs": [],
            "empty_response": "Nothing found in DB-Description!",
            "inputs": [],
            "kb_ids": [],
            "keywords_similarity_weight": 0.3,
            "message_history_window_size": 22,
            "output": null,
            "output_var_name": "output",
            "query": [],
            "rerank_id": "",
            "similarity_threshold": 0.2,
            "top_k": 1024,
            "top_n": 8
          }
        },
        "upstream": [
          "Answer:SocialAdsWonder"
        ]
      },
      "Retrieval:TrueCornersJam": {
        "downstream": [
          "Generate:CurlyFalconsWorry"
        ],
        "obj": {
          "component_name": "Retrieval",
          "inputs": [],
          "output": null,
          "params": {
            "debug_inputs": [],
            "empty_response": "Nothing found in DDL!",
            "inputs": [],
            "kb_ids": [],
            "keywords_similarity_weight": 0.3,
            "message_history_window_size": 22,
            "output": null,
            "output_var_name": "output",
            "query": [],
            "rerank_id": "",
            "similarity_threshold": 0.02,
            "top_k": 1024,
            "top_n": 8
          }
        },
        "upstream": [
          "Answer:SocialAdsWonder"
        ]
      },
      "begin": {
        "downstream": [
          "Answer:SocialAdsWonder"
        ],
        "obj": {
          "component_name": "Begin",
          "inputs": [],
          "output": null,
          "params": {
            "debug_inputs": [],
            "inputs": [],
            "message_history_window_size": 22,
            "output": null,
            "output_var_name": "output",
            "prologue": "Hi! I'm your smart assistant. What can I do for you?",
            "query": []
          }
        },
        "upstream": []
      }
    },
    "embed_id": "",
    "graph": {
      "edges": [
        {
          "id": "reactflow__edge-begin-Answer:SocialAdsWonderc",
          "markerEnd": "logo",
          "source": "begin",
          "sourceHandle": null,
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Answer:SocialAdsWonder",
          "targetHandle": "c",
          "type": "buttonEdge"
        },
        {
          "id": "reactflow__edge-Answer:SocialAdsWonderb-Retrieval:TrueCornersJamc",
          "markerEnd": "logo",
          "source": "Answer:SocialAdsWonder",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Retrieval:TrueCornersJam",
          "targetHandle": "c",
          "type": "buttonEdge"
        },
        {
          "id": "reactflow__edge-Answer:SocialAdsWonderb-Retrieval:EasyDryersShopc",
          "markerEnd": "logo",
          "source": "Answer:SocialAdsWonder",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Retrieval:EasyDryersShop",
          "targetHandle": "c",
          "type": "buttonEdge"
        },
        {
          "id": "reactflow__edge-Answer:SocialAdsWonderb-Retrieval:LazyChefsWatchc",
          "markerEnd": "logo",
          "source": "Answer:SocialAdsWonder",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Retrieval:LazyChefsWatch",
          "targetHandle": "c",
          "type": "buttonEdge"
        },
        {
          "id": "xy-edge__Retrieval:LazyChefsWatchb-Generate:CurlyFalconsWorryb",
          "markerEnd": "logo",
          "source": "Retrieval:LazyChefsWatch",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Generate:CurlyFalconsWorry",
          "targetHandle": "b",
          "type": "buttonEdge",
          "zIndex": 1001
        },
        {
          "id": "xy-edge__Retrieval:EasyDryersShopb-Generate:CurlyFalconsWorryb",
          "markerEnd": "logo",
          "source": "Retrieval:EasyDryersShop",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Generate:CurlyFalconsWorry",
          "targetHandle": "b",
          "type": "buttonEdge",
          "zIndex": 1001
        },
        {
          "id": "xy-edge__Retrieval:TrueCornersJamb-Generate:CurlyFalconsWorryb",
          "markerEnd": "logo",
          "source": "Retrieval:TrueCornersJam",
          "sourceHandle": "b",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Generate:CurlyFalconsWorry",
          "targetHandle": "b",
          "type": "buttonEdge",
          "zIndex": 1001
        },
        {
          "id": "xy-edge__Generate:CurlyFalconsWorryc-Answer:SocialAdsWonderc",
          "markerEnd": "logo",
          "source": "Generate:CurlyFalconsWorry",
          "sourceHandle": "c",
          "style": {
            "stroke": "rgb(202 197 245)",
            "strokeWidth": 2
          },
          "target": "Answer:SocialAdsWonder",
          "targetHandle": "c",
          "type": "buttonEdge",
          "zIndex": 1001
        }
      ],
      "nodes": [
        {
          "data": {
            "label": "Begin",
            "name": "begin"
          },
          "dragging": false,
          "height": 44,
          "id": "begin",
          "measured": {
            "height": 44,
            "width": 100
          },
          "position": {
            "x": -520.486587527275,
            "y": 117.87988995940702
          },
          "positionAbsolute": {
            "x": -520.486587527275,
            "y": 117.87988995940702
          },
          "selected": false,
          "sourcePosition": "left",
          "targetPosition": "right",
          "type": "beginNode"
        },
        {
          "data": {
            "form": {},
            "label": "Answer",
            "name": "interface"
          },
          "dragging": false,
          "height": 44,
          "id": "Answer:SocialAdsWonder",
          "measured": {
            "height": 44,
            "width": 200
          },
          "position": {
            "x": -237.69220760465112,
            "y": 119.9282206409824
          },
          "positionAbsolute": {
            "x": -284.9289105495367,
            "y": 119.9282206409824
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "logicNode",
          "width": 200
        },
        {
          "data": {
            "form": {
              "empty_response": "Nothing found in DDL!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.02,
              "top_n": 8
            },
            "label": "Retrieval",
            "name": "DDL"
          },
          "dragging": false,
          "height": 44,
          "id": "Retrieval:TrueCornersJam",
          "measured": {
            "height": 44,
            "width": 200
          },
          "position": {
            "x": 119.61927071085717,
            "y": -40.184181873335746
          },
          "positionAbsolute": {
            "x": 119.61927071085717,
            "y": -40.184181873335746
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "retrievalNode",
          "width": 200
        },
        {
          "data": {
            "form": {
              "empty_response": "Nothing found in Q-SQL!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.2,
              "top_n": 8
            },
            "label": "Retrieval",
            "name": "Q->SQL"
          },
          "dragging": false,
          "height": 44,
          "id": "Retrieval:EasyDryersShop",
          "measured": {
            "height": 44,
            "width": 200
          },
          "position": {
            "x": 80.07777425685605,
            "y": 120.03075150115158
          },
          "positionAbsolute": {
            "x": 81.2024576603057,
            "y": 94.16303322180948
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "retrievalNode",
          "width": 200
        },
        {
          "data": {
            "form": {
              "empty_response": "Nothing found in DB-Description!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.2,
              "top_n": 8
            },
            "label": "Retrieval",
            "name": "DB Description"
          },
          "dragging": false,
          "height": 44,
          "id": "Retrieval:LazyChefsWatch",
          "measured": {
            "height": 44,
            "width": 200
          },
          "position": {
            "x": 51.228157704293324,
            "y": 252.77721891325103
          },
          "positionAbsolute": {
            "x": 51.228157704293324,
            "y": 252.77721891325103
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "retrievalNode",
          "width": 200
        },
        {
          "data": {
            "form": {
              "text": "Receives a sentence that the user wants to convert into SQL and displays the result of the large model's SQL conversion."
            },
            "label": "Note",
            "name": "N: Interface"
          },
          "dragHandle": ".note-drag-handle",
          "dragging": false,
          "height": 132,
          "id": "Note:GentleRabbitsWonder",
          "measured": {
            "height": 132,
            "width": 324
          },
          "position": {
            "x": -287.3066094433631,
            "y": -30.808189185380513
          },
          "positionAbsolute": {
            "x": -287.3066094433631,
            "y": -30.808189185380513
          },
          "resizing": false,
          "selected": false,
          "sourcePosition": "right",
          "style": {
            "height": 132,
            "width": 324
          },
          "targetPosition": "left",
          "type": "noteNode",
          "width": 324
        },
        {
          "data": {
            "form": {
              "text": "The large model learns which tables may be available based on the responses from three knowledge bases and converts the user's input into SQL statements."
            },
            "label": "Note",
            "name": "N: LLM"
          },
          "dragHandle": ".note-drag-handle",
          "dragging": false,
          "height": 163,
          "id": "Note:SixCitiesJoke",
          "measured": {
            "height": 163,
            "width": 334
          },
          "position": {
            "x": 19.243366453487255,
            "y": 531.9336820600888
          },
          "positionAbsolute": {
            "x": 5.12121582244032,
            "y": 637.6539219843564
          },
          "resizing": false,
          "selected": false,
          "sourcePosition": "right",
          "style": {
            "height": 147,
            "width": 326
          },
          "targetPosition": "left",
          "type": "noteNode",
          "width": 334
        },
        {
          "data": {
            "form": {
              "text": "Searches for description about meanings of  tables and fields."
            },
            "label": "Note",
            "name": "N: DB description"
          },
          "dragHandle": ".note-drag-handle",
          "dragging": false,
          "height": 128,
          "id": "Note:FamousCarpetsTaste",
          "measured": {
            "height": 128,
            "width": 269
          },
          "position": {
            "x": 399.9267065852242,
            "y": 250.0329701879931
          },
          "positionAbsolute": {
            "x": 399.9267065852242,
            "y": 250.0329701879931
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "noteNode",
          "width": 269
        },
        {
          "data": {
            "form": {
              "text": "Searches for samples about question to SQL.\nPlease check this dataset: https://huggingface.co/datasets/InfiniFlow/text2sql"
            },
            "label": "Note",
            "name": "N: Q->SQL"
          },
          "dragHandle": ".note-drag-handle",
          "dragging": false,
          "height": 140,
          "id": "Note:PoliteBeesArrive",
          "measured": {
            "height": 140,
            "width": 455
          },
          "position": {
            "x": 491.0393427986917,
            "y": 96.58232093146341
          },
          "positionAbsolute": {
            "x": 489.0393427986917,
            "y": 96.58232093146341
          },
          "resizing": false,
          "selected": false,
          "sourcePosition": "right",
          "style": {
            "height": 130,
            "width": 451
          },
          "targetPosition": "left",
          "type": "noteNode",
          "width": 455
        },
        {
          "data": {
            "form": {
              "text": "DDL(Data Definition Language).\n\nSearches for relevant database creation statements.\n\nIt should bind with a KB to which DDL is dumped in.\nYou could use  'General' as parsing method and ';' as delimiter."
            },
            "label": "Note",
            "name": "N: DDL"
          },
          "dragHandle": ".note-drag-handle",
          "dragging": false,
          "height": 272,
          "id": "Note:SmartWingsDouble",
          "measured": {
            "height": 272,
            "width": 288
          },
          "position": {
            "x": 406.6930553966363,
            "y": -208.84980249039137
          },
          "positionAbsolute": {
            "x": 404.1930553966363,
            "y": -208.84980249039137
          },
          "resizing": false,
          "selected": false,
          "sourcePosition": "right",
          "style": {
            "height": 258,
            "width": 283
          },
          "targetPosition": "left",
          "type": "noteNode",
          "width": 288
        },
        {
          "data": {
            "form": {
              "cite": false,
              "frequencyPenaltyEnabled": true,
              "frequency_penalty": 0.7,
              "llm_id": "deepseek-chat@DeepSeek",
              "maxTokensEnabled": false,
              "max_tokens": 256,
              "message_history_window_size": 1,
              "parameter": "Precise",
              "parameters": [],
              "presencePenaltyEnabled": true,
              "presence_penalty": 0.4,
              "prompt": "##The user provides a question and you provide SQL. You will only respond with SQL code and not with any explanations.\n\n##Respond with only SQL code. Do not answer with any explanations -- just the code.\n\n##You may use the following DDL statements as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:TrueCornersJam}.\n\n##You may use the following documentation as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:LazyChefsWatch}.\n\n##You may use the following SQL statements as a reference for what tables might be available. Use responses to past questions also to guide you: {Retrieval:EasyDryersShop}.\n\n",
              "temperature": 0.1,
              "temperatureEnabled": true,
              "topPEnabled": true,
              "top_p": 0.3
            },
            "label": "Generate",
            "name": "GenSQL"
          },
          "dragging": false,
          "id": "Generate:CurlyFalconsWorry",
          "measured": {
            "height": 106,
            "width": 200
          },
          "position": {
            "x": 10.728415797190792,
            "y": 410.2569651241076
          },
          "selected": false,
          "sourcePosition": "right",
          "targetPosition": "left",
          "type": "generateNode"
        }
      ]
    },
    "history": [],
    "messages": [],
    "path": [],
    "reference": []
  },
  "avatar": "data:image/png;base64,[encoded data, 18788 characters]"
}
