{
  "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": {
        "begin": {
          "obj": {
            "component_name": "Begin",
            "params": {}
          },
          "downstream": [
            "Answer:SocialAdsWonder"
          ],
          "upstream": []
        },
        "Answer:SocialAdsWonder": {
          "obj": {
            "component_name": "Answer",
            "params": {}
          },
          "downstream": [
            "Retrieval:TrueCornersJam",
            "Retrieval:EasyDryersShop",
            "Retrieval:LazyChefsWatch"
          ],
          "upstream": [
            "begin",
            "Generate:RareSymbolsGrin"
          ]
        },
        "Retrieval:TrueCornersJam": {
          "obj": {
            "component_name": "Retrieval",
            "params": {
              "empty_response": "Nothing found in DDL!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.02,
              "top_n": 8
            }
          },
          "downstream": [
            "Generate:RareSymbolsGrin"
          ],
          "upstream": [
            "Answer:SocialAdsWonder"
          ]
        },
        "Retrieval:EasyDryersShop": {
          "obj": {
            "component_name": "Retrieval",
            "params": {
              "empty_response": "Nothing found in Q-SQL!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.2,
              "top_n": 8
            }
          },
          "downstream": [
            "Generate:RareSymbolsGrin"
          ],
          "upstream": [
            "Answer:SocialAdsWonder"
          ]
        },
        "Retrieval:LazyChefsWatch": {
          "obj": {
            "component_name": "Retrieval",
            "params": {
              "empty_response": "Nothing found in DB-Description!",
              "kb_ids": [],
              "keywords_similarity_weight": 0.3,
              "similarity_threshold": 0.2,
              "top_n": 8
            }
          },
          "downstream": [
            "Generate:RareSymbolsGrin"
          ],
          "upstream": [
            "Answer:SocialAdsWonder"
          ]
        },
        "Generate:RareSymbolsGrin": {
          "obj": {
            "component_name": "Generate",
            "params": {
              "cite": true,
              "frequency_penalty": 0.7,
              "llm_id": "deepseek-chat@DeepSeek",
              "max_tokens": 256,
              "message_history_window_size": 12,
              "parameters": [
                {
                  "component_id": "Retrieval:TrueCornersJam",
                  "id": "78644673-9236-4605-8110-59705fc38784",
                  "key": "ddl_input"
                },
                {
                  "component_id": "Retrieval:LazyChefsWatch",
                  "id": "afbf91ce-6f58-4573-b02d-9a4973f124f4",
                  "key": "db_input"
                },
                {
                  "component_id": "Retrieval:EasyDryersShop",
                  "id": "ee2b84f4-1cf5-43be-80e6-60bfaea3d834",
                  "key": "sql_input"
                }
              ],
              "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: {ddl_input}.\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: {db_input}.\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: {sql_input}.",
              "temperature": 0.1,
              "top_p": 0.3
            }
          },
          "downstream": [
            "Answer:SocialAdsWonder"
          ],
          "upstream": [
            "Retrieval:TrueCornersJam",
            "Retrieval:EasyDryersShop",
            "Retrieval:LazyChefsWatch"
          ]
        }
      },
      "embed_id": "",
      "graph": {
        "nodes": [
          {
            "data": {
              "label": "Begin",
              "name": "begin"
            },
            "dragging": false,
            "height": 44,
            "id": "begin",
            "position": {
              "x": -520.486587527275,
              "y": 117.87988995940702
            },
            "positionAbsolute": {
              "x": -520.486587527275,
              "y": 117.87988995940702
            },
            "selected": false,
            "sourcePosition": "left",
            "targetPosition": "right",
            "type": "beginNode",
            "width": 100
          },
          {
            "data": {
              "form": {},
              "label": "Answer",
              "name": "interface"
            },
            "dragging": false,
            "height": 44,
            "id": "Answer:SocialAdsWonder",
            "position": {
              "x": -284.9289105495367,
              "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",
            "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",
            "position": {
              "x": 81.2024576603057,
              "y": 94.16303322180948
            },
            "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",
            "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": {
                "cite": true,
                "frequencyPenaltyEnabled": true,
                "frequency_penalty": 0.7,
                "llm_id": "deepseek-chat@DeepSeek",
                "maxTokensEnabled": true,
                "max_tokens": 256,
                "message_history_window_size": 12,
                "parameter": "Precise",
                "parameters": [
                  {
                    "component_id": "Retrieval:TrueCornersJam",
                    "id": "78644673-9236-4605-8110-59705fc38784",
                    "key": "ddl_input"
                  },
                  {
                    "component_id": "Retrieval:LazyChefsWatch",
                    "id": "afbf91ce-6f58-4573-b02d-9a4973f124f4",
                    "key": "db_input"
                  },
                  {
                    "component_id": "Retrieval:EasyDryersShop",
                    "id": "ee2b84f4-1cf5-43be-80e6-60bfaea3d834",
                    "key": "sql_input"
                  }
                ],
                "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: {ddl_input}.\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: {db_input}.\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: {sql_input}.",
                "temperature": 0.1,
                "temperatureEnabled": true,
                "topPEnabled": true,
                "top_p": 0.3
              },
              "label": "Generate",
              "name": "LLM"
            },
            "dragging": false,
            "height": 212,
            "id": "Generate:RareSymbolsGrin",
            "position": {
              "x": 6.6098512156750076,
              "y": 405.0105548561454
            },
            "positionAbsolute": {
              "x": 6.6098512156750076,
              "y": 405.0105548561454
            },
            "selected": false,
            "sourcePosition": "right",
            "targetPosition": "left",
            "type": "generateNode",
            "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"
            },
            "dragging": false,
            "height": 132,
            "id": "Note:GentleRabbitsWonder",
            "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,
            "dragHandle": ".note-drag-handle"
          },
          {
            "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"
            },
            "dragging": false,
            "height": 147,
            "id": "Note:SixCitiesJoke",
            "position": {
              "x": 5.12121582244032,
              "y": 637.6539219843564
            },
            "positionAbsolute": {
              "x": 5.12121582244032,
              "y": 637.6539219843564
            },
            "resizing": false,
            "selected": false,
            "sourcePosition": "right",
            "style": {
              "height": 147,
              "width": 326
            },
            "targetPosition": "left",
            "type": "noteNode",
            "width": 326,
            "dragHandle": ".note-drag-handle"
          },
          {
            "data": {
              "form": {
                "text": "Searches for description about meanings of  tables and fields."
              },
              "label": "Note",
              "name": "N: DB description"
            },
            "dragging": false,
            "height": 128,
            "id": "Note:FamousCarpetsTaste",
            "position": {
              "x": 399.9267065852242,
              "y": 250.0329701879931
            },
            "positionAbsolute": {
              "x": 399.9267065852242,
              "y": 250.0329701879931
            },
            "selected": false,
            "sourcePosition": "right",
            "targetPosition": "left",
            "type": "noteNode",
            "width": 269,
            "dragHandle": ".note-drag-handle"
          },
          {
            "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"
            },
            "dragging": false,
            "height": 130,
            "id": "Note:PoliteBeesArrive",
            "position": {
              "x": 489.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": 451,
            "dragHandle": ".note-drag-handle"
          },
          {
            "data": {
              "form": {
                "text": "DDL(Data Definition Language).\n\nSearches for relevent 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"
            },
            "dragging": false,
            "height": 258,
            "id": "Note:SmartWingsDouble",
            "position": {
              "x": 404.1930553966363,
              "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": 283,
            "dragHandle": ".note-drag-handle"
          }
        ],
        "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": "reactflow__edge-Retrieval:TrueCornersJamb-Generate:RareSymbolsGrinb",
            "markerEnd": "logo",
            "source": "Retrieval:TrueCornersJam",
            "sourceHandle": "b",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "Generate:RareSymbolsGrin",
            "targetHandle": "b",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-Retrieval:EasyDryersShopb-Generate:RareSymbolsGrinb",
            "markerEnd": "logo",
            "source": "Retrieval:EasyDryersShop",
            "sourceHandle": "b",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "Generate:RareSymbolsGrin",
            "targetHandle": "b",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-Retrieval:LazyChefsWatchb-Generate:RareSymbolsGrinb",
            "markerEnd": "logo",
            "source": "Retrieval:LazyChefsWatch",
            "sourceHandle": "b",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "Generate:RareSymbolsGrin",
            "targetHandle": "b",
            "type": "buttonEdge"
          },
          {
            "id": "reactflow__edge-Generate:RareSymbolsGrinc-Answer:SocialAdsWonderc",
            "markerEnd": "logo",
            "source": "Generate:RareSymbolsGrin",
            "sourceHandle": "c",
            "style": {
              "stroke": "rgb(202 197 245)",
              "strokeWidth": 2
            },
            "target": "Answer:SocialAdsWonder",
            "targetHandle": "c",
            "type": "buttonEdge"
          }
        ]
      },
      "history": [],
      "messages": [],
      "path": [],
      "reference": []
    },
  "avatar": "data:image/png;base64,[encoded data, 18788 characters]"
}
