Skip to content

How do we use open router with Rails persistance? #226

Discussion options

You must be logged in to vote

I think this would work:

 class Chat < ApplicationRecord
    acts_as_chat

    validates :model_id, presence: true
    validates :provider, presence: true

    after_initialize :set_chat

    def set_chat
      @chat = RubyLLM::Chat.new(model:, provider:)
    end
  end

  Chat.new(model: 'whatever.model', provider: 'openrouter')

The doc isn't super clear on this.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@riyaadh-abrahams
Comment options

Answer selected by riyaadh-abrahams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants