Skip to content

feat: expose __version__ and top-level version() / async_version() helpers#653

Open
Ghraven wants to merge 1 commit intoollama:mainfrom
Ghraven:feat/expose-version
Open

feat: expose __version__ and top-level version() / async_version() helpers#653
Ghraven wants to merge 1 commit intoollama:mainfrom
Ghraven:feat/expose-version

Conversation

@Ghraven
Copy link
Copy Markdown

@Ghraven Ghraven commented Apr 27, 2026

Closes #646

What

Adds two things to the public ollama namespace:

ollama.__version__

The installed client package version — resolved via importlib.metadata, same mechanism already used internally in _client.py.

import ollama
print(ollama.__version__)  # e.g. "0.6.1"

ollama.version() / ollama.async_version()

Top-level wrappers around Client.version() that hit /api/version and return the running Ollama server version string — no need to instantiate a client manually.

print(ollama.version())    # e.g. "0.18.2"

Also exposes ollama.exists()

Wires up the new exists() method as a module-level shortcut, consistent with all other shortcuts (list, show, pull, etc.).

Files changed

  • ollama/__init__.py — adds __version__, version(), async_version(), exists shortcut, and updates __all__

Closes ollama#646

Adds two things to the public API:

1. `ollama.__version__` — the installed package version, resolved via
   `importlib.metadata` (same mechanism already used in `_client.py`).
   Now exported in `__all__` so it's part of the documented public API.

2. `ollama.version()` / `ollama.async_version()` — thin top-level
   wrappers around `Client.version()` so callers can check the running
   Ollama server version without instantiating a client.

Also wires up `exists = _client.exists` to expose the new method at
the top level, consistent with all other module-level shortcuts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: expose __version__ and top-level version() for server version Closes #623

1 participant