← Course overview

Open Weight Models · Windows · Keep nearby

Ollama quick reference · Windows

Run these commands in PowerShell unless a row explicitly says to type inside the Ollama chat. Your project folder is CyberCorps-Ollama under your Windows user profile. Start the native Ollama app from Windows Start before using its client commands.

Everyday commands

CommandUse it to…
Get-Command ollamaIdentify the Ollama executable PowerShell will run.
ollama --versionRecord the installed client version.
ollama listCheck the server and list downloaded models.
ollama pull gemma3:1bDownload the local course model.
ollama show gemma3:1b --licenseInspect the selected model's licence text.
ollama run gemma3:1bStart an interactive local chat.
/byeType inside the Ollama chat to return to PowerShell.
ollama psInspect currently loaded models and processor allocation.
ollama stop gemma3:1bUnload the model while retaining its downloaded files.
Set-Location (Join-Path $env:USERPROFILE "CyberCorps-Ollama")Return to the project folder created in Lesson 3.
py -3 --versionVerify Python 3; use python only if its version check has confirmed your alternative.
py -3 .\local_chat.pyRun the shared Python API example from the project folder.
ollama create cybercorps-study -f .\ModelfileBuild or refresh the saved assistant after editing the recipe.
py -3 .\study_assistant.pyRun the capstone cases with the adjacent local_chat.py client.
Get-Content -LiteralPath (Join-Path $env:LOCALAPPDATA "Ollama\server.log") -Tail 60Read recent native server log lines without changing them.

Run one command at a time. Model removal changes your local installation; unloading a model only releases its memory. See Lesson 7 for troubleshooting and privacy settings.

Make a local API request

Start Ollama and download gemma3:1b first. These examples request one complete JSON response. The answer is in message.content. Use the example for your shell.

Windows: PowerShell · powershell

$payload = @{
  model = "gemma3:1b"
  stream = $false
  messages = @(
    @{
      role = "user"
      content = "Note: the workshop starts at 09:30. Using only this note, what time does it start?"
    }
  )
}
$request = @{
  Uri = "http://localhost:11434/api/chat"
  Method = "Post"
  ContentType = "application/json"
  Body = ($payload | ConvertTo-Json -Depth 5)
  TimeoutSec = 120
  ErrorAction = "Stop"
}
try {
  $result = Invoke-RestMethod @request
  $result.message.content
} catch {
  Write-Error "Local Ollama request failed: $_"
}

The local endpoint needs no API key. Keep it on your own machine; it is not an authenticated public service. See Lesson 5 for a Python client and conversation history.

Key terms

Weights

The learned numerical parameters used by a model. Their availability does not by itself describe the permissions in its licence.

Inference

Using an existing model to generate a result from an input.

Token

A unit of text processed by the model. A word may occupy more than one token.

Context

The working input available for a generation, including instructions, supplied material, and conversation history.

Quantisation

Representing model values with fewer bits to reduce storage and memory needs, with possible quality trade-offs.

Model tag

A model identifier such as gemma3:1b. Record the model ID as well when you need to track a particular downloaded version.

Modelfile

An Ollama configuration that selects a base model and supplies settings or instructions.

Evaluation

Checking outputs against defined tasks and expected behaviour, while recording errors as well as successes.

Official references