Text to SQL using duckdb-nsql model via ollama

2024-03-24 aillm

DuckDB-NSQL is a text-to-SQL model with 7 billion parameters, specifically created for generating SQL queries. It builds upon Meta’s original Llama-2 7B model, undergoing additional pre-training using a dataset of general SQL queries. Subsequently, it is fine-tuned on a dataset containing DuckDB text-to-SQL pairs.

This diagram shows you how to use ollama Python client library to call REST APIs to convert text to SQL.

ollama
[Not supported by viewer]
duckdb-nsql
model
[Not supported by viewer]
Response (SQL)
[Not supported by viewer]
http://localhost:11434 
[Not supported by viewer]
Python app
[Not supported by viewer]
Prompt
[Not supported by viewer]
ollama-python package
[Not supported by viewer]