3 ms·
Typically you feed the schema in as context and literally just ask the model to turn it into SQL. So a prompt of the format "Given this schema {schema}, turn t
by lgas 3y ago
Typically you feed the schema in as context and literally just ask the model to turn it into SQL. So a prompt of the format "Given this schema {schema}, turn this query into SQL. {query}. Return the SQL and nothing else."
- sroussey 3y agoI would guess a codex llm would do that, but hopefully the question by the user doesn’t end up being a delete statement, lol.
- lgas 3y agoYou can either have it show you the statement to confirm before executing it, or if you only want to do queries you can use a read-only database connection.
- sroussey 3y agoOr perhaps create a lot of “known” queries as templates with good paragraph explanations and use the question to do a search for the known query. I’m new to AI so curious how it’s best utilized.