From 4c79100b1565d7b27234a6914a60eb779d4d9b24 Mon Sep 17 00:00:00 2001 From: Zach Schillaci <40636930+zachschillaci27@users.noreply.github.com> Date: Fri, 3 Feb 2023 17:34:41 +0100 Subject: [PATCH] Correct prompt typo + update example for SQLDatabaseChain (#868) See https://github.com/hwchase17/langchain/issues/821 --- docs/modules/chains/examples/sqlite.ipynb | 9 +++++++++ langchain/chains/sql_database/prompt.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/modules/chains/examples/sqlite.ipynb b/docs/modules/chains/examples/sqlite.ipynb index 548ca4c693..aaea8fbf83 100644 --- a/docs/modules/chains/examples/sqlite.ipynb +++ b/docs/modules/chains/examples/sqlite.ipynb @@ -56,6 +56,15 @@ "llm = OpenAI(temperature=0)" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "id": "3d1e692e", + "metadata": {}, + "source": [ + "**NOTE:** For data-sensitive projects, you can specify `return_direct=True` in the `SQLDatabaseChain` initialization to directly return the output of the SQL query without any additional formatting. This prevents the LLM from seeing any contents within the database. Note, however, the LLM still has access to the database scheme (i.e. dialect, table and key names) by default." + ] + }, { "cell_type": "code", "execution_count": 3, diff --git a/langchain/chains/sql_database/prompt.py b/langchain/chains/sql_database/prompt.py index 253b619cef..2b2a97cf69 100644 --- a/langchain/chains/sql_database/prompt.py +++ b/langchain/chains/sql_database/prompt.py @@ -26,7 +26,7 @@ PROMPT = PromptTemplate( template=_DEFAULT_TEMPLATE, ) -_DECIDER_TEMPLATE = """Given the below input question and list of potential tables, output a comma separated list of the table names that may be neccessary to answer this question. +_DECIDER_TEMPLATE = """Given the below input question and list of potential tables, output a comma separated list of the table names that may be necessary to answer this question. Question: {query}