mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
Getting SQL cmd directly from SQLDatabase Chain. (#7940)
- Description: Get SQL Cmd directly generated by SQL-Database Chain without executing it in the DB engine. - Issue: #4853 - Tag maintainer: @hinthornw,@baskaryan --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
5a084e1b20
commit
355b7d8b86
@ -41,6 +41,8 @@ class SQLDatabaseChain(Chain):
|
||||
"""Number of results to return from the query"""
|
||||
input_key: str = "query" #: :meta private:
|
||||
output_key: str = "result" #: :meta private:
|
||||
return_sql: bool = False
|
||||
"""Will return sql-command directly without executing it"""
|
||||
return_intermediate_steps: bool = False
|
||||
"""Whether or not to return the intermediate steps along with the final answer."""
|
||||
return_direct: bool = False
|
||||
@ -117,6 +119,8 @@ class SQLDatabaseChain(Chain):
|
||||
callbacks=_run_manager.get_child(),
|
||||
**llm_inputs,
|
||||
).strip()
|
||||
if self.return_sql:
|
||||
return {self.output_key: sql_cmd}
|
||||
if not self.use_query_checker:
|
||||
_run_manager.on_text(sql_cmd, color="green", verbose=self.verbose)
|
||||
intermediate_steps.append(
|
||||
|
Loading…
Reference in New Issue
Block a user