module RubyLLM::ActiveRecord::ActsAs

ActsAs provides class macros that turn ActiveRecord models into persisted RubyLLM objects. It is included into ActiveRecord::Base when the gem loads inside a Rails application, so the macros are available in every model.

class Chat < ApplicationRecord
  acts_as_chat
end

class Message < ApplicationRecord
  acts_as_message
end

class ToolCall < ApplicationRecord
  acts_as_tool_call
end

class Model < ApplicationRecord
  acts_as_model
end

class Batch < ApplicationRecord
  acts_as_batch
end

A chat record then answers the full chat API (ask, with_tools, with_schema, and the rest) while saving every message to the database. See ChatMethods, MessageMethods, ToolCallMethods, ModelMethods, and BatchMethods for the methods each macro adds.