Class: Llm::Clients::AzureOpenAi

Inherits:
Base
  • Object
show all
Defined in:
lib/llm/clients/azure_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: 30000) ⇒ AzureOpenAi

Returns a new instance of AzureOpenAi.



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

def initialize(timeout: 30000)
  @client = OpenAI::Client.new(
    api_type: :azure,
    api_version: ENV.fetch("AZURE_API_VERSION"),
    access_token: ENV.fetch("AZURE_OPENAI_API_KEY"),
    uri_base: "#{ENV.fetch("AZURE_API_BASE")}/openai/deployments/#{ENV.fetch("AZURE_DEPLOYMENT_NAME")}",
    request_timeout: timeout,
  )
end