You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constdefaultPrompt=`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.
14
+
15
+
Never query for all the columns from a specific table, only ask for a the few relevant columns given the question.
16
+
17
+
Pay 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.
18
+
19
+
Use the following format:
20
+
21
+
Question: "Question here"
22
+
SQLQuery: "SQL Query to run"
23
+
SQLResult: "Result of the SQLQuery"
24
+
Answer: "Final answer here"
25
+
26
+
Only use the tables listed below.
27
+
28
+
{table_info}
29
+
30
+
Question: {input}`
31
+
12
32
classSqlDatabaseChain_ChainsimplementsINode{
13
33
label: string
14
34
name: string
@@ -23,7 +43,7 @@ class SqlDatabaseChain_Chains implements INode {
23
43
constructor(){
24
44
this.label='Sql Database Chain'
25
45
this.name='sqlDatabaseChain'
26
-
this.version=1.0
46
+
this.version=2.0
27
47
this.type='SqlDatabaseChain'
28
48
this.icon='sqlchain.svg'
29
49
this.category='Chains'
@@ -64,6 +84,19 @@ class SqlDatabaseChain_Chains implements INode {
64
84
name: 'url',
65
85
type: 'string',
66
86
placeholder: '1270.0.0.1:5432/chinook'
87
+
},
88
+
{
89
+
label: 'Custom Prompt',
90
+
name: 'customPrompt',
91
+
type: 'string',
92
+
description:
93
+
'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>',
94
+
warning:
95
+
'Prompt must include 3 input variables: {input}, {dialect}, {table_info}. You can refer to official guide from description above',
96
+
rows: 4,
97
+
placeholder: defaultPrompt,
98
+
additionalParams: true,
99
+
optional: true
67
100
}
68
101
]
69
102
}
@@ -72,17 +105,19 @@ class SqlDatabaseChain_Chains implements INode {
"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>",
214
+
"warning": "Prompt must include 3 input variables: {input}, {dialect}, {table_info}. You can refer to official guide from description above",
215
+
"rows": 4,
216
+
"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}",
0 commit comments