Setup & EnvironmentLesson 2

Open Source LLM Setup

The last lesson wired up OpenAI in the cloud. Here we set up a model that runs on your own PC — useful when you want zero API cost or to work offline. We will use Ollama, which we briefly met in Lesson 3.

Cloud API vs local model

Open source models like Llama publish their weights. You download the files and run inference on your hardware. Nothing is sent to OpenAI's servers, and there is no per-message bill — but you need enough RAM and a patient CPU or GPU.

LangChain can talk to both setups. OpenAI uses an API key; a local model uses a URL on your machine (Ollama defaults to localhost:11434). We will connect LangChain to each path in later lessons.

Install Ollama

Ollama is a small desktop app that downloads models and exposes a local API. On Windows, open ollama.com/download, select Windows, then paste the PowerShell command or click Download for Windows.

Ollama
Search models
Sign inDownload

Download Ollama

macOS

L

Linux

Windows

irm https://ollama.com/install.ps1 | iex

paste this in PowerShell

or

Download for Windows

Requires Windows 10 or later

On Windows, paste the PowerShell line or use Download for Windows at ollama.com/download.

Pick a model

Open ollama.com/library to browse what is available. You will see llama3.1, deepseek-r1, mistral, gemma3, and others. Each card lists size tags — 3b or 8b fits most laptops; 70b needs a strong GPU. For this course, pull llama3.2.

OllamaModelsDocsPricing
Search models
Sign inDownload
O

Library

Filter models
Popular

llama3.1

Llama 3.1 is a new state-of-the-art model from Meta available in 8B, 70B and 405B parameter sizes.

tools8b70b405b
115.6M Pulls93 TagsUpdated 1 year ago

deepseek-r1

DeepSeek-R1 is a family of open reasoning models with performance approaching that of leading models, such as O3 and Gemini 2.5 Pro.

toolsthinking1.5b7b8b14b32b70b671b
87.1M Pulls35 TagsUpdated 11 months ago

llama3.2

Meta's Llama 3.2 goes small on purpose — 1B and 3B sizes meant for on-device and laptop use.

tools1b3b
42.8M Pulls24 TagsUpdated 8 months ago

mistral

The 7B model from Mistral AI — an early open-weight option that still shows up in tutorials and comparisons.

tools7b
18.2M Pulls84 TagsUpdated 1 year ago

gemma3

Gemma 3 builds on Google's open Gemma line with stronger multilingual and vision variants.

vision1b4b12b27b
12.4M Pulls28 TagsUpdated 4 months ago

qwen2.5

Qwen 2.5 from Alibaba — strong at coding and multilingual tasks across several parameter sizes.

tools0.5b1.5b3b7b14b32b72b
9.7M Pulls40 TagsUpdated 6 months ago
Browse models at ollama.com/library. Check the size tags before you pull — for this course we use llama3.2 as a lighter download.

An example

Open PowerShell or Terminal in your project folder. Pull the model once, then start a chat session. Ask the same kind of HTML question we used in the LangChain overview — if you get a sensible answer, the local stack is working.

PowerShell — QList project
PS C:\projects\html-tutorial> ollama --version
ollama version 0.6.5
PS C:\projects\html-tutorial> ollama pull llama3.2
pulling manifest
pulling 8eeb52dfb3bb… 100%
success
PS C:\projects\html-tutorial> ollama run llama3.2
>>> What does the <title> tag do in HTML?
The <title> tag sets the page title shown in the browser tab and search results.
>>> /bye
Three commands: check install, download the model, run one HTML question. Type /bye to exit the chat.

When to use which

Stick with OpenAI for the main course exercises — examples online assume it, and responses are faster on a modest PC. Keep Ollama installed as a fallback for offline practice or when you hit API rate limits.

Leave Ollama running in the background while you code. The next lesson sets up the Python project folder, virtual environment, and LangChain packages.

What's Next

Local model is ready. Next: create the project folder, venv, and requirements.txt.