Class: Apologist::AgentClient
- Inherits:
-
Object
- Object
- Apologist::AgentClient
- Defined in:
- lib/Apologist/client.rb
Instance Method Summary collapse
- #benchmarks ⇒ Apologist::Benchmarks::Client
- #channels ⇒ Apologist::Channels::Client
- #chat ⇒ Apologist::Chat::Client
- #corpus ⇒ Apologist::Corpus::Client
- #ct_as ⇒ Apologist::CtAs::Client
- #evaluators ⇒ Apologist::Evaluators::Client
- #initialize(api_key:, base_url: nil, domain: nil, max_retries: 2) ⇒ void constructor
- #shares ⇒ Apologist::Shares::Client
- #users ⇒ Apologist::Users::Client
Constructor Details
#initialize(api_key:, base_url: nil, domain: nil, max_retries: 2) ⇒ void
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/Apologist/client.rb', line 11 def initialize(api_key:, base_url: nil, domain: nil, max_retries: 2) unless domain.nil? domain_value = domain.nil? ? "your-agent-domain.com" : domain environment_url_templates = { Apologist::Environment::DEFAULT => "https://#{domain_value}/api/v1" } base_url = base_url.nil? ? "https://#{domain_value}/api/v1" : environment_url_templates.fetch(base_url, base_url) end @raw_client = Apologist::Internal::Http::RawClient.new( base_url: base_url || Apologist::Environment::DEFAULT, headers: { "User-Agent" => "apologist/0.0.5", "X-Fern-Language" => "Ruby", "x-api-key" => api_key.to_s }, max_retries: max_retries ) end |
Instance Method Details
#benchmarks ⇒ Apologist::Benchmarks::Client
57 58 59 |
# File 'lib/Apologist/client.rb', line 57 def benchmarks @benchmarks ||= Apologist::Benchmarks::Client.new(client: @raw_client) end |
#channels ⇒ Apologist::Channels::Client
62 63 64 |
# File 'lib/Apologist/client.rb', line 62 def channels @channels ||= Apologist::Channels::Client.new(client: @raw_client) end |
#chat ⇒ Apologist::Chat::Client
32 33 34 |
# File 'lib/Apologist/client.rb', line 32 def chat @chat ||= Apologist::Chat::Client.new(client: @raw_client) end |
#corpus ⇒ Apologist::Corpus::Client
37 38 39 |
# File 'lib/Apologist/client.rb', line 37 def corpus @corpus ||= Apologist::Corpus::Client.new(client: @raw_client) end |
#ct_as ⇒ Apologist::CtAs::Client
47 48 49 |
# File 'lib/Apologist/client.rb', line 47 def ct_as @ct_as ||= Apologist::CtAs::Client.new(client: @raw_client) end |
#evaluators ⇒ Apologist::Evaluators::Client
42 43 44 |
# File 'lib/Apologist/client.rb', line 42 def evaluators @evaluators ||= Apologist::Evaluators::Client.new(client: @raw_client) end |
#shares ⇒ Apologist::Shares::Client
67 68 69 |
# File 'lib/Apologist/client.rb', line 67 def shares @shares ||= Apologist::Shares::Client.new(client: @raw_client) end |
#users ⇒ Apologist::Users::Client
52 53 54 |
# File 'lib/Apologist/client.rb', line 52 def users @users ||= Apologist::Users::Client.new(client: @raw_client) end |