yera.cli.setup_handlers.ollama
Ollama provider setup handler.
Symbols
OllamaSetup
BaseProviderSetupHandler for configuring Ollama provider connections.
This class manages the setup of the connection to a local or remote Ollama server, primarily focusing on the base URL configuration and connectivity verification.
Methods
OllamaSetup.detect_config
detect_config() → OllamaConnection | NoneAttempts to automatically detect the Ollama server URL.
Prioritises the OLLAMA_HOST environment variable, falling back to
the default local address (http://localhost:11434) if not set.
Returns
An OllamaConnection instance containing the detected base URL.
OllamaSetup.ask_for_config
ask_for_config() → OllamaConnection | NoneInteractively prompts the user for the Ollama server URL.
Returns
An OllamaConnection instance containing the user-provided URL, or None if the user declines the setup.
OllamaSetup.validate
validate(
config: OllamaConnection,
) → NoneValidates connectivity to the Ollama server.
Attempts to reach the /api/tags endpoint of the configured
base URL. This confirms that the Ollama service is actually
running and accessible from the current environment.
Parameters
The Ollama connection configuration to validate.
Raises
If the server is unreachable or returns an error, indicating that 'ollama serve' may not be running.