LLM & AI

Ollama Setup and Usage

Ollama installation, model management, and local API examples.

Install and run
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
ollama pull gemma2:9b
ollama pull llama3.1:8b
ollama list

Use smaller models first when testing prompts, then move to larger models after the workflow is stable.

Model commands
ollama run gemma2:9b
ollama show gemma2:9b
ollama rm gemma2:9b

Keep model names explicit in scripts so a future default model change does not alter results silently.

Local API
curl http://localhost:11434/api/generate \
  -d '{"model":"gemma2:9b","prompt":"Summarize this text.","stream":false}'

Local API calls are useful for private experiments, but production systems still need timeout, retry, and logging boundaries.