Module: AIRecordFinder::Providers

Defined in:
lib/ai_record_finder/providers.rb,
lib/ai_record_finder/providers/base.rb,
lib/ai_record_finder/providers/openai.rb,
lib/ai_record_finder/providers/anthropic.rb

Overview

Provider strategy registry. Maps a configured provider symbol to the concrete transport that speaks that vendor’s chat API.

Defined Under Namespace

Classes: Anthropic, Base, OpenAI

Constant Summary collapse

REGISTRY =
{
  openai: OpenAI,
  anthropic: Anthropic
}.freeze

Class Method Summary collapse

Class Method Details

.build(configuration:, connection: nil) ⇒ AIRecordFinder::Providers::Base

Parameters:

Returns:



19
20
21
22
23
24
25
26
27
28
# File 'lib/ai_record_finder/providers.rb', line 19

def self.build(configuration:, connection: nil)
  provider_class = REGISTRY[configuration.provider]
  unless provider_class
    raise ConfigurationError,
          "Unknown provider #{configuration.provider.inspect}. " \
          "Supported providers: #{REGISTRY.keys.join(", ")}"
  end

  provider_class.new(configuration: configuration, connection: connection)
end

.supportedObject



30
31
32
# File 'lib/ai_record_finder/providers.rb', line 30

def self.supported
  REGISTRY.keys
end