Module: RubyLLM::Providers::OpenAIResponses::MessageLegacyMethodsExtension

Defined in:
lib/ruby_llm/providers/openai_responses/active_record_extension.rb

Overview

Extension for LEGACY MessageLegacyMethods (RubyLLM 1.x)

Instance Method Summary collapse

Instance Method Details

#to_llmObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ruby_llm/providers/openai_responses/active_record_extension.rb', line 55

def to_llm
  resp_id = has_attribute?(:response_id) ? self[:response_id] : nil

  RubyLLM::Message.new(
    role: role.to_sym,
    content: extract_content,
    tool_calls: extract_tool_calls,
    tool_call_id: extract_tool_call_id,
    input_tokens: input_tokens,
    output_tokens: output_tokens,
    model_id: model_id,
    response_id: resp_id
  )
end