Per request configuration / Multi Tenants with multiple api_keys #37
-
I have a multi-tenant rails application (running in a threaded Puma server). This doesn't seem possible with the current global RubyLLM.config. What's the recommended way to way achieve this (if possible)? (So basically I'm looking for a per-request configuration option). Btw thanks for this nice gem! 🙏🏻 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For the moment I've implemented a monkey patch for the Rails project. (place this in the config/initializers) require 'ruby_llm'
module RubyLLM
class Current < ActiveSupport::CurrentAttributes
attribute :config
end
@@config_mutex = Mutex.new
def self.config
@@config_mutex.synchronize {
Current.config ||= Configuration.new
}
end
end |
Beta Was this translation helpful? Give feedback.
-
This PR will resolves this question #66 👍 |
Beta Was this translation helpful? Give feedback.
This PR will resolves this question #66 👍