Skip to content

Conversation

@gjtorikian
Copy link
Contributor

What this does

This is a continuation of @oxaroky02's excellent PR (#279); in fact, I cherry-picked most of their commits. As mentioned, this adds the Azure OpenAI provider:

context = RubyLLM.context do |config| config.azure_openai_api_base = ENV.fetch('AZURE_OPENAI_URI') config.azure_openai_api_key = ENV.fetch('AZURE_OPENAI_API_KEY', nil) config.azure_openai_api_version = ENV.fetch('AZURE_OPENAI_API_VER', nil) config.default_model = ENV.fetch('AZURE_OPENAI_MODEL') || 'gpt-4o' end chat = context.chat( provider: :azure_openai, model: ENV.fetch('AZURE_OPENAI_MODEL') || 'gpt-4o', assume_model_exists: true) chat.ask "Hello!"

A lot of changes occurred since the PR was first opened, and, as I didn't have access to make changes to the original branch, I decided to just open a new PR with the fixes necessary to speed things up and push this addition over the line. Those changes include:

  • migrating the provider from a module to a class
  • removing extraneous files
  • adding VCR cassettes for the new provider

The biggest "gotcha" is that Azure OpenAI does not have all the models that "regular" OpenAI has; as well, the endpoints for some of the features are different. So there's some inheritance from the OpenAI provider going on, and some patches necessary to get this working with Azure.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
    • For provider changes: Re-recorded VCR cassettes with bundle exec rake vcr:record[provider_name]
    • All tests pass: bundle exec rspec
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

Related issues

Closes #15

@oxaroky02
Copy link

@gjtorikian, thank you for doing this. 🙏

@oxaroky02 oxaroky02 mentioned this pull request Dec 12, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants