-
-
Notifications
You must be signed in to change notification settings - Fork 365
Add Microsoft Azure support #238
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Microsoft Azure support #238
Conversation
1653394
to
026073d
Compare
Code Climate has analyzed commit 026073d and detected 0 issues on this pull request. View more on Code Climate. |
Now sure why circle is failing, it seems all the tests are missing the |
fb2e672
to
4ece2ce
Compare
In cooperation with my colleague @rmachielse I've followed up on this. Initially I was looking at rebasing his changes, but I realized it would likely be easier to add the minimal required changes on top of In practice, the only differences that are really needed are to the require 'openai'
OpenAI.configure do |config|
config.access_token = Rails.application.config.app[:azure_openai_api_key]
config.uri_base = "#{Rails.application.config.app[:azure_openai_uri]}/openai/deployments/gpt-35-turbo"
config.api_type = :azure
config.api_version = '2023-03-15-preview'
end where In the process I realized there was an inconsistency with I think the being able to use Azure outweighs this inconsistency so I went ahead with the changes like this. If you want I can see if I can come up with a clean way of addressing this. My suggestion would be to do it in a separate PR though, since the behavior was already problematic (no trailing Curious to hear what you think @alexrudall ! |
516b2c3
to
a98cc7a
Compare
a98cc7a
to
15e2ceb
Compare
@alexrudall what do you think? These minimal changes should make it quite straight forward to at least allow usage of this gem with Microsoft Azure. |
I'd also like to see this merged. I think more and more people will be transitioning across to the Azure version, especially within corporate environments so this would be very helpful. |
I'm also hoping for this functionality. Been using this Gem for developing a proof of concept for a new feature, but my organization is moving to Azure OpenAI for a variety of reasons, so the ability to continue to use this gem with Azure would be great. |
We're also moving to an Azure based version of OpenAI so would love to see Azure support in this gem. |
@alexrudall seems like merging this PR would make a lot of people happy 😄 note that we simplified the implementation to the minimum necessary changes! |
Released in v4.2! Thanks for your patience on this all! @rmachielse and @steffansluis thanks a lot for your work. @steffansluis I fixed the trailing |
Problem
Resolves #231. We would like to use
ruby-openai
with Microsoft Azure OpenAI, however its endpoints and authentication headers are slightly different, making it impossible currently to use this gem.Solution
This PR adds a configuration setting
api_type
, which can be set to:azure
, similar to how https://github.com/openai/openai-python supports Microsoft Azure.Alternatives
I'm aware of the changes being worked on in #150, it might be possible to create a subclass of
OpenAI::Client
instead once this has been implemented. I'm happy to rebase and refactor this PR once this is merged.Additional context