Class: LeonardoAI::Client
- Inherits:
-
Object
- Object
- LeonardoAI::Client
show all
- Includes:
- HTTP
- Defined in:
- lib/leonardoai/client.rb
Constant Summary
collapse
- CONFIG_KEYS =
%i[
api_type
api_version
access_token
uri_base
request_timeout
extra_headers
].freeze
Instance Method Summary
collapse
Methods included from HTTP
#delete, #get, #json_post, #multipart_post
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
15
16
17
18
19
20
21
|
# File 'lib/leonardoai/client.rb', line 15
def initialize(config = {})
CONFIG_KEYS.each do |key|
instance_variable_set("@#{key}", config[key] || LeonardoAI.configuration.send(key))
end
end
|
Instance Method Details
#chat(parameters: {}) ⇒ Object
23
24
25
|
# File 'lib/leonardoai/client.rb', line 23
def chat(parameters: {})
json_post(path: "/chat/completions", parameters: parameters)
end
|
#datasets ⇒ Object
39
40
41
|
# File 'lib/leonardoai/client.rb', line 39
def datasets
@datasets ||= LeonardoAI::Datasets.new(client: self)
end
|
#generations ⇒ Object
27
28
29
|
# File 'lib/leonardoai/client.rb', line 27
def generations
@generations ||= LeonardoAI::Generations.new(client: self)
end
|
#models ⇒ Object
31
32
33
|
# File 'lib/leonardoai/client.rb', line 31
def models
@models ||= LeonardoAI::Models.new(client: self)
end
|
#variations ⇒ Object
35
36
37
|
# File 'lib/leonardoai/client.rb', line 35
def variations
@variations ||= LeonardoAI::Variations.new(client: self)
end
|