ensure_ollama_available

ensure_ollama_available(
    timeout=2.0,
    start_if_needed=False,
    startup_timeout=10.0,
)

Check that the Ollama server is reachable, optionally starting it locally.

Parameters

Name Type Description Default
timeout float Timeout in seconds for each connectivity probe. 2.0
start_if_needed bool If True, try to start ollama serve when the default local server is not reachable. False
startup_timeout float Maximum seconds to wait after auto-starting the server. 10.0

Returns

Name Type Description
str Base URL string for the reachable Ollama server.

Raises

Name Type Description
RuntimeError If Ollama is not reachable and cannot be started.