Skip to content
Amol Dighe
Go back

Opensource AI Fundamentals

Edit page
Opensource AI Fundamentals
Image generated with Google Gemini 3.0

What is Opensource AI?

A collection of technology & frameworks that is needed to use opensource AI to build systems & applications. e.g. build AI agent to book a flight OR shop for the right shoes at the right price point by comparing across multiple shopping websites.


* AI Models - Proprietary vs Opensource Models

Choosing the right model is the foundation of any AI system. There are two categories:

Proprietary Models — Closed-source, API-access only, typically more capable out-of-the-box:

Opensource Models — Weights available publicly, can be run locally or self-hosted:


* Model Ranking Leaderboard

Before picking a model, consult benchmarks and community rankings to find the best fit for your use case (coding, reasoning, instruction-following, multilingual, etc.):

Key benchmarks to look at:


* Model Manager — Ollama & Docker Desktop Models

To run and manage open-source models locally, you need a model manager:

Ollama

Docker Desktop Models

~ » docker model list                                                                                  
MODEL NAME  PARAMETERS  QUANTIZATION   ARCHITECTURE  MODEL ID      CREATED       CONTEXT  SIZE
gemma3      3.88 B      MOSTLY_Q4_K_M  gemma3        a353a8898c9d  5 months ago           2.31 GiB
(base)  ~/ curl http://localhost:12434/v1/models

{"object":"list","data":[{"id":"docker.io/ai/gemma3:latest","object":"model","created":1758368217,"owned_by":"docker"}]}

(base)  ~/ curl http://localhost:12434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ai/gemma3",
    "messages": [{"role": "user", "content": "who are you"}]
  }'

{"choices":[{"finish_reason":"stop","index":0,"message":{"role":"assistant","content":"I'm Gemma, a large language model created by the Gemma team at Google DeepMind. I'm an open-weights model, which means I’m widely available for public use! \n\nI can take text and images as inputs and respond with text. \n\nIt’s nice to meet you!"}}],"created":1775723162,"model":"model.gguf","system_fingerprint":"b1-0988acc","object":"chat.completion","usage":{"completion_tokens":65,"prompt_tokens":12,"total_tokens":77,"prompt_tokens_details":{"cached_tokens":0}},"id":"chatcmpl-0urCVAwxCjdfxOEOJ0fo2uNR987Am3Em","timings":{"cache_n":0,"prompt_n":12,"prompt_ms":124.101,"prompt_per_token_ms":10.34175,"prompt_per_second":96.69543355815023,"predicted_n":65,"predicted_ms":1414.579,"predicted_per_token_ms":21.762753846153846,"predicted_per_second":45.9500671224442}}%

* Running a Local Model

Steps to get a model running locally:

  1. Install Ollama: Download from ollama.com and install
  2. Pull a model: ollama pull qwen3-vl:2b or ollama pull deepseek-coder-v2:latest
~ » ollama list
NAME                        ID              SIZE      MODIFIED
deepseek-coder-v2:latest    63fb193b3a9b    8.9 GB    45 hours ago
qwen3-vl:2b                 0635d9d857d4    1.9 GB    3 days ago
qwen2.5-coder:7b            dae161e27b0e    4.7 GB    12 days ago
  1. Run the model interactively: ollama run qwen3-vl:2b
  2. Use via API:
    curl http://localhost:11434/api/generate \
      -d '{"model": "qwen3-vl:2b", "prompt": "Explain RAG in simple terms"}'
  3. Persist context using chat API for multi-turn conversations
  4. Monitor performance: Check RAM/VRAM usage — most 7B models need ~8GB RAM; 13B needs ~16GB

Tips:


* Building AI Agents — No-Code: Ollama + n8n

For no-code / low-code AI agent building:

n8n is an open-source workflow automation tool similar to Zapier/Make, but self-hostable and AI-native.

Architecture:

User Input → n8n Workflow → Ollama (local LLM) → Tool Calls → Response

Steps:

  1. Self-host n8n via Docker: docker run -it --rm -p 5678:5678 n8nio/n8n
  2. Add an AI Agent node in n8n
  3. Connect it to Ollama Chat Model node (point to http://localhost:11434)
  4. Add Tool nodes (e.g., HTTP Request, Google Search, Database query)
  5. Define a system prompt and let the agent autonomously call tools

Use cases:


* Building AI Agents — Code: Python + Ollama + OpenAI Agent SDK (ToDo)


Edit page
Share this post:

Previous Post
Postgres Fundamentals - The Concept
Next Post
SRE Concepts