Module: Zuno

Defined in:
lib/zuno.rb,
lib/zuno/chat.rb,
lib/zuno/version.rb,
lib/zuno/configuration.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

OPENAI_MODELS =
%w[gpt-3.5-turbo gpt-4-turbo gpt-4-turbo-preview gpt-4o gpt-4o-mini].freeze
VERSION =
"0.1.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



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

def configuration
  @configuration
end

Class Method Details

.chat(messages:, model: nil, **options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/zuno/chat.rb', line 9

def chat(messages:, model: nil, **options)
  model ||= Zuno.configuration.chat_completion_model
  provider = provider_for_model(model)
  raw_response = options.delete(:raw_response) || false

  if options[:stream]
    provider.chat_completion(messages, model, options, raw_response) do |chunk|
      yield chunk if block_given?
    end
  else
    provider.chat_completion(messages, model, options, raw_response)
  end
end

.configure {|configuration| ... } ⇒ Object

Yields:



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

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end