How do we use open router with Rails persistance? #226
Answered
by
tpaulshippy
riyaadh-abrahams
asked this question in
Q&A
-
I am trying out RubyLLM 1.3.0 and wanted to know how to use OpenRouter with the acts_as_chat models. Not sure where to set the provider. |
Beta Was this translation helpful? Give feedback.
Answered by
tpaulshippy
Jun 7, 2025
Replies: 1 comment 1 reply
-
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. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
riyaadh-abrahams
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this would work:
The doc isn't super clear on this.