Skip to main content

ollama Command Line Interface

Installation

Windows

  1. Install Ubuntu on WSL via wsl ---install
  2. Start Ubuntu
  3. Install CUDA (https://docs.nvidia.com/cuda/wsl-user-guide/index.html)
  4. Install Ollama (https://ollama.ai/download/linux)

Start Ollama

After the installation start Ollama by ollama serve

If you get an error like

Error: listen tcp 127.0.0.1:11434: bind: address already in use

You can define the address to use for Ollama by setting the environment variable OLLAMA_HOST

export OLLAMA_HOST=localhost:8888

Run the LLM serving should give you the following output

wsl:~$ ollama serve
2023/10/25 19:38:15 images.go:822: total blobs: 0
2023/10/25 19:38:15 images.go:829: total unused blobs removed: 0
2023/10/25 19:38:15 routes.go:662: Listening on 127.0.0.1:8888 (version 0.1.5)

Pull a model

This step is optional. On the first usage, the model will get pulled anyway. Execute the following command to pull the llama2 model.

ollama pull llama2

Make sure you are using the same OLLAMA_HOST where your server is started.

On the server you should see output like:

[GIN] 2023/10/25 - 19:45:38 | 200 |        35.1µs |       127.0.0.1 | HEAD     "/"
[GIN] 2023/10/25 - 19:45:38 | 200 |     385.599µs |       127.0.0.1 | GET      "/api/tags"
2023/10/25 19:45:41 download.go:126: downloading 22f7f8ef5f4c in 64 59 MB part(s)
...

Install ollamac

  • Execute pip install ollamac

Usage

usage: ollamac.py [-h] [--model MODEL] [--host HOST] [--port PORT] [--sync]
                  prompt

ollama command line utility.

positional arguments:
  prompt         Required prompt to be send to the ollama model.

options:
  -h, --help     show this help message and exit
  --model MODEL  The name of the ollama model to use. Default is "llama2".
  --host HOST    The hostname where ollama serve is running. Default is
                 "localhost".
  --port PORT    The port where ollama serve is running. Default is "8888".
  --sync         This switch executes the query synchronous.

Examples

Blogpost

(.venv) PS F:\git\playground> python -m ollamac "Write a blogpost about the new iphone 15 in 400 words."                  

Title: The New iPhone 15: A Game-Changer in Smartphone Technology

Apple has just released its latest and greatest iPhone, the iPhone 15, and it's a real showstopper. Packed with cutting-edge technology and design innovations, this phone is sure to revolutionize the way we use our smartphones. Here are some of the most exciting features of the new iPhone 15:

Super Retina XDR Display: The iPhone 15 boasts a stunning Super Retina XDR display, which offers an unparalleled viewing experience. With a 120Hz refresh rate and a peak brightness of 1000 nits, this display is perfect for watching videos, playing games, and browsing the web.

A15 Bionic Chip: The iPhone 15 is powered by Apple's latest A15 Bionic chip, which provides lightning-fast performance and efficiency. This chip offers a 20% boost in processing speed and a 40% improvement in energy efficiency compared to the previous generation.       

Triple-Lens Camera: The iPhone 15 features a triple-lens camera system, including a wide-angle lens, a telephoto lens, and a macro lens. This allows users to capture stunning photos and videos with unparalleled detail and depth. The camera also supports advanced features like night mode, portrait mode, and more.

Longer Battery Life: With up to 12 hours of internet use on a single charge, the iPhone 15 offers significantly longer battery life than its predecessors. This means users can enjoy their phone all day without needing to worry about running out of juice.

Wireless Charging: The iPhone 15 supports wireless charging, allowing users to simply place their phone on a charging pad to recharge. This feature is especially convenient for those who are always on the go and don't want to be tethered to a cord.

Enhanced Security: With advanced biometric authentication features like Face ID and Touch ID, the iPhone 15 offers an unparalleled level of security. Users can securely unlock their phone with just a glance or a fingerprint, keeping their personal information safe from prying eyes.

Overall, the new iPhone 15 is a game-changer in smartphone technology. With its stunning display, powerful processor, advanced camera system, longer battery life, wireless charging capabilities, and enhanced security features, this phone is sure to revolutionize the way we use our smartphones. Whether you're a tech enthusiast or just looking for an upgrade, the iPhone 15 is definitely worth checking out.

Metadata

Release files for ollamac 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollamac 0.1.2
File Size Uploaded Provenance Actions
ollamac-0.1.2.tar.gz 4.5 kB Without provenance Details for ollamac-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ollamac 0.1.2
File Interpreter ABI Platform Actions
ollamac-0.1.2-py3-none-any.whl Python 3 none any Details for ollamac-0.1.2-py3-none-any.whl

Total release size: 9.5 kB

Release files / ollamac-0.1.2.tar.gz

Download URL ollamac-0.1.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a70edbfbed424fb72b987baa417b2c102167c03498dfb8cf68b6900c9de0cd34
BLAKE2b-256 checksum
How to use checksums
eade8c5eb897379ddd08bd1bf5984ecbaeccdd965ad5978b6f4af0708cb92119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.6 Windows/10

Release files / ollamac-0.1.2-py3-none-any.whl

Download URL ollamac-0.1.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adfbb1b98fa3d0530c7e5a80c922a3bf1921115fd1ce65701d46532ba2388833
BLAKE2b-256 checksum
How to use checksums
5d9de9bdd5c0a7681d845ce74ad7a7048724ab9bd9ea749678a3d82083d959ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.6 Windows/10

Security for ollamac 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page