langchain[patch]: allow to use partial variables in create_sql_query_chain (#22688)

- **Description:** allow to use partial variables to pass `top_k` and
`table_info`
- **Issue:** no
- **Dependencies:** no
- **Twitter handle:** @gymnstcs

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
pull/21573/merge
Naka Masato 4 months ago committed by GitHub
parent 2b5631a6be
commit 3237909221
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -116,7 +116,9 @@ def create_sql_query_chain(
prompt_to_use = SQL_PROMPTS[db.dialect]
else:
prompt_to_use = PROMPT
if {"input", "top_k", "table_info"}.difference(prompt_to_use.input_variables):
if {"input", "top_k", "table_info"}.difference(
prompt_to_use.input_variables + list(prompt_to_use.partial_variables)
):
raise ValueError(
f"Prompt must have input variables: 'input', 'top_k', "
f"'table_info'. Received prompt with input variables: "

Loading…
Cancel
Save