Menu

Personal AI Assistant That Learns About You
📰

Personal AI Assistant That Learns About You

DEV Community: tutorial·Amrendra N Mishra·3 days ago
#oC0iDXDq
#devtotutorial#devto#dev#every#ollama
Reading 0:00
15s threshold

The Problem With Cloud AI

Every token costs money. Every API call adds up. And your data goes to their servers.

The Local Alternative

brew install ollama ollama pull llama3.2 ollama serve

Enter fullscreen mode

Exit fullscreen mode

Now you have a GPT-4 level model running on your MacBook. Free. Private. Fast.

Real Code Example

import requests

def ask_local_ai ( question ): r = requests . post ( " http://localhost:11434/api/generate " , json = { " model " : " llama3.2 " , " prompt " : question , " stream " : False } ) return r . json ()[ " response " ]

# Works immediately, no API key needed answer = ask_local_ai ( " Explain Docker in one paragraph " ) print ( answer )

Enter fullscreen mode

Exit fullscreen mode

Available Models

Model Size Best For

llama3.2 2GB General use

codellama 4GB Code tasks

mistral 4.4GB Fast reasoning

phi3 2.2GB Lightweight tasks

gemma2 5.4GB Complex reasoning

What You Can Build

RAG systems for your documents

Voice assistants that work offline

Code reviewers on…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.