The Day I Accidentally Sent the Payroll File to a Public AI
It was 2 AM. I was hopped up on stale coffee, trying to build a simple script to summarize our quarterly budget notes. In a moment of pure, sleep-deprived genius, I decided to use a public AI API to parse the text. I copied the notes, pasted them into my code, and hit ‘Run’.
The summary came back instantly. It was perfect. And then, a cold dread washed over me. The budget notes contained names, salary projections, and notes on upcoming layoffs. I had just uploaded our company’s most sensitive financial data directly to a third-party server, somewhere in a data center I couldn’t point to on a map.
For the next hour, I sat there imagining our entire payroll being used to train some future chatbot on how to negotiate salaries. I felt like I’d just handed the keys to the kingdom to a complete stranger. Never again, I promised myself. There had to be a way to get the power of AI without the massive privacy tradeoff. That’s when I found Ollama.
Why This Matters
Look, the big AI models from OpenAI, Google, and Anthropic are incredible. They’re also a black box. You send your data in, you get an answer back, and you pray they’re doing the right thing with it. For many tasks, that’s fine. For anything involving sensitive business data, it’s a non-starter.
Running a language model locally with a tool like Ollama changes the game. Think of it as firing the expensive, world-famous consultant (cloud AI) and hiring a brilliant, loyal intern who lives in your computer’s basement (local AI). This intern:
- Works for Free: Once you have the hardware, you can run it 24/7 without paying a single cent in API fees. No more watching your token count like a hawk.
- Is 100% Confidential: Your data never, ever leaves your machine. Process legal documents, customer lists, HR reviews, secret formulas—it all stays with you.
- Is Incredibly Fast: For many tasks, local models are faster because there’s no network lag. The request travels from your script to your own processor and back. Milliseconds, not seconds.
- Can’t Be “Updated” or Censored Without Your Permission: You own the model. It will work the same way tomorrow as it does today. No surprise changes will break your automations.
This isn’t about replacing GPT-4. It’s about building a secure, cost-effective foundation for 80% of the boring, repetitive text-processing tasks that every business has.
What This Tool / Workflow Actually Is
Let’s be crystal clear. Ollama is not an AI model. You can’t ask Ollama questions.
Instead, Ollama is a brilliant piece of software that acts like a manager or a server. It takes powerful, open-source AI models (like Meta’s Llama 3, Mistral, etc.) that are normally a nightmare to set up, and makes running them as simple as typing one command in your terminal.
What it does: It downloads, manages, and serves these AI models through a simple, clean API that lives on your computer. This API is designed to mimic the OpenAI API, so any code or tool that can talk to OpenAI can be easily pointed at your local Ollama instance instead.
What it does NOT do: It does not give you a free GPT-4. The local models are typically smaller and less creatively “intelligent” than the giant frontier models. They are fantastic for structured tasks like summarization, classification, data extraction, and reformatting. They are less fantastic for writing a cinematic masterpiece or discovering cold fusion.
Prerequisites
I promised this would be easy, and it is. But let’s be honest about what you need.
- A Decent Computer: You don’t need a supercomputer, but a laptop from 2015 might struggle. A modern machine (Mac, Windows, or Linux) with at least 16GB of RAM is highly recommended. If you have a dedicated graphics card (GPU), you’re golden, but it’s not required for the smaller, more efficient models we’ll start with.
- Ability to Open a Terminal/Command Prompt: This is the black window with text that looks scary in movies. I promise, you only need to copy-paste about four commands. If you’ve never done it, search “How to open Terminal on Mac” or “How to open Command Prompt on Windows.” You can do this.
- A Bit of Patience: The first time you download a model, it can be several gigabytes. It might take 5-15 minutes depending on your internet speed. Go make a coffee. It’s worth it.
That’s it. No coding experience needed to get it running.
Step-by-Step Tutorial
Let’s get this private AI intern hired and put it to work.
Step 1: Download and Install Ollama
Go to the official website: ollama.com. Click the big download button. It will automatically detect if you’re on Mac, Windows, or Linux and give you the right file. Run the installer. It’s a standard, boring installation. Just click “Next” until it’s done.
Step 2: Open Your Terminal
Find your Terminal (Mac/Linux) or Command Prompt/PowerShell (Windows) and open it up. This is our command center.
Step 3: Pull Your First AI Model
We need to give our Ollama manager an AI brain to manage. We’ll start with llama3:8b, which is Meta’s latest model. It’s powerful, efficient, and small enough to run on most modern laptops. Type this command and press Enter:
ollama pull llama3:8b
You’ll see a download progress bar. This is the part where you go get that coffee. Once it’s done, the model is saved on your computer, ready to go.
Step 4: Chat With Your Local AI
Let’s prove it works. To start a chat session directly in your terminal, run this:
ollama run llama3:8b
Your prompt will change, and you can now type messages. Ask it a question, like “What are the top 3 benefits of local AI for a small business?” It will answer right there in your terminal. All of this is happening 100% on your machine. To exit the chat, type /bye and press Enter.
Step 5: Test the API (The Key to Automation)
Chatting is cool, but automation is our goal. Ollama automatically starts a server in the background. We can send requests to it from our code. Let’s test it without writing any code using a simple tool called curl, which is pre-installed on most systems.
Open a NEW terminal window (leave the other one if it’s running the server, though Ollama usually handles this automatically) and copy-paste this entire block of code, then press Enter:
curl http://localhost:11434/api/generate -d '{ "model": "llama3:8b", "prompt": "Why is the sky blue?", "stream": false }'
You should get back a messy-looking block of text called JSON. If you look closely, you’ll see your AI’s answer inside. This proves the automation server is working. We can now build on this.
Complete Automation Example
Let’s solve a real business problem: extracting structured data from unstructured text. Imagine you get customer feedback emails and you want to pull out the key details to put into a spreadsheet or database, without manually copy-pasting all day.
Here’s a Python script that does exactly that. You don’t need to be a Python expert to understand this. You will need Python installed, but it comes standard on Macs and is easy to install on Windows.
The Goal: Turn a messy email into clean JSON.
The Messy Email (Our Input):
Hello,
My name is Sarah Connor and my order #T-800 from last week arrived with a broken flux capacitor. It's really frustrating. I'm feeling pretty angry about this and I need a replacement shipped out ASAP.
Thanks, Sarah
The Python Script (Our Automation):
Create a file named process_email.py and paste this code into it.
import requests
import json
# The local URL for your Ollama API
ollama_url = 'http://localhost:11434/api/generate'
# The unstructured customer email
customer_email = """
Hello,
My name is Sarah Connor and my order #T-800 from last week arrived with a broken flux capacitor. It's really frustrating. I'm feeling pretty angry about this and I need a replacement shipped out ASAP.
Thanks, Sarah
"""
# A clear, direct prompt telling the AI exactly what to do
prompt = f"""
You are an expert at parsing customer emails. Extract the following information from this email and provide the output in JSON format. Do not include any other text, just the JSON object.
- customer_name (string)
- order_number (string)
- issue_summary (string)
- sentiment (string: 'positive', 'neutral', or 'negative')
EMAIL: {customer_email}
JSON_OUTPUT:
"""
# The data payload for the API request
data = {
"model": "llama3:8b",
"prompt": prompt,
"stream": False # We want the full response at once
}
# Send the request to our local AI
response = requests.post(ollama_url, json=data)
# Extract the JSON string from the response
response_json = json.loads(response.text)
content = response_json['response']
# Print the clean, structured data
print(content)
To run this, open your terminal, navigate to the folder where you saved the file, and run:
python process_email.py
The Clean JSON (Our Output):
{
"customer_name": "Sarah Connor",
"order_number": "T-800",
"issue_summary": "The flux capacitor in the order was broken upon arrival.",
"sentiment": "negative"
}
Look at that. A messy, emotional email transformed into perfect, structured data that can now be sent to a CRM, a database, or a Slack channel. And it happened entirely on your machine, for free, in under a second.
Real Business Use Cases
This same pattern—unstructured text IN, structured JSON OUT—can be used everywhere.
- HR Department: Paste in a resume, and the local AI extracts the candidate’s name, years of experience, key skills, and contact info into a clean JSON object for your applicant tracking system. All PII stays in-house.
- E-commerce Store: Feed it product reviews, and it classifies them by topic (shipping, quality, price) and sentiment. Use this data to generate weekly reports on what customers are complaining about, without sending review data to a third party.
- Law Firm: Give it a chunk of legal discovery text, and have it summarize the key points or extract all mentions of specific people, dates, and locations. This maintains absolute client confidentiality.
- Marketing Agency: Drop in a competitor’s blog post, and have the AI extract the main arguments, tone of voice, and keywords used. Perfect for competitive analysis without leaking your strategy.
- Freelance Developer: Paste in a messy bug report from a client, and have the local AI reformat it into a perfect bug ticket with fields for `steps_to_reproduce`, `expected_behavior`, and `actual_behavior`.
Common Mistakes & Gotchas
- Using a Model That’s Too Big: It’s tempting to download the biggest 70-billion-parameter model. Don’t. It will make your laptop sound like a jet engine and run painfully slow. Start with `llama3:8b` or `mistral`. They are fast and surprisingly capable.
- Forgetting to be Specific in Your Prompt: Local models need clear instructions. Notice how I said “provide the output in JSON format. Do not include any other text.” If you’re lazy with your prompt, you’ll get lazy results.
- Thinking It’s “Free”: The API calls are free, but it costs electricity and uses your computer’s resources. If you run it heavily, your machine will be working hard. It’s not magic, it’s computation.
- Not Handling the JSON Response Correctly: The Ollama API returns a JSON object where your model’s actual answer is inside the `”response”` key. Newcomers often forget to extract this inner content, like we did with `content = response_json[‘response’]`.
How This Fits Into a Bigger Automation System
What you’ve just built is a powerful, self-contained “brain” for processing text. It’s a foundational piece in a much larger automation factory. Now, you can connect it to anything.
- Connect to your CRM: When a new lead is created, an automation can grab the lead’s notes, send them to your local Ollama for summarization, and post a 3-bullet summary back into a “Lead TL;DR” field.
- Connect to your Email: Use a tool like Make or Zapier to watch for new emails with a specific label (e.g., “Invoices”). When one arrives, send the body to your Ollama script to extract the amount and due date, then add a row to a Google Sheet.
- Connect to a Vector Database (RAG): This is the holy grail. You can take all your company’s internal documents, turn them into numbers, and store them in a special database. Then, you can use your local Ollama model to “chat” with your documents, asking questions like “What was our Q3 revenue last year?” and getting answers based *only* on your private data. This is called Retrieval-Augmented Generation, and it’s a game-changer.
What to Learn Next
You’ve done it. You installed a private AI, controlled it with code, and solved a real business problem. You now have a secure text-processing engine that costs you nothing to run. This is a massive step.
But a brain with no memory is just a calculator. Right now, your AI only knows what you tell it in the prompt.
In the next lesson in this course, we’re going to give it a long-term memory. We’ll show you how to connect your local Ollama model to your own documents—your PDFs, your Word docs, your knowledge base—to build a private, custom AI expert that knows *your* business inside and out. We’re going to build a local RAG system from scratch.
You’ve laid the foundation. Next, we build the skyscraper.
“,
“seo_tags”: “Ollama, Local LLM, AI Automation, Private AI, Self-hosted AI, Llama 3, Business Automation, OpenAI Alternative, Run AI Locally, Secure AI”,
“suggested_category”: “AI Automation Courses

