I've managed to get the example to work by tweaking the requirements, but even after running the example
import duckdb
from llama_cpp import Llama
from wurlitzer import pipes
from examples.utils import generate_sql
# Set up client with model path and context size
with pipes() as (out, err):
client = Llama(
model_path="examples/DuckDB-NSQL-7B-v0.1-q8_0.gguf",
n_ctx=2048,
)
# Connect to DuckDB database
con = duckdb.connect("examples/nyc.duckdb")
# Sample question for SQL generation
question = "get all columns from taxi table starting with 'a'"
# Generate SQL, check validity, and print
query = generate_sql(question, con, client)
print(query)
print(con.execute(query).fetchdf())
The output I get for the query doesn't seem to correspond to the intention:
It's not outputting the columns that start with a. It's not even outputting rows for columns that start with a. In fact, it seems to be emitting all the rows from the taxi table.
If the LLM can't produce basic queries, I have little hope for it doing anything more useful.
I've managed to get the example to work by tweaking the requirements, but even after running the example
The output I get for the query doesn't seem to correspond to the intention:
It's not outputting the columns that start with a. It's not even outputting rows for columns that start with a. In fact, it seems to be emitting all the rows from the
taxi
table.If the LLM can't produce basic queries, I have little hope for it doing anything more useful.