Class: Riffer::Providers::AzureOpenAI
- 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 config, then AZURE_OPENAI_API_KEY /
AZURE_OPENAI_ENDPOINT.
Constant Summary
Constants inherited from OpenAI
Constants inherited from Base
Base::REQUEST_PARAM_ATTRIBUTES, Base::WIRE_SEPARATOR
Class Method Summary collapse
-
.semconv_provider_name ⇒ String
The GenAI semconv well-known provider name.
Instance Method Summary collapse
-
#build_client ⇒ Object
Deliberately not compacted: this borrows the OpenAI SDK to talk to Azure, so omitting an unset argument would let the SDK fall back to
OPENAI_API_KEYandOPENAI_BASE_URL— sending Azure traffic, and an OpenAI credential, to whatever those name. -
#global_client ⇒ Object
-- : () -> untyped.
Methods inherited from OpenAI
#build_finish_reason, #build_request_params, #build_token_usage, #client, #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, #initialize
Methods inherited from Base
#apply_pricing, #build_request_params, #capture_input, #capture_messages?, #capture_output, #chat_span_attributes, #client, #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
This class inherits a constructor from Riffer::Providers::OpenAI
Class Method Details
.semconv_provider_name ⇒ String
The GenAI semconv well-known provider name.
: () -> String
11 12 13 |
# File 'lib/riffer/providers/azure_open_ai.rb', line 11 def self.semconv_provider_name "azure.ai.openai" end |
Instance Method Details
#build_client ⇒ Object
Deliberately not compacted: this borrows the OpenAI SDK to talk to Azure, so
omitting an unset argument would let the SDK fall back to OPENAI_API_KEY
and OPENAI_BASE_URL — sending Azure traffic, and an OpenAI credential, to
whatever those name. Passing nil raises in the SDK instead.
: () -> untyped
29 30 31 32 33 |
# File 'lib/riffer/providers/azure_open_ai.rb', line 29 def build_client api_key = Riffer.config.azure_openai.api_key || ENV.fetch("AZURE_OPENAI_API_KEY", nil) base_url = Riffer.config.azure_openai.endpoint || ENV.fetch("AZURE_OPENAI_ENDPOINT", nil) ::OpenAI::Client.new(api_key: api_key, base_url: base_url) end |
#global_client ⇒ Object
-- : () -> untyped
19 20 21 |
# File 'lib/riffer/providers/azure_open_ai.rb', line 19 def global_client Riffer.config.azure_openai.client end |