This is a simple application which attempts to test natural language to SQL technique.
Follow these steps to set up and run the application:
-
Requirements: Ensure you have the following dependencies installed:
- docker
- make
-
Start the project:
- Open a terminal in the root directory of your project.
- Execute the following command to initiate the project setup:
make start
-
Populate the Database:
After the database is created and necessary models are downloaded, proceed with the following steps:
-
Start a bash session in the main container using:
make up
-
Once inside the container, populate the database by running:
python manage.py load_data tsla_2014_2023.csv
You can load any files available in the root repository.
-
-
Start the web server: After ensuring everything is properly set up, initiate the web server by running:
make runserver
There is a web page which can be used to ask to the model. Just open a web browser and navigate to http://localhost:8000/chat/ and ask any question.
To test the application, follow these steps:
-
Access the application:
- Open a web browser and navigate to http://localhost:8000/api/v1/resolve_query/?q=XXX, replacing XXX with your actual question.
-
Choosing the model:
- You use can another model by setting the environment variable
AVAILABLE_MODELS
for example you can set it tollama2,mistral
by default the first model will be use, you can choose another model by passing the query parameter model, for instance: http://localhost:8000/api/v1/resolve_query/?q=XXX&model=mistral
- You use can another model by setting the environment variable
Warning
Don't forget pulling the models by running the make start
command once you have changed the models list.
export AVAILABLE_MODELS=llama2,mistral
make start
make runserver
This project has the following decisions or conditions:
- Django is use since it is easy to create the database schema and maintain its changes.
- No async code is used because django does not support async code for transactions currently.
- Ollama is used because it provided a wide variety of models, and i can be change to OpenIA's api easily.