Lloro SQL, developed by Semantix Research Labs, is a language Model that was trained to effectively transform Portuguese queries into SQL Code. It is a fine-tuned version of meta-llama/Meta-Llama-3-8B-Instruct, that was trained on GretelAI public datasets. The fine-tuning process was performed using the QLORA metodology on a GPU A100 with 40 GB of RAM.
Model type: A 7B parameter fine-tuned on GretelAI public datasets.
Language(s) (NLP): Primarily Portuguese, but the model is capable to understand English as well
Lloro is built for Text2SQL in Portuguese contexts .
Using an OpenAI compatible inference server (like
vLLM)
1from openai import OpenAI
2client = OpenAI(
3 api_key="EMPTY",
4 base_url="http://localhost:8000/v1",
5)
6def generate_responses(instruction, client=client):
7
8 chat_response = client.chat.completions.create(
9 model=<model>,
10 messages=[
11 {"role": "system", "content": "Você escreve a instrução SQL que responde às perguntas feitas. Você NÃO FORNECE NENHUM COMENTÁRIO OU EXPLICAÇÃO sobre o que o código faz, apenas a instrução SQL terminando em ponto e vírgula. Você utiliza todos os comandos disponíveis na especificação SQL, como: [SELECT, WHERE, ORDER, LIMIT, CAST, AS, JOIN]."},
12 {"role": "user", "content": instruction},
13 ]
14)
15
16 return chat_response.choices[0].message.content
17
18output = generate_responses(user_prompt)
19
The following parameters related with the Quantized Low-Rank Adaptation and Quantization were used during training: