RubyLLM is a Ruby gem that provides a unified and elegant interface to interact with various AI models and services. It simplifies the integration of AI functionalities such as chat, image generation, audio analysis, and embeddings into Ruby applications by offering a consistent API across multiple providers.
Key Features
Supports multiple AI providers including OpenAI, Anthropic Claude, Google Gemini, Amazon Bedrock, DeepSeek, Ollama, and OpenRouter.
Unified API for chat, vision, audio, PDF, images, embeddings, tools, and streaming.
Rails integration with ActiveRecord persistence via acts_as_chat.
Multimodal support for analyzing images, audio, documents, and text files.
Real-time streaming of responses.
Minimal dependencies, relying only on Faraday and Zeitwerk.
Comprehensive error handling with specific error types.
Built-in token tracking for cost management.
Tool integration with a clean, Ruby-like interface