github crmne/ruby_llm 1.9.1

9 hours ago

RubyLLM 1.9.1: Rails Namespaces, Vertex AI Auth & Anthropic Uploads 🛤️🔐

A focused patch release that keeps ActiveRecord integrations humming in namespaced apps, restores Anthropic uploads, and hardens Vertex AI auth while smoothing out MySQL migrations and attachment handling.

🧭 Namespaced ActiveRecord Chats Keep Their Foreign Keys

acts_as_* helpers now accept explicit foreign key overrides, matching Rails’ association API, so namespaced chats and tool calls work even when their FK column doesn’t follow the default pattern.

class Support::Message < ActiveRecord::Base
  acts_as_message chat_class: "Support::Conversation",
                  chat_foreign_key: "conversation_id",
                  tool_call_class: "Support::ToolCall",
                  tool_calls_foreign_key: "support_tool_call_id"
end
  • Fixes the regression introduced in 1.8.x for engines and modularized apps.
  • Generators include the right foreign keys out of the box when you opt into namespaces.

🚆 Zeitwerk Eager Loading Behaves Outside Rails

The Railtie is now safely ignored during eager loading when Rails::Railtie isn’t defined, preventing NameError crashes in gems and background workers that depend on RubyLLM but don’t run inside Rails.

📎 Attachments Understand Uploaded Files

RubyLLM::Attachment detects ActionDispatch::Http::UploadedFile, Pathname, and Active Storage blobs automatically, preserving filenames and content types so file flows stay intact across providers.

attachment = RubyLLM::Attachment.new(params[:file])
attachment.filename # => original upload name
  • Normalizes MIME detection and rewinds IO sources for consistent encoding.
  • Anthropic uploads once again serialize local PDFs/images correctly after the 1.9.0 regression fix.

🔐 Vertex AI Auth Uses googleauth the Right Way

Swapped fetch_access_token! for apply when building Vertex AI headers, keeping compatibility with recent googleauth releases and avoiding token caching errors.

🗄️ MySQL JSON Columns Skip Illegal Defaults

Rails generators detect MySQL adapters and omit default values for JSON columns, eliminating migration errors on Aurora/MySQL deployments.

🧪 Reliability Tweaks

Fresh specs cover RubyLLM::Utils coercion helpers so nested hashes and key transforms stay stable as we expand provider support.

Installation

gem "ruby_llm", "1.9.1"

Upgrading from 1.9.0

bundle update ruby_llm

Merged PRs

New Contributors

Full Changelog: 1.9.0...1.9.1

Don't miss a new ruby_llm release

NewReleases is sending notifications on new releases.