Class: Riffer::Providers::AzureOpenAI

Inherits:
OpenAI
  • Object
show all
Defined in:
lib/riffer/providers/azure_open_ai.rb,
sig/generated/riffer/providers/azure_open_ai.rbs

Overview

Azure OpenAI provider for GPT models hosted on Azure. Requires the openai gem. Credentials resolve from kwargs, then config, then AZURE_OPENAI_API_KEY / AZURE_OPENAI_ENDPOINT.

Constant Summary

Constants inherited from OpenAI

OpenAI::WEB_SEARCH_TOOL_TYPE

Constants inherited from Base

Base::REQUEST_PARAM_ATTRIBUTES, Base::WIRE_SEPARATOR

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OpenAI

#build_finish_reason, #build_request_params, #build_token_usage, #convert_assistant_to_openai_format, #convert_file_part_to_openai_format, #convert_messages_to_openai_format, #convert_tool_to_openai_format, #execute_generate, #execute_stream, #extract_content, #extract_finish_reason, #extract_token_usage, #extract_tool_calls, #handle_function_call_arguments_delta, #handle_function_call_arguments_done, #handle_output_item_added_function_call, #handle_output_item_done_web_search, #handle_output_text_delta, #handle_output_text_done, #handle_reasoning_summary_text_delta, #handle_reasoning_summary_text_done, #handle_response_finished, #handle_web_search_status, #incomplete_finish_reason

Methods inherited from Base

#apply_pricing, #build_request_params, #capture_input, #capture_messages?, #capture_output, #chat_span_attributes, #decode_tool_name, #depends_on, #encode_tool_name, #execute_generate, #execute_stream, #extract_content, #extract_finish_reason, #extract_token_usage, #extract_tool_calls, #generate_text, #in_chat_span, #merge_consecutive_messages, #normalize_messages, #parse_structured_output, #parse_tool_arguments, #pricing_rates, #record_finish_reason, #record_stream_outcome, skills_adapter, #stream_text, #tag_attributes, #validate_input!, #validate_normalized_messages!, #yield_finish_reason

Constructor Details

#initialize(**options) ⇒ AzureOpenAI

-- : (**untyped) -> void

Parameters:

  • (Object)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/riffer/providers/azure_open_ai.rb', line 17

def initialize(**options)
  depends_on "openai"

  api_key = options.fetch(:api_key) {
    Riffer.config.azure_openai.api_key || ENV["AZURE_OPENAI_API_KEY"]
  }
  base_url = options.fetch(:base_url) {
    Riffer.config.azure_openai.endpoint || ENV["AZURE_OPENAI_ENDPOINT"]
  }
  @client = ::OpenAI::Client.new(
    api_key: api_key,
    base_url: base_url,
    **options.except(:api_key, :base_url)
  )
end

Class Method Details

.semconv_provider_nameString

The GenAI semconv well-known provider name.

: () -> String

Returns:

  • (String)


11
12
13
# File 'lib/riffer/providers/azure_open_ai.rb', line 11

def self.semconv_provider_name
  "azure.ai.openai"
end