Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error message when Ollama server isn't running #120

Open
shivakanthsujit opened this issue Apr 18, 2024 · 0 comments
Open

Add an error message when Ollama server isn't running #120

shivakanthsujit opened this issue Apr 18, 2024 · 0 comments

Comments

@shivakanthsujit
Copy link

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 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.

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

No branches or pull requests

1 participant