mirror of
https://github.com/ollama/ollama-python.git
synced 2026-05-01 11:48:17 +08:00
fix: add __version__ attribute to package
The ollama package was missing a __version__ attribute, causing AttributeError when users try to access ollama.__version__. This fix adds __version__ using importlib.metadata.version() which reads the version from package metadata (set by hatch-vcs from git tags). Falls back to '0.0.0' if metadata is unavailable. Fixes #623 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dbccf192ac
commit
c6199e3eea
@ -1,3 +1,5 @@
|
||||
from importlib.metadata import version as _get_version
|
||||
|
||||
from ollama._client import AsyncClient, Client
|
||||
from ollama._types import (
|
||||
ChatResponse,
|
||||
@ -19,6 +21,11 @@ from ollama._types import (
|
||||
WebSearchResponse,
|
||||
)
|
||||
|
||||
try:
|
||||
__version__ = _get_version('ollama')
|
||||
except Exception:
|
||||
__version__ = '0.0.0'
|
||||
|
||||
__all__ = [
|
||||
'AsyncClient',
|
||||
'ChatResponse',
|
||||
@ -39,6 +46,7 @@ __all__ = [
|
||||
'Tool',
|
||||
'WebFetchResponse',
|
||||
'WebSearchResponse',
|
||||
'__version__',
|
||||
]
|
||||
|
||||
_client = Client()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user