This package does not have a similar error handling. Might be good to add it. Can be done by adding a check after initialising self._client as follows
try:
response = self._client.head(self._client.base_url)
response.raise_for_status()
except httpx.ConnectError as e:
raise ConnectionError("could not connect to ollama app, is it running?")
except Exception as e:
raise e
I can open a PR for this if you think it is worthwhile.
The Ollama app returns an error message if the connection is refused pointing out that the server might not be running.
https://github.com/ollama/ollama/blob/8645076a71941d78a996e52cff65c794df6cdbcb/cmd/cmd.go#L893
This package does not have a similar error handling. Might be good to add it. Can be done by adding a check after initialising
self._client
as followsI can open a PR for this if you think it is worthwhile.