Class: RCrewAI::LLMClients::Azure
- Defined in:
- lib/rcrewai/llm_clients/azure.rb
Overview
Azure OpenAI: same wire format as OpenAI but routes through a deployment path with an api-version query param, and authenticates with an api-key header instead of Authorization: Bearer.
Constant Summary
Constants inherited from OpenAI
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(config = RCrewAI.configuration) ⇒ Azure
constructor
A new instance of Azure.
- #models ⇒ Object
Methods inherited from OpenAI
#chat, #supports_native_tools?
Methods inherited from Base
#chat, #complete, #supports_native_tools?
Constructor Details
#initialize(config = RCrewAI.configuration) ⇒ Azure
Returns a new instance of Azure.
11 12 13 14 15 16 |
# File 'lib/rcrewai/llm_clients/azure.rb', line 11 def initialize(config = RCrewAI.configuration) super @api_version = config.api_version || '2024-02-01' @deployment_name = config.deployment_name || config.model @base_url = build_endpoint_url end |
Instance Method Details
#models ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/rcrewai/llm_clients/azure.rb', line 18 def models url = "#{@base_url}/openai/deployments?api-version=#{@api_version}" response = http_client.get(url, {}, build_headers.merge(auth_header)) result = handle_response(response) Array(result['data']).map { |d| d['id'] } rescue StandardError [@deployment_name].compact end |