{
    "description": "Answer questions over a SQL database",
    "nodes": [
        {
            "width": 300,
            "height": 522,
            "id": "chatOpenAI_0",
            "position": {
                "x": 855.0396169649254,
                "y": 179.29430548099504
            },
            "type": "customNode",
            "data": {
                "id": "chatOpenAI_0",
                "label": "ChatOpenAI",
                "version": 3,
                "name": "chatOpenAI",
                "type": "ChatOpenAI",
                "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel"],
                "category": "Chat Models",
                "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
                "inputParams": [
                    {
                        "label": "Connect Credential",
                        "name": "credential",
                        "type": "credential",
                        "credentialNames": ["openAIApi"],
                        "id": "chatOpenAI_0-input-credential-credential"
                    },
                    {
                        "label": "Model Name",
                        "name": "modelName",
                        "type": "options",
                        "options": [
                            {
                                "label": "gpt-4",
                                "name": "gpt-4"
                            },
                            {
                                "label": "gpt-4-turbo-preview",
                                "name": "gpt-4-turbo-preview"
                            },
                            {
                                "label": "gpt-4-0125-preview",
                                "name": "gpt-4-0125-preview"
                            },
                            {
                                "label": "gpt-4-1106-preview",
                                "name": "gpt-4-1106-preview"
                            },
                            {
                                "label": "gpt-4-vision-preview",
                                "name": "gpt-4-vision-preview"
                            },
                            {
                                "label": "gpt-4-0613",
                                "name": "gpt-4-0613"
                            },
                            {
                                "label": "gpt-4-32k",
                                "name": "gpt-4-32k"
                            },
                            {
                                "label": "gpt-4-32k-0613",
                                "name": "gpt-4-32k-0613"
                            },
                            {
                                "label": "gpt-3.5-turbo",
                                "name": "gpt-3.5-turbo"
                            },
                            {
                                "label": "gpt-3.5-turbo-1106",
                                "name": "gpt-3.5-turbo-1106"
                            },
                            {
                                "label": "gpt-3.5-turbo-0613",
                                "name": "gpt-3.5-turbo-0613"
                            },
                            {
                                "label": "gpt-3.5-turbo-16k",
                                "name": "gpt-3.5-turbo-16k"
                            },
                            {
                                "label": "gpt-3.5-turbo-16k-0613",
                                "name": "gpt-3.5-turbo-16k-0613"
                            }
                        ],
                        "default": "gpt-3.5-turbo",
                        "optional": true,
                        "id": "chatOpenAI_0-input-modelName-options"
                    },
                    {
                        "label": "Temperature",
                        "name": "temperature",
                        "type": "number",
                        "default": 0.9,
                        "optional": true,
                        "id": "chatOpenAI_0-input-temperature-number"
                    },
                    {
                        "label": "Max Tokens",
                        "name": "maxTokens",
                        "type": "number",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-maxTokens-number"
                    },
                    {
                        "label": "Top Probability",
                        "name": "topP",
                        "type": "number",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-topP-number"
                    },
                    {
                        "label": "Frequency Penalty",
                        "name": "frequencyPenalty",
                        "type": "number",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-frequencyPenalty-number"
                    },
                    {
                        "label": "Presence Penalty",
                        "name": "presencePenalty",
                        "type": "number",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-presencePenalty-number"
                    },
                    {
                        "label": "Timeout",
                        "name": "timeout",
                        "type": "number",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-timeout-number"
                    },
                    {
                        "label": "BasePath",
                        "name": "basepath",
                        "type": "string",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-basepath-string"
                    },
                    {
                        "label": "BaseOptions",
                        "name": "baseOptions",
                        "type": "json",
                        "optional": true,
                        "additionalParams": true,
                        "id": "chatOpenAI_0-input-baseOptions-json"
                    }
                ],
                "inputAnchors": [
                    {
                        "label": "Cache",
                        "name": "cache",
                        "type": "BaseCache",
                        "optional": true,
                        "id": "chatOpenAI_0-input-cache-BaseCache"
                    }
                ],
                "inputs": {
                    "modelName": "gpt-3.5-turbo",
                    "temperature": "0",
                    "maxTokens": "",
                    "topP": "",
                    "frequencyPenalty": "",
                    "presencePenalty": "",
                    "timeout": "",
                    "basepath": "",
                    "baseOptions": ""
                },
                "outputAnchors": [
                    {
                        "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
                        "name": "chatOpenAI",
                        "label": "ChatOpenAI",
                        "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel"
                    }
                ],
                "outputs": {},
                "selected": false
            },
            "selected": false,
            "positionAbsolute": {
                "x": 855.0396169649254,
                "y": 179.29430548099504
            },
            "dragging": false
        },
        {
            "width": 300,
            "height": 475,
            "id": "sqlDatabaseChain_0",
            "position": {
                "x": 1206.5244299447634,
                "y": 201.04431101230608
            },
            "type": "customNode",
            "data": {
                "id": "sqlDatabaseChain_0",
                "label": "Sql Database Chain",
                "version": 4,
                "name": "sqlDatabaseChain",
                "type": "SqlDatabaseChain",
                "baseClasses": ["SqlDatabaseChain", "BaseChain", "Runnable"],
                "category": "Chains",
                "description": "Answer questions over a SQL database",
                "inputParams": [
                    {
                        "label": "Database",
                        "name": "database",
                        "type": "options",
                        "options": [
                            {
                                "label": "SQLite",
                                "name": "sqlite"
                            },
                            {
                                "label": "PostgreSQL",
                                "name": "postgres"
                            },
                            {
                                "label": "MSSQL",
                                "name": "mssql"
                            },
                            {
                                "label": "MySQL",
                                "name": "mysql"
                            }
                        ],
                        "default": "sqlite",
                        "id": "sqlDatabaseChain_0-input-database-options"
                    },
                    {
                        "label": "Connection string or file path (sqlite only)",
                        "name": "url",
                        "type": "string",
                        "placeholder": "1270.0.0.1:5432/chinook",
                        "id": "sqlDatabaseChain_0-input-url-string"
                    },
                    {
                        "label": "Include Tables",
                        "name": "includesTables",
                        "type": "string",
                        "description": "Tables to include for queries, seperated by comma. Can only use Include Tables or Ignore Tables",
                        "placeholder": "table1, table2",
                        "additionalParams": true,
                        "optional": true,
                        "id": "sqlDatabaseChain_0-input-includesTables-string"
                    },
                    {
                        "label": "Ignore Tables",
                        "name": "ignoreTables",
                        "type": "string",
                        "description": "Tables to ignore for queries, seperated by comma. Can only use Ignore Tables or Include Tables",
                        "placeholder": "table1, table2",
                        "additionalParams": true,
                        "optional": true,
                        "id": "sqlDatabaseChain_0-input-ignoreTables-string"
                    },
                    {
                        "label": "Sample table's rows info",
                        "name": "sampleRowsInTableInfo",
                        "type": "number",
                        "description": "Number of sample row for tables to load for info.",
                        "placeholder": "3",
                        "additionalParams": true,
                        "optional": true,
                        "id": "sqlDatabaseChain_0-input-sampleRowsInTableInfo-number"
                    },
                    {
                        "label": "Top Keys",
                        "name": "topK",
                        "type": "number",
                        "description": "If you are querying for several rows of a table you can select the maximum number of results you want to get by using the top_k parameter (default is 10). This is useful for avoiding query results that exceed the prompt max length or consume tokens unnecessarily.",
                        "placeholder": "10",
                        "additionalParams": true,
                        "optional": true,
                        "id": "sqlDatabaseChain_0-input-topK-number"
                    },
                    {
                        "label": "Custom Prompt",
                        "name": "customPrompt",
                        "type": "string",
                        "description": "You can provide custom prompt to the chain. This will override the existing default prompt used. See <a target=\"_blank\" href=\"https://python.langchain.com/docs/integrations/tools/sqlite#customize-prompt\">guide</a>",
                        "warning": "Prompt must include 3 input variables: {input}, {dialect}, {table_info}. You can refer to official guide from description above",
                        "rows": 4,
                        "placeholder": "Given an input question, first create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer. Unless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most {top_k} results. You can order the results by a relevant column to return the most interesting examples in the database.\n\nNever query for all the columns from a specific table, only ask for a the few relevant columns given the question.\n\nPay attention to use only the column names that you can see in the schema description. Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.\n\nUse the following format:\n\nQuestion: \"Question here\"\nSQLQuery: \"SQL Query to run\"\nSQLResult: \"Result of the SQLQuery\"\nAnswer: \"Final answer here\"\n\nOnly use the tables listed below.\n\n{table_info}\n\nQuestion: {input}",
                        "additionalParams": true,
                        "optional": true,
                        "id": "sqlDatabaseChain_0-input-customPrompt-string"
                    }
                ],
                "inputAnchors": [
                    {
                        "label": "Language Model",
                        "name": "model",
                        "type": "BaseLanguageModel",
                        "id": "sqlDatabaseChain_0-input-model-BaseLanguageModel"
                    }
                ],
                "inputs": {
                    "model": "{{chatOpenAI_0.data.instance}}",
                    "database": "sqlite",
                    "url": "",
                    "customPrompt": ""
                },
                "outputAnchors": [
                    {
                        "id": "sqlDatabaseChain_0-output-sqlDatabaseChain-SqlDatabaseChain|BaseChain|Runnable",
                        "name": "sqlDatabaseChain",
                        "label": "SqlDatabaseChain",
                        "type": "SqlDatabaseChain | BaseChain | Runnable"
                    }
                ],
                "outputs": {},
                "selected": false
            },
            "selected": false,
            "positionAbsolute": {
                "x": 1206.5244299447634,
                "y": 201.04431101230608
            },
            "dragging": false
        }
    ],
    "edges": [
        {
            "source": "chatOpenAI_0",
            "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel",
            "target": "sqlDatabaseChain_0",
            "targetHandle": "sqlDatabaseChain_0-input-model-BaseLanguageModel",
            "type": "buttonedge",
            "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel-sqlDatabaseChain_0-sqlDatabaseChain_0-input-model-BaseLanguageModel",
            "data": {
                "label": ""
            }
        }
    ]
}
