Feat/ollama provider#2
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.