Module: RubyLLM::ActiveRecord::ChatMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ruby_llm/active_record/acts_as.rb
Overview
Methods mixed into chat models to handle message persistence and provide a conversation interface.
Instance Method Summary collapse
Instance Method Details
#chat ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ruby_llm/active_record/acts_as.rb', line 39 def chat @chat ||= begin chat = RubyLLM.chat(model: model_id) # Load existing messages into chat .each do |msg| chat.(msg.to_llm) end # Set up message persistence chat. { |msg| (msg) } . { |msg| (msg) } chat end end |