Skip to content

Feat/ollama provider#2

Merged
robertmon-dev merged 3 commits into
mainfrom
feat/ollama-provider
Mar 17, 2026
Merged

Feat/ollama provider#2
robertmon-dev merged 3 commits into
mainfrom
feat/ollama-provider

Conversation

@robertmon-dev
Copy link
Copy Markdown
Owner

No description provided.

This commit introduces native support for local AI models via the
Ollama API, allowing users to generate commit messages with zero
data leaving their machine (privacy-first approach).

Key additions:
- OllamaProvider: Implements the `Provider` interface to communicate
  with the local Ollama REST API (`/api/chat`).
- Config Updates: Added environment variables (`OLLAMA_MODEL`,
  `OLLAMA_URL`) to configure the local endpoint.
- Smart Validation: The engine now considers the configuration valid
  if either a cloud API key OR a local Ollama configuration is present.
- Seamless Failover: Ollama is registered alongside cloud providers,
  allowing the engine to gracefully fall back to Gemini/OpenAI if the
  local daemon is not running.
This commit expands the provider test suite to include the newly
integrated local Ollama inference engine.

Key test scenarios added:
- `TestOllamaProvider_Generate`: Verifies successful local API
  communication and correct mapping of the JSON response.
- `TestOllamaProvider_ApiError`: Ensures that edge cases specific
  to Ollama (e.g., missing models returning HTTP 200 but embedding
  the error inside the JSON payload) are correctly identified and
  propagated to the engine.
This commit updates the `Processor` initialization to enforce a
true "Local First" approach.

The failover order has been adjusted to attempt the local Ollama
inference first. If the local daemon is unreachable or returns an
error, the engine will gracefully fall back to cloud providers
(Gemini -> Anthropic -> OpenAI). This guarantees privacy and zero
cost by default, while maintaining high availability. The context
timeout was also increased to 60s to accommodate local model loading.
@robertmon-dev robertmon-dev merged commit 7c24e8b into main Mar 17, 2026
2 checks passed
@robertmon-dev robertmon-dev deleted the feat/ollama-provider branch March 29, 2026 16:55
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

Successfully merging this pull request may close these issues.

1 participant