-
-
Notifications
You must be signed in to change notification settings - Fork 306
Closed
Labels
new providerNew provider integrationNew provider integration
Description
TL;DR: Add support for running fully local models via Ollama.
Background
While cloud models offer state-of-the-art capabilities, there are compelling cases for running models locally:
- Privacy & Compliance: Keep sensitive data entirely on-premise
- Cost Control: Eliminate ongoing API costs for high-volume applications
- Latency: Remove network overhead for latency-sensitive applications
- Offline Operation: Run AI features without internet connectivity
Ollama provides an excellent way to run models like Llama, Mistral, and others locally with a simple API that's compatible with our existing architecture.
Proposed Solution
Add a new provider interface for Ollama that implements our existing abstractions:
# Configuration
RubyLLM.configure do |config|
config.ollama_host = "http://localhost:11434" # Default
end
# Usage remains identical to cloud models
chat = RubyLLM.chat(model: 'llama2')
chat.ask("What's the capital of France?")
# Or with embeddings
RubyLLM.embed("Ruby is a programmer's best friend", model: 'nomic-embed-text')Technical Details
For those looking to help implement this, you'll need to:
- Create a new provider module in
lib/ruby_llm/providers/ollama/ - Implement the core provider interface methods:
complete- For chat functionalityembed- For embeddingsapi_base- Returns the Ollama API endpointcapabilities- Define model capabilities
- Handle the payload formatting differences between Ollama and OpenAI/Claude
The PR should include:
- Provider implementation
- Configuration option for Ollama host
- Tests that can be run against a local Ollama instance
- Documentation updates
Benefits
- Cost efficiency: Eliminate API costs for many use cases
- Privacy: Keep sensitive data local
- Flexibility: Mix and match local and cloud models in the same codebase
- Performance: Reduce latency for response-time sensitive applications
thanosbellos, chr0n1x, GyozaGuy, hahwul, xfyuan and 25 moreErCollao, 29decibel, janroudaut, joshuaneedham, iMartzen and 6 morethanosbellos, GyozaGuy, hahwul, frimmy, fzero and 1 more
Metadata
Metadata
Assignees
Labels
new providerNew provider integrationNew provider integration