module RubyLLM::ActiveRecord::ActsAs

Adds the RubyLLM conversation API to application-owned records.

class Chat < ApplicationRecord
  acts_as_chat
end

class Message < ApplicationRecord
  acts_as_message
  has_many_attached :attachments
end

chat = Chat.create!(model: "gpt-5.6-luna")
response = chat.ask "Summarize this report.", with: report.document
response.content
chat.cost.total

The install generator creates the required schema. The chat_ui generator adds controllers, an Active Job, and Turbo Stream views.