Sha256: 5c3ca57e7085f460e9c7a608470f24dfcdfdb736820e7c0085703ae08948727f
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
class Application class << self def connection endpoint = ENV["LISA_TYPECHAT_ENDPOINT"] || "https://lisa-typechat.listenai.com" @connection ||= Faraday.new(endpoint) do |faraday| faraday.adapter :async_http, clients: Async::HTTP::Faraday::PersistentClients faraday.request :json end end def llm_client @llm_client ||= OpenAI::Client.new( log_errors: true, access_token: env!("LISA_ACCESS_TOKEN"), request_timeout: ENV.fetch("LISA_LLM_REQUEST_TIMEOUT", 120).to_i, uri_base: ENV.fetch("LISA_LLM_URI_BASE", "https://api.listenai.com") ) do |faraday| faraday.adapter Faraday.default_adapter, clients: Async::HTTP::Faraday::PersistentClients end end def judge_llm_client @judge_llm_client ||= OpenAI::Client.new( log_errors: true, access_token: env!("JUDGE_ACCCESS_TOKEN"), request_timeout: ENV.fetch("LISA_LLM_REQUEST_TIMEOUT", 120).to_i, uri_base: ENV.fetch("JUDGE_LLM_URI_BASE", "https://api.listenai.com") ) do |faraday| faraday.adapter Faraday.default_adapter, clients: Async::HTTP::Faraday::PersistentClients end end def llm_client_extra_headers=(headers) OpenAI.configure do |config| config.extra_headers = headers end end def env!(name) ENV[name] or raise "missing environment variable: #{name}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kaba-0.5.0 | lib/kaba/application.rb |
kaba-0.4.0 | lib/kaba/application.rb |