Class: Llm::Clients::OpenAi

Inherits:
Base
  • Object
show all
Defined in:
lib/llm/clients/open_ai.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#chat, #chat_with_function_calling_loop

Constructor Details

#initialize(timeout: 300) ⇒ OpenAi

Returns a new instance of OpenAi.



4
5
6
7
8
9
10
11
# File 'lib/llm/clients/open_ai.rb', line 4

def initialize(timeout: 300)
  @client = OpenAI::Client.new(
    api_version: ENV.fetch("OPENAI_API_VERSION"),
    access_token: ENV.fetch("OPENAI_API_KEY"),
    uri_base: "https://openai.com/openai/deployments/chat/completions",
    request_timeout: timeout,
  )
end