The Real Python Podcast

Running Local LLMs With Ollama and Connecting With Python

33 snips
Feb 13, 2026
Christopher Trudeau, Frequent Real Python contributor and PyCoder’s Weekly curator, joins to talk practical Python tooling. They explore running local LLMs with Ollama and connecting them to Python. Short segments cover callable instances with __call__, GeoPandas mapping, subprocess polling changes, peer-to-peer encrypted CLI chat, and a retry library that classifies errors.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
ADVICE

Set Up And Use Tool Calling

  • Pull the models you need and install the olama Python SDK in a virtual environment before coding.
  • Define Python functions as tools, pass them to the model, execute selected tools, and append results as tool messages.
ADVICE

Verify Model Sizes And Locations

  • Check model sizes and available disk space before pulling models (Llama 3.2 ≈2GB, CodeLlama ≈3.8GB).
  • Look in hidden directories under your home folder for downloaded model files.
INSIGHT

Chat Versus One-Shot Modes

  • Olama supports both multi-turn chat and one-shot text generation interfaces from Python.
  • Use messages (role/content dicts) to build conversation context for more accurate outputs.
Get the Snipd Podcast app to discover more snips from this episode
Get the app