In the realm of digital communication, privacy and freedom are paramount concerns for many users. While AI-powered chatbots offer convenience and assistance, they often come with trade-offs in terms of privacy and data security. However, there’s a promising solution for those seeking an alternative: ollama in combination with the continue extension in Visual Studio Code (VSCode).

ollama is an open-source, privacy-focused chatbot that operates entirely within the confines of your local machine, ensuring that your conversations remain private and secure. Unlike cloud-based chatbots that may store and analyze your conversations on remote servers, ollama processes all data locally, giving you full control over your interactions.

But how can you integrate ollama into your daily workflow seamlessly? Enter the continue extension for VSCode. This extension allows you to interact with ollama directly within your code editor, enabling a smooth and efficient workflow without the need for external applications or services.

How-to

  1. Install ollama: Begin by installing the ollama chatbot on your local machine. You can find detailed installation instructions on the project’s website.

  2. Install the continue Extension: Navigate to the VSCode marketplace and install the continue extension. This extension provides the interface for interacting with ollama directly within your code editor.

  3. Configure ollama in VSCode: Once both ollama and the continue extension are installed, install models needed in ollama and configure it within VSCode to tailor it to your preferences.

As an example, I want to install the codellama:7b model:

# Download the needed model
ollama pull codellama:7b

# Start the ollama server
ollama serve

$HOME/.continue/config.json:

{
  "models": [
    {
      "title": "Codelama 7b",
      "provider": "ollama",
      "model": "codellama:7b",
      "completionOptions": {}
    }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "share",
      "description": "Export this session as markdown"
    },
    {
      "name": "cmd",
      "description": "Generate a shell command"
    }
  ],
  "customCommands": [
    {
      "name": "test",
      "prompt": "Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "contextProviders": [
    {
      "name": "diff",
      "params": {}
    },
    {
      "name": "open",
      "params": {}
    },
    {
      "name": "terminal",
      "params": {}
    },
    {
      "name": "problems",
      "params": {}
    },
    {
      "name": "codebase",
      "params": {}
    },
    {
      "name": "folder",
      "params": {}
    }
  ],
  "tabAutocompleteModel": {
    "title": "Codelama 7b",
    "provider": "ollama",
    "model": "codellama:7b"
  },
  "allowAnonymousTelemetry": false,
  "embeddingsProvider": {
    "provider": "transformers.js"
  }
}
  1. Start Chatting: With ollama up and running in VSCode, you’re ready to start chatting! Simply invoke the chatbot using the designated command or trigger, and begin your conversation right within your code editor.

By leveraging the power of ollama and the convenience of the continue extension in VSCode, you can enjoy the benefits of AI-powered assistance without compromising on privacy or security. Whether you’re brainstorming ideas, seeking coding advice, or simply engaging in casual conversation, this combination offers a seamless and private alternative to cloud-based chatbots.

In an era where data privacy is of utmost importance, solutions like ollama and the continue extension empower users to take control of their digital interactions. With the ability to chat freely and securely right within their preferred code editor, developers and users alike can embrace the future of AI-powered communication without sacrificing their privacy.

Image of VSCode with working Ollama