ruby_llm  by crmne

Ruby SDK for unified AI model access

Created 7 months ago
2,917 stars

Top 16.3% on SourcePulse

GitHubView on GitHub
Project Summary

RubyLLM provides a unified Ruby interface for interacting with various large language models and AI services, abstracting away the complexities of individual provider SDKs. It targets Ruby developers seeking a consistent and idiomatic way to integrate AI capabilities like chat, image generation, embeddings, and tool usage into their applications, simplifying multi-provider workflows and reducing dependency bloat.

How It Works

The library employs a strategy of creating a single, consistent API layer over diverse AI provider clients. It uses a modular design where each provider is implemented as a distinct adapter. This approach allows developers to switch between providers with minimal code changes, as the core RubyLLM.chat interface and response formats remain constant. Key features like streaming, tool usage, and multi-modal inputs (vision, audio, PDF) are handled through this unified abstraction.

Quick Start & Requirements

  • Install via RubyGems: gem install ruby_llm or add gem 'ruby_llm' to your Gemfile and run bundle install.
  • Requires Ruby. API keys for desired providers (OpenAI, Anthropic, Gemini, etc.) must be configured, preferably via environment variables.
  • Official documentation is available for installation, configuration, and guides on specific features: https://github.com/crmne/ruby_llm#readme

Highlighted Details

  • Supports a wide range of providers including OpenAI, Anthropic, Gemini, Bedrock, OpenRouter, DeepSeek, and Ollama.
  • Offers unified interfaces for chat, vision, audio transcription, PDF analysis, image generation, and text embeddings.
  • Features robust tool (function calling) support for enabling AI to execute custom Ruby code.
  • Includes seamless Rails integration with acts_as_chat and acts_as_message for persistent conversation history.
  • Handles real-time streaming responses using idiomatic Ruby blocks.

Maintenance & Community

The project is actively maintained by crmne. Contribution guidelines are available in CONTRIBUTING.md.

Licensing & Compatibility

Released under the MIT License. This permissive license allows for commercial use and integration into closed-source applications.

Limitations & Caveats

While the library aims for broad compatibility, specific model capabilities (e.g., advanced vision or audio features) may vary depending on the underlying AI provider's implementation. Users must manage individual provider API keys and potential rate limits.

Health Check
Last Commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
38
Issues (30d)
34
Star History
207 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.