A modification of the LangChain SQL Q&A tutorial https://python.langchain.com/docs/tutorials/sql_qa/.
The changes are:
- uses Pydantic to type the state and inputs/outputs
- uses duckDB on the
palmerpenguin
dataset - uses a Nvidia NIM for the LLM
- instead of a sequence write_query -> run_query -> gen_answer, this graph adds a LLM that checks the write_query output for validity and to see if it answers the question, leading to a more dynamic graph that looks like this: