Want to run AI Large Language Models (LLM) locally? One great way is with Ollama, which can host many state of the art LLMs. Ollama is a command-line utility (CLI) that can be used to download and manage the model files (which are often multiple GB), perform the actual LLM inference, and provide a REST API to expose the LLMs to other applications on your system. Ollama is quick to install.
This repo contains functions for PowerShell. You can dot source this file to make the functions available in your current PowerShell session, or add it to your profile to make them available for every session. This was developed on Windows, but should work as-is on a Linux or MacOS system with pwsh installed.
Use Winget or UniGetUI to iunstall Ollama.
winget install --id=ollama.ollama
Once setup has completed, you should have an Ollama shortcut in your start menu. You can use that if you would like for Ollama to run as a service, which makes its API available to other applications besides these scripts. (Recommended.) Follow the Ollama Quickstart page to "pull" (download) a model. The functions specify Llama 3.1 model, but there are many others in their library. The model can be easily changed by modifying the functions. Here is an example command to donwload Llama 3.1:
ollama pull llama3.1
. .\ollama-helpers.ps1
You can use Get-Command to ensure that the functions are available:
PS> Get-Command ask
CommandType Name Version Source
----------- ---- ------- ------
Function ask
Simply type ask
or New-ImagePrompt
, followed by instructions for the LLM, enclosed in single or double quotes.
PS C:\Users\hal> ask 'what is your favorite color?'
I don't have a personal preference for colors, nor do I have personal experiences or emotions. I'm designed to provide
information and assist with tasks, but I don't have subjective experiences like humans do.
That being said, I can tell you about different colors, their meanings, and associations in various cultures if that's helpful!
Would you like to know something specific about a particular color?
PS C:\Users\hal> New-ImagePrompt "simple triangle"
A delicate, hand-drawn simple triangle in the foreground, slightly elevated on a worn, wooden pedestal, about 1/3 from the
bottom of the frame and 2/5 from the left edge, with its base aligned almost perfectly parallel to the horizon line. In the
background, a blurred image of a bustling cityscape is visible, perhaps a faded photograph or a watercolor painting, featuring
a mix of modern skyscrapers and historic buildings about 3/4 from the top and 1/2 from the right edge. A few subtle hints of
natural light creep through the city's architecture, illuminating the triangle with a warm, golden glow. The pedestal itself is
weathered to a soft grayish-brown color, while the triangle's lines are rendered in a bold, expressive black ink, contrasting
against a soft blue-white background that gradually fades into the subtle colors of the cityscape. The overall style is
reminiscent of late 19th-century Art Nouveau, with its emphasis on sinuous curves and fluid line work. The palette is
predominantly cool-toned, with touches of warmth from the golden light and the wood's patina, evoking a sense of contemplation
and quiet reflection, set against the vibrant, dynamic energy of the city behind.