Class: Rasti::AI::Client

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

Direct Known Subclasses

Anthropic::Client, Gemini::Client, OpenAI::Client

Constant Summary collapse

RETRYABLE_STATUS_CODES =
[502, 503, 504].freeze

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, logger: nil, http_connect_timeout: nil, http_read_timeout: nil, http_max_retries: nil, usage_tracker: nil) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
# File 'lib/rasti/ai/client.rb', line 7

def initialize(api_key:nil, logger:nil, http_connect_timeout:nil, http_read_timeout:nil, http_max_retries:nil, usage_tracker:nil)
  @api_key = api_key || default_api_key
  @logger = logger || Rasti::AI.logger
  @http_connect_timeout = http_connect_timeout || Rasti::AI.http_connect_timeout
  @http_read_timeout = http_read_timeout || Rasti::AI.http_read_timeout
  @http_max_retries = http_max_retries || Rasti::AI.http_max_retries
  @usage_tracker = usage_tracker || Rasti::AI.usage_tracker
end