Class: Durable::Llm::Providers::AzureOpenai::AzureOpenaiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/azure_openai.rb

Overview

Response wrapper for Azure OpenAI completion API responses

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ AzureOpenaiResponse



243
244
245
# File 'lib/durable/llm/providers/azure_openai.rb', line 243

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



241
242
243
# File 'lib/durable/llm/providers/azure_openai.rb', line 241

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



247
248
249
# File 'lib/durable/llm/providers/azure_openai.rb', line 247

def choices
  @raw_response['choices'].map { |choice| AzureOpenaiChoice.new(choice) }
end

#dataObject



251
252
253
# File 'lib/durable/llm/providers/azure_openai.rb', line 251

def data
  @raw_response['data']
end

#to_sObject



255
256
257
# File 'lib/durable/llm/providers/azure_openai.rb', line 255

def to_s
  choices.map(&:to_s).join(' ')
end