Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ability to connect to Azure OpenAI #17

Closed
svilupp opened this issue Mar 22, 2023 · 3 comments
Closed

Feature request: Ability to connect to Azure OpenAI #17

svilupp opened this issue Mar 22, 2023 · 3 comments

Comments

@svilupp
Copy link
Contributor

svilupp commented Mar 22, 2023

Thank you for the package!

Currently, it's limited to OpenAI API v1 only (via preset BASE_URL_V1 in https://github.com/rory-linehan/OpenAI.jl/blob/226a4779dcda21c0ee9b41f255c821d94675227e/src/OpenAI.jl#L6).

It would be awesome if we could change the API provider and use Azure OpenAI etc. Similar to what you can do with Python OpenAI package.

There a user can change 3 parameters to be able to use Azure instead of OpenAI

openai.api_type = "azure"
openai.api_base = "https://example-endpoint.openai.azure.com"
openai.api_version = "2022-12-01"

openai.api_key = "..."

I could envision having some Provider types that a user could customize to connect to their own deployments, eg,

abstract type AbstractOpenAIProvider end
struct OpenAI <: AbstractOpenAIProvider
    api_key::String
    base_url::String
    api_version::String
end
struct Azure <: AbstractOpenAIProvider
    api_key::String
    base_url::String
    api_version::String
end

Technically, this could also circumvent the need to keep constantly providing an API key for each call (it rarely changes between calls).

I'm happy to open a PR to showcase what I'm thinking. Would you be interested in it?

On that note, would you be interested in Provider types (ala above) or rather defining a set of global constants for each parameter (ala BASE_URL_V1) that the users would have to override with @eval?

@roryl23
Copy link
Collaborator

roryl23 commented Mar 22, 2023

I like the Azure integration idea, and Abstract types seems like a great idea for maintainability in the long term. If you want to submit a PR, be my guest! I'd be happy to help review, update tests, release, etc. to get your contribution released ASAP.

@svilupp
Copy link
Contributor Author

svilupp commented Mar 22, 2023

Sounds good! I like ASAP.

I have something running locally, so let me open the PR tonight

@roryl23
Copy link
Collaborator

roryl23 commented Mar 25, 2023

Merged and released 0.8.0 with these changes

@roryl23 roryl23 closed this as completed Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants