Run Your Own AI Chatbot Offline with Ollama and GPT-OSS-20b

Have you ever wished you had your own personal assistant that could answer your questions and chat with you, without needing an internet connection? Imagine having the power of artificial intelligence right on your computer, ready to help whenever you need it, even if you're in a place with no Wi-Fi. Well, now you can!

In this simple guide, I'll show you how to set up your very own offline AI chatbot using two amazing tools: Ollama and a language model called GPT-OSS-20b. Don't worry if these names sound a bit technical – we'll break it down in a way that's easy for anyone to understand.

What's an Offline AI Chatbot?
Think of an AI chatbot like a computer program that can have conversations with you. Usually, these chatbots need to be connected to the internet because the "brain" that powers them (the AI model) is stored on faraway computers.

An offline AI chatbot is different. Its entire "brain" is downloaded and stored directly on your own computer. This means it can work even when you don't have internet access, and your conversations stay private on your machine.

Meet Ollama: Your Friendly AI Helper
Ollama is like a super-easy installer and runner for these AI "brains," also known as language models. It takes away all the complicated technical stuff and lets you download and use these models with just a few simple commands. Think of it as an app store, but for AI brains that run on your computer.
Introducing GPT-OSS-20b: A Smart AI Brain
GPT-OSS-20b is the name of a specific AI "brain" or language model. It's quite powerful and can understand your questions and generate thoughtful responses, much like the online chatbots you might have used. The "20b" in its name refers to its size (20 billion parameters), which means it has a lot of information and abilities. The "OSS" part stands for Open Source Software, meaning it's freely available for anyone to use.

For Linux
Step 1: Downloading Ollama (For Linux)
If you're using Linux, the installation of Ollama is also straightforward. Here's how to do it using the terminal:
  1. Open a terminal on your Linux system. You can usually do this by pressing Ctrl + Alt + T on your keyboard.
  2. In the terminal window, copy and paste the following command exactly as it is written, and then press the "Enter" key:
    curl -fsSL https://ollama.ai/install.sh | sh
  3. This command will download an installation script from the Ollama website and automatically run it. You'll see various messages in the terminal as Ollama is downloaded and set up on your system. You might be asked for your password during the installation – this is normal when making system changes on Linux.
  4. Once the script finishes running, Ollama should be installed. You might need to log out and log back into your Linux session for the changes to fully take effect, or you can try running the next command directly.
Step 2: Downloading the GPT-OSS-20b Model
Once Ollama is installed and running, you can easily download the GPT-OSS-20b "brain".
  1. Open a terminal on your Linux system. You can usually do this by pressing Ctrl + Alt + T on your keyboard.
  2. In the terminal window, type the following command exactly as it is written and then press the "Enter" key:
    ollama pull gpt-oss-20b 
    ollama run gpt-oss-20b


The first time you run this command, Ollama will automatically download the GPT-OSS-20b model. This might take some time depending on your internet speed, as the model is quite large. You'll see progress information in the terminal.

Step 3: Running the Chatbot
Once the download is complete, Ollama will automatically start the chatbot. You'll see a message in the terminal indicating that the model is ready. It will look something like this:

>>>

This >>> symbol means the chatbot is waiting for you to type something.

Step 4: Basic Interaction
Now you can start chatting with your offline AI!

In the terminal window, type a question or a statement. For example, you could type:

>>> Hello, how are you today?

Then press "Enter".


The AI will process your input and generate a response. The response will appear in the terminal window below your question.

You can continue the conversation by typing more questions or comments and pressing "Enter".
To stop the chatbot when you're finished, simply close the terminal window.

You've successfully set up and run your very own offline AI chatbot using Ollama and the GPT-OSS-20b model. You can now experiment with asking it different kinds of questions and see how it responds.