yera.cli.setup_handlers.ollama

Ollama provider setup handler.

Symbols

class OllamaSetup — Handler for configuring Ollama provider connections.

OllamaSetup

Handler 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

detect_config — Attempts to automatically detect the Ollama server URL.
ask_for_config — Interactively prompts the user for the Ollama server URL.
validate — Validates connectivity to the Ollama server.

OllamaSetup.detect_config

detect_config() → OllamaConnection | None

Attempts 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

type: OllamaConnection | None

An OllamaConnection instance containing the detected base URL.

OllamaSetup.ask_for_config

ask_for_config() → OllamaConnection | None

Interactively prompts the user for the Ollama server URL.

Returns

type: OllamaConnection | None

An OllamaConnection instance containing the user-provided URL, or None if the user declines the setup.

OllamaSetup.validate

validate(
    config: OllamaConnection,
) → None

Validates 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

config
type: OllamaConnection

The Ollama connection configuration to validate.

Raises

ValueError

If the server is unreachable or returns an error, indicating that 'ollama serve' may not be running.