There's currently no clean way to check either the installed package version or the running Ollama server version from Python
Two small additions would fix this:
ollama.__version__ : the package version already exists internally, it just isn't exported. Exposing it follows standard Python packaging conventions and is a one-liner.
ollama.version() : a top-level wrapper around the existing Client.version() that hits /api/version. Async variant would be nice too.
Use case is things like this:
import ollama
print(ollama.__version__) # "0.6.1"
print(ollama.version()) # "0.18.2"
if ollama.version() >= "0.3.0":
# safe to use newer features
pass
Useful for version-gated feature checks and CI/CD pipelines where you want to assert compatibility before running tests.
There's currently no clean way to check either the installed package version or the running Ollama server version from Python
Two small additions would fix this:
ollama.__version__: the package version already exists internally, it just isn't exported. Exposing it follows standard Python packaging conventions and is a one-liner.ollama.version(): a top-level wrapper around the existingClient.version()that hits /api/version. Async variant would be nice too.Use case is things like this:
Useful for version-gated feature checks and CI/CD pipelines where you want to assert compatibility before running tests.