DEV Community

Ayman Salah
Ayman Salah

Posted on

How to train a LLaMA model using my database to answer analytical questions about the data?

I have a database that contains data about customers, purchases, and product categories. I want to use the LLaMA model (via Ollama) to analyze this data and answer questions like:

How many customers purchased items in Category A with a price less than $100? What are the total sales for a given month? Here’s what I need to achieve:

Input Data: The data can be provided in different formats (e.g., direct connection to the database, CSV files, etc.).

Explain Schema: I will explain the meaning of each column and the relationships between tables to the model.

Persistent Learning:

The model should persist the analysis results so it can recall them even after a restart. Daily new data should be added, and the model should incrementally incorporate it into its analysis.

Expected Output: The model should generate statistics and answer analytical questions based on the data provided.

Questions:

Which approach or tools should I use to implement this?

How do I make the model understand the database schema and train it effectively?

How can I ensure the model retains knowledge of the data between restarts (persistent storage)?

Is LLaMA the right choice for this kind of task, or is there a better model for database-related question answering?

Top comments (0)