langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Choose number of sample rows to add to table_info for SQLDatabase

Open jzluo opened this issue 1 year ago • 2 comments

#782 added the ability to include a sample row of a table to the prompt to provide more context for the model. As demonstrated in this paper, performance increases with the number of rows provided, up to 3 in their tests. This PR builds on #782 to allow for selecting the number of rows to include.

Also, a few of the outputs in the sqlite example notebook were incorrect for the chinook db - there are 8 entries in the employee table, not 9.

jzluo avatar Feb 03 '23 22:02 jzluo

Ah yeah I was thinking about making a change to keep the original sample_row_in_table_info: bool and instead adding an additional parameter for number of rows to include with default 1, which should keep it backwards compatible. Is something like that what you had in mind?

jzluo avatar Feb 04 '23 18:02 jzluo

Ah yeah I was thinking about making a change to keep the original sample_row_in_table_info: bool and instead adding an additional parameter for number of rows to include with default 1, which should keep it backwards compatible. Is something like that what you had in mind?

yeah exactly!

hwchase17 avatar Feb 05 '23 06:02 hwchase17