Class: AIRecordFinder::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_record_finder/client.rb

Overview

Transport facade. Selects the provider configured via ‘configuration.provider` and delegates chat completion to it.

Kept as a stable entry point so callers (and AIAdapter) depend on a single ‘#chat_completion(system_prompt:, user_prompt:)` interface regardless of whether the backing provider is OpenAI, Anthropic, or another vendor.

Instance Method Summary collapse

Constructor Details

#initialize(configuration:, connection: nil) ⇒ Client

Returns a new instance of Client.



13
14
15
# File 'lib/ai_record_finder/client.rb', line 13

def initialize(configuration:, connection: nil)
  @provider = Providers.build(configuration: configuration, connection: connection)
end

Instance Method Details

#chat_completion(system_prompt:, user_prompt:) ⇒ Object



17
18
19
# File 'lib/ai_record_finder/client.rb', line 17

def chat_completion(system_prompt:, user_prompt:)
  @provider.chat_completion(system_prompt: system_prompt, user_prompt: user_prompt)
end