---
title: "Discussion on \"Run AI Locally on Your Mac with Ollama: Chat, Tools, RAG and a Custom Model (Real Numbers from a Mac mini M4)\" | Hashnode"
description: "Discussion on \"Run AI Locally on Your Mac with Ollama: Chat, Tools, RAG and a Custom Model (Real Numbers from a Mac mini M4)\". Ollama on a Mac mini M4 (16 GB): chat app, OpenAI SDK, tool calling, RAG and a custom model, with real speeds and code."
url: "https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Run AI Locally on Your Mac with Ollama: Chat, Tools, RAG and a Custom Model (Real Numbers from a Mac mini M4)](https://rainytech.hashnode.dev/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4?utm_source=hashnode&utm_medium=feed)

Ollama on a Mac mini M4 (16 GB): chat app, OpenAI SDK, tool calling, RAG and a custom model, with real speeds and code.

Oct 5 · 6 min read · rainytech.hashnode.dev  
Updated 2d ago  
Read the article

-   [#ollama](https://hashnode.com/tag/ollama)
-   [#python](https://hashnode.com/tag/python)
-   [#artificial-intelligence](https://hashnode.com/tag/artificial-intelligence)
-   [#llm](https://hashnode.com/tag/llm)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[RainyTech](https://hashnode.com/@rainytechlab)

@rainytechlab · Phnom Penh, Cambodia

  
[View profile](https://hashnode.com/@rainytechlab)

AI, coding and tech explained clearly. Real tutorials with real numbers. New YouTube videos every week.

RainyTech is a YouTube channel by Rainy Reaksmey, a software engineer and mobile developer from Cambodia. Real tutorials, real numbers: local AI on Mac, Python, React and the newest devices. Watch: youtube.com/@RainyTechLab Website: rainytech.dev

## Responses 9

Markdown supported · ⌘↵ to post

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Oct 7](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac696822e489644295387a1)

Validation loss bottoming at step 100 (1.382) and climbing to 1.811 by step 300 is the overfitting I keep forgetting to watch for. You kept the step-100 checkpoint; I once shipped a later one because training loss was still falling while the held-out set had already turned. Did you settle on 300 total steps by watching that curve, or was it a budget set up front?

[RainyTech](https://hashnode.com/@rainytechlab)

[Oct 8](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac696822e489644295387a1#reply-6ac78156ac88c35424784428)

Honestly, it was a budget I set up front. The command was `--iters 300` with an eval and a checkpoint saved every 100 steps. I only picked the step-100 checkpoint afterwards, once I saw val loss go 1.382 → 1.665 → 1.811 while train loss kept dropping to 0.046.

Looking back, 300 was far too many for the data. It's 108 training examples at batch size 4, so about 27 steps per epoch. 300 steps is roughly 11 passes over the same data, and step 100 is already about 3.7. The validation set is also small (only 12 examples), and I only checked it every 100 steps. So 100 is just the best of the three points I measured, not the actual lowest point. The real minimum could be anywhere from about step 50 to 150.

Next time I'll run eval every 25 steps and stop when val loss stops improving. Thanks for raising it. It's an easy one to miss when the training curve looks so good.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 5](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac39bc0431f4fd6048d0b28)

The tool loop is the part I would adjust before adding the second function from your examples. The displayed snippet calls get\_disk\_free() for every tool call, regardless of the requested function name. That works for the single-tool demonstration, but a request for system memory would need a different dispatch path.

A small function-name-to-handler mapping, with arguments validated for the selected handler, would make that extension explicit. I would also append response.message once before iterating over its tool calls, then append each tool result separately. Otherwise a response containing multiple calls repeats the same assistant message in the conversation history.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 9](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac39bc0431f4fd6048d0b28#reply-6ac8870e2881eaeaece2c13e)

The updated snippet now has the dispatch boundary the article needed. For missing required arguments, inspect.signature(handler).bind(\*\*arguments) can check both missing and unexpected names before the handler is invoked; a TypeError becomes a result for that particular tool call.

That is still argument binding, not type validation, so it should not claim to validate annotated value types. A tiny test handler with one required argument would expose the current missing-field gap even though get\_disk\_free and get\_memory accept none. The two-call test can then assert that only the valid handler ran.

[RainyTech](https://hashnode.com/@rainytechlab)

[Oct 13](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac39bc0431f4fd6048d0b28#reply-6ace1e489552445c96d30119)

Thanks, `signature(handler).bind(**arguments)` is a neat way to catch both missing and unexpected arguments in one step. And fair point that it's argument binding, not type validation. A test handler with one required argument would expose the gap nicely.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 15](https://hashnode.com/posts/run-ai-locally-on-your-mac-with-ollama-chat-tools-rag-and-a-custom-model-real-numbers-from-a-mac-mini-m4/6ac345cb6485b2d515e70eea/comment/6ac39bc0431f4fd6048d0b28#reply-6ad13c5b7a125a4ea87ff5b5)

The required-argument fixture can stay independent of the actual disk and memory tools. Give the fake handler a call counter, submit one missing-argument call followed by a valid call, and assert that only the latter increments it.

That checks a useful recovery property too: rejecting one tool call should not prevent valid sibling calls from producing their own results. Keep the call identifiers in those results so the model can associate the validation error and successful output with the right requests.
