sqlgen nb
1.0.0
Write PostgreSQL query from natural language using on-prem gen AI -- with IBM Granite Code LLM, Ollama on Juypter Notebook.
Inspired by a use case mentioned by Anthropic -- but is a local implementation with a minimal setup.
Jupyter Notebook https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
LangChain https://python.langchain.com/docs/how_to/installation/
Ollama https://ollama.com/download
Pull IBM Granite Code
model in Terminal:
ollama pull granite-code:8b-instruct
sqlgen.ipynb
schema =
user_prompt =
Run all
to run all the cells in the Juypter NotebookGen AI is non-deterministic. With the same user prompt, it generates slightly different completions every time. Verify before use.
As this involves interacting LLM with database. The codes could be reused in database agent in multiagent workflow.