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.
19 20 21 |
# File 'lib/patient_llm/configuration.rb', line 19 def initialize @providers = {} end |
Instance Method Details
#lookup(name) ⇒ Hash?
Look up a registered provider by name.
53 54 55 |
# File 'lib/patient_llm/configuration.rb', line 53 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.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/patient_llm/configuration.rb', line 32 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 ensure_auth_headers_use_secrets!(headers) @providers[name.to_s] = { url: url, headers: headers, serializer: sym, completion_path: completion_path, params: params } end |