components/providers/openai.rb in nano-bots-3.0.1 vs components/providers/openai.rb in nano-bots-3.2.0
- old
+ new
@@ -1,9 +1,11 @@
# frozen_string_literal: true
require 'openai'
+require 'faraday/typhoeus'
+
require_relative 'base'
require_relative '../crypto'
require_relative '../../logic/providers/openai/tools'
require_relative '../../logic/providers/openai/tokens'
@@ -33,10 +35,12 @@
"#{DEFAULT_ADDRESS}/"
else
"#{@credentials[:address].to_s.sub(%r{/$}, '')}/"
end
- @client = ::OpenAI::Client.new(uri_base:, access_token: @credentials[:'access-token'])
+ @client = ::OpenAI::Client.new(uri_base:, access_token: @credentials[:'access-token']) do |faraday|
+ faraday.adapter :typhoeus
+ end
end
def evaluate(input, streaming, cartridge, &feedback)
messages = input[:history].map do |event|
if event[:message].nil? && event[:meta] && event[:meta][:tool_calls]