Class: PatientLLM::Configuration
- Inherits:
-
Object
- Object
- PatientLLM::Configuration
- Defined in:
- lib/patient_llm/configuration.rb
Overview
Configuration for provider registry.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#lookup(name) ⇒ Hash?
Look up a registered provider by name.
-
#provider(name, url:, headers: {}, serializer: :chat_completion, completion_path: nil, params: {}) ⇒ void
Register a provider with a base URL and default headers.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 |
# File 'lib/patient_llm/configuration.rb', line 14 def initialize @providers = {} end |
Instance Method Details
#lookup(name) ⇒ Hash?
Look up a registered provider by name.
46 47 48 |
# File 'lib/patient_llm/configuration.rb', line 46 def lookup(name) @providers[name&.to_s] end |
#provider(name, url:, headers: {}, serializer: :chat_completion, completion_path: nil, params: {}) ⇒ void
This method returns an undefined value.
Register a provider with a base URL and default headers.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/patient_llm/configuration.rb', line 27 def provider(name, url:, headers: {}, serializer: :chat_completion, completion_path: nil, params: {}) sym = serializer.to_sym unless PatientLLM::VALID_SERIALIZERS.include?(sym) raise ArgumentError, "Unknown serializer: #{sym.inspect}. Valid options: #{PatientLLM::VALID_SERIALIZERS.map(&:inspect).join(", ")}" end @providers[name.to_s] = { url: url, headers: headers, serializer: sym, completion_path: completion_path, params: params } end |