Skip to content

Latest commit

 

History

History

readme.md

This is the unofficial repository for the book: Large Language Models: Apply and Implement Strategies for Large Language Models (Apress). The book is based on the content of this repository, but the notebooks are being updated, and I am incorporating new examples and chapters. If you are looking for the official repository for the book, with the original notebooks, you should visit the Apress repository, where you can find all the notebooks in their original format as they appear in the book. Buy it at: [Amazon] [Springer]

In this straightforward initial project, we are going to develop a SQL generator from natural language. We'll begin by creating the prompt to implement two solutions: one using OpenAI models running on Azure, and the other with an open-source model from Hugging Face.

image

Prompt Creation

We will create two NL2SQL prompts that adhere to the best practices published in the paper from the University of Ohio (see below). Adapting them to the specific needs of OpenAI and SQLCoder Models. First we will create trhe OpenAI Prompt, then continue adapting the prompt created to SQLCoder, an open-source model trained by Defog from a super efficient Code Llama 7B Model, available on from Hugging Face.

Although both prompts are based on the same paper, there are slight differences in the creation process.

Besides creating the prompt, we conduct a few tests and observe how both models generate SQL commands correctly.

Article Notebook
Create a NL2SQL prompt for OpenAI Notebook for OpenAI
Article WIP Notebook for SQLCoder

Azure Configuration.

In Azure, we will configure the Open Services using the prompt created earlier for OpenAI models. This allows us to conduct tests and set up an inference endpoint to call for obtaining SQL commands.

Article Notebook
How To Set up a NL2SQL System With Azure OpenAI Studio. Using the inference point on Azure.

Papers used in the project: