Module: RubyLLM::ActiveRecord::MessageMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/ruby_llm/active_record/acts_as.rb

Overview

Methods mixed into message models to handle serialization and provide a clean interface to the underlying message data.

Instance Method Summary collapse

Instance Method Details

#to_llmObject



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/ruby_llm/active_record/acts_as.rb', line 96

def to_llm
  RubyLLM::Message.new(
    role: role.to_sym,
    content: content,
    tool_calls: tool_calls,
    tool_call_id: tool_call_id,
    input_tokens: input_tokens,
    output_tokens: output_tokens,
    model_id: model_id
  )
end