[Avg. reading time: 4 minutes]
Ollama
-
Ollama is an open-source tool that allows you to run large language models (LLMs) on your local machine, providing privacy and offline access.
-
It simplifies the process of downloading, running, and managing LLMs with a user-friendly interface, both via a command-line interface (CLI) and an API.
-
It’s designed for developers and researchers who want to customize and experiment with AI models locally, without depending on cloud services.
Install
Download and Install
https://ollama.com/
Open Terminal
ollama
ollama list
ollama pull deepseek-r1:8b
ollama run deepseek-r1:8b
To close the prompt
/bye
Roles
- user: The human asking questions or giving instructions.
- assistant : The model’s response role. This is what the LLM outputs.
- system : Optional. Used to set initial behavior or constraints, similar to system prompts in OpenAI/ChatGPT.
git clone https://github.com/gchandra10/python_ollama_demo.git
chat() - conversational, role-based, template-aware generate() - raw LLM token generation, no chat template, no memory
Build Custom Models
- Create a Modelfile
- Mention the model and prompt
- Create and use the new Model