Module: RubyLLM::ActiveRecord::MessageMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ruby_llm/active_record/message_methods.rb
Overview
Methods mixed into message models.
Instance Method Summary collapse
Instance Method Details
#thinking ⇒ Object
25 26 27 28 29 30 |
# File 'lib/ruby_llm/active_record/message_methods.rb', line 25 def thinking RubyLLM::Thinking.build( text: thinking_text_value, signature: thinking_signature_value ) end |
#to_llm ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_llm/active_record/message_methods.rb', line 13 def to_llm RubyLLM::Message.new( role: role.to_sym, content: extract_content, thinking: thinking, tokens: tokens, tool_calls: extract_tool_calls, tool_call_id: extract_tool_call_id, model_id: model_association&.model_id ) end |
#tokens ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/ruby_llm/active_record/message_methods.rb', line 32 def tokens RubyLLM::Tokens.build( input: input_tokens, output: output_tokens, cached: cached_value, cache_creation: cache_creation_value, thinking: thinking_tokens_value ) end |