Name | Description |
---|---|
query-sql | Input to this tool is a detailed and correct SQL query, output is a result from the database. If the query is not correct, an error message will be returned. If an error is returned, rewrite the query, check the query, and try again. |
info-sql | Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables. Be sure that the tables actually exist by calling list-tables-sql first! Example Input: “table1, table2, table3”. |
list-tables-sql | Input is an empty string, output is a comma-separated list of tables in the database. |
query-checker | Use this tool to double check if your query is correct before executing it. Always use this tool before executing a query with query-sql! |
Setup
This example uses Chinook database, which is a sample database available for SQL Server, Oracle, MySQL, etc. To set it up, follow these instructions, placing the.db
file in the directory where your code lives.
If you want to get automated tracing from runs of individual tools, you can also set your LangSmith API key by uncommenting below:
Installation
This toolkit lives in thelangchain
package. You’ll also need to install the typeorm
peer dependency.