Module: RubyLLM::Providers::OpenAIResponses::MessageMethodsExtension
- Defined in:
- lib/ruby_llm/providers/openai_responses/active_record_extension.rb
Overview
Extension for the NEW MessageMethods (RubyLLM 2.0+)
Instance Method Summary collapse
Instance Method Details
#to_llm ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruby_llm/providers/openai_responses/active_record_extension.rb', line 15 def to_llm cached = has_attribute?(:cached_tokens) ? self[:cached_tokens] : nil cache_creation = has_attribute?(:cache_creation_tokens) ? self[:cache_creation_tokens] : nil 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, cached_tokens: cached, cache_creation_tokens: cache_creation, model_id: model_association&.model_id, response_id: resp_id ) end |