LLM generates SQL queries randomly and not based on the specified tables. #2147
Unanswered
anonymously-coded
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to create a SQL chatbot that can communicate with the live database. I am using MySQL. I followed all the steps given in the SQL Q&A Guide by the flowise documentation. The chain is the same as the document. But instead of one table I used 3 tables, The llm generates queries randomly and not based on the given tables, for example I have table called app_user, when a question like "Who is ramesh?" is asked it queries like "select * from users where name ='ramesh'". Even thought the table it should look is app_user it looks for users tables and when executing the query it fails. Can anyone help me with this??
This is the code I use to create the schema for my prompt.
const HOST = 'localhost';
const USER = 'root';
const PASSWORD = 'toor';
const DATABASE = 'customerdb';
const TABLES = ['app_user', 'company', 'user_company'];
const mysql = require('mysql2/promise');
let sql_schema_prompt_for_all_tables = '';
function get_sql_schema_prompt() {
return new Promise(async (resolve, reject) => {
try {
const db_conn = mysql.createPool({
host: HOST,
user: USER,
password: PASSWORD,
database: DATABASE,
});
}
async function main() {
await get_sql_schema_prompt();
console.log(sql_schema_prompt_for_all_tables);
}
main();
Thanks in advance for you help.
Beta Was this translation helpful? Give feedback.
All reactions