Sha256: b8ee44e979db4e3c214b2563b75c4e4242e1e7babf9d6ad634e60b3e5d3aa02b

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

require_relative '../helpers/hash'

module NanoBot
  module Logic
    module Cartridge
      module Streaming
        def self.enabled?(cartridge, interface)
          provider_stream = case Helpers::Hash.fetch(cartridge, %i[provider id])
                            when 'openai'
                              Helpers::Hash.fetch(cartridge, %i[provider settings stream])
                            when 'google'
                              Helpers::Hash.fetch(cartridge, %i[provider options stream])
                            end

          return false if provider_stream == false

          specific_interface = Helpers::Hash.fetch(cartridge, [:interfaces, interface, :output, :stream])

          return specific_interface unless specific_interface.nil?

          interface = Helpers::Hash.fetch(cartridge, %i[interfaces output stream])

          return interface unless interface.nil?

          true
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nano-bots-2.2.0 logic/cartridge/streaming.rb
nano-bots-2.1.0 logic/cartridge/streaming.rb
nano-bots-2.0.0 logic/cartridge/streaming.rb
nano-bots-1.2.0 logic/cartridge/streaming.rb