Skip to content

Conversation

@SL-Mar
Copy link
Owner

@SL-Mar SL-Mar commented Jan 26, 2026

Summary

This PR adds support for Ollama, enabling users to run large language models locally without API costs. The implementation includes a new OllamaProvider class and integrates it into the existing LLM factory pattern.

Key Changes

  • New OllamaProvider class (quantcoder/llm/providers.py):

    • Implements local LLM inference using Ollama's OpenAI-compatible API
    • Supports multiple models (llama3.2, codellama, qwen2.5-coder, etc.)
    • Configurable base URL for custom Ollama deployments
    • Async chat completion support consistent with other providers
  • Updated LLMFactory (quantcoder/llm/providers.py):

    • Added "ollama" to PROVIDERS registry
    • Made api_key parameter optional (not required for Ollama)
    • Added base_url parameter to support local provider configuration
    • Updated factory method to handle Ollama's different initialization requirements
  • Configuration updates (quantcoder/config.py):

    • Added ollama_base_url and ollama_model fields to ModelConfig
    • Updated provider comment to include "ollama" option
    • Exported Ollama settings in to_dict() method for configuration serialization
  • Bug fix: Fixed typo in LLMFactory.PROVIDERS ("Mistral Provider" → "MistralProvider")

Implementation Details

  • Ollama provider uses OpenAI's AsyncOpenAI client with a custom base URL, leveraging Ollama's OpenAI-compatible API endpoint
  • Default configuration points to http://localhost:11434/v1 with llama3.2 model
  • API key is set to "ollama" (required by OpenAI client but unused by Ollama)
  • Maintains consistency with existing provider interface for seamless integration

- Add OllamaProvider class for local model inference without API costs
- Support popular models: llama3.2, codellama, qwen2.5-coder, mistral
- Update LLMFactory with Ollama registration and base_url parameter
- Add ollama_base_url and ollama_model config options
- Fix typo: "Mistral Provider" -> "MistralProvider"
@SL-Mar SL-Mar merged commit df00a38 into main Jan 26, 2026
4 of 14 checks passed
@SL-Mar SL-Mar deleted the claude/document-gamma-branch-1ZWJ9 branch January 26, 2026 00:25
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.

2 participants