Class: Genai::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/genai.rb', line 12

def initialize(api_key: nil, **options)
  @config = Config.new(api_key: api_key, **options)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/genai.rb', line 10

def config
  @config
end

Instance Method Details

#chatsObject



20
21
22
# File 'lib/genai.rb', line 20

def chats
  Chats.new(self)
end

#generate_content(model:, contents:, **options) ⇒ Object



24
25
26
# File 'lib/genai.rb', line 24

def generate_content(model:, contents:, **options)
  self.model(model).generate_content(contents: contents, **options)
end

#model(model_id) ⇒ Object



16
17
18
# File 'lib/genai.rb', line 16

def model(model_id)
  Model.new(self, model_id)
end