In this tutorial, you’ll learn how to tailor an Ollama model using aDocumentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
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
- Create and Open the Modelfile
- Define Base Model & Parameters
- Add a System Prompt
- Build the Custom Model
- Interact with Your Custom Model
- Example Financial Calculation
- Links and References
1. Create and Open the Modelfile
Run the following commands to create an emptyModelfile and open it in your editor:
2. Define Base Model & Parameters
Specify the base model and adjust its creativity by setting thetemperature parameter:
| Directive | Purpose | Example |
|---|---|---|
| FROM | Selects the base model | FROM llama3.2 |
| PARAMETER | Configures model hyperparameters | PARAMETER 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.
Modelfile should now look like:
4. Build the Custom Model
Use the Ollama CLI to build and name your custom modelharris:
5. Interact with Your Custom Model
Start an interactive session and ask Harris some questions:6. Example Financial Calculation
Here’s a sample future-value calculation Harris can perform:| Year | Calculation | Amount (₹) |
|---|---|---|
| 1 | 5,000 × 1.12 | 5,600.00 |
| 2 | 5,600 × 1.12 | 6,272.00 |
| 3 | 6,272 × 1.12 | 7,024.64 |
| 4 | 7,024.64 × 1.12 | 7,867.60 |
| 5 | 7,867.60 × 1.12 | 8,811.71 |
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.