Skip to main content
In this tutorial, you’ll learn how to tailor an Ollama model using a Modelfile to serve as an AI assistant for a financial institution. We’ll walk through each step—from creating the file to running queries—so you can adapt these concepts for your own use case.
Make sure you have Ollama installed and configured on your machine before you begin.

Table of Contents

  1. Create and Open the Modelfile
  2. Define Base Model & Parameters
  3. Add a System Prompt
  4. Build the Custom Model
  5. Interact with Your Custom Model
  6. Example Financial Calculation
  7. Links and References

1. Create and Open the Modelfile

Run the following commands to create an empty Modelfile and open it in your editor:

2. Define Base Model & Parameters

Specify the base model and adjust its creativity by setting the temperature parameter:
DirectivePurposeExample
FROMSelects the base modelFROM llama3.2
PARAMETERConfigures model hyperparametersPARAMETER temperature 0.3

3. Add a System Prompt

Provide context so the model acts as a specialized AI assistant. In this example, we name it Harris and assign it to Growmore, a portfolio management firm dealing in INR:
A clear, specific system prompt helps guide the model’s tone, scope, and domain knowledge. Always mention role, audience, and any domain-specific details.
Your final Modelfile should now look like:

4. Build the Custom Model

Use the Ollama CLI to build and name your custom model harris:
Example output:
Verify your models:

5. Interact with Your Custom Model

Start an interactive session and ask Harris some questions:
Notice how Harris automatically uses INR whenever monetary figures are mentioned.

6. Example Financial Calculation

Here’s a sample future-value calculation Harris can perform:
Breakdown by year:
YearCalculationAmount (₹)
15,000 × 1.125,600.00
25,600 × 1.126,272.00
36,272 × 1.127,024.64
47,024.64 × 1.127,867.60
57,867.60 × 1.128,811.71
Total after 5 years: ~₹8,812
You’ve now customized an Ollama model using a Modelfile and tailored it for a finance-focused workflow. Share your model with teammates or deploy it to streamline client interactions.

Watch Video