mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
info sql tool remove whitespaces in table names (#13712)
Remove whitespaces from the input of the ListSQLDatabaseTool for better support. for example, the input "table1,table2,table3" will throw an exception whiteout the change although it's a valid input. --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
64d5108f99
commit
8f403ea2d7
@ -60,7 +60,9 @@ class InfoSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
|
|||||||
run_manager: Optional[CallbackManagerForToolRun] = None,
|
run_manager: Optional[CallbackManagerForToolRun] = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Get the schema for tables in a comma-separated list."""
|
"""Get the schema for tables in a comma-separated list."""
|
||||||
return self.db.get_table_info_no_throw(table_names.split(", "))
|
return self.db.get_table_info_no_throw(
|
||||||
|
[t.strip() for t in table_names.split(",")]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ListSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
|
class ListSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
|
||||||
|
Loading…
Reference in New Issue
Block a user