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

support azure openai api #4

Open
timlincool opened this issue Apr 14, 2023 · 4 comments
Open

support azure openai api #4

timlincool opened this issue Apr 14, 2023 · 4 comments
Labels
bot This issue is about bot features enhancement New feature or request

Comments

@timlincool
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I have an azure openai api account, but I don't see where it can be used

Describe the solution you'd like
A clear and concise description of what you want to happen.

If not, can you access the azure openai api?

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

It may be possible to add a proxy, but I haven't tested it
https://github.com/stulzq/azure-openai-proxy

Additional context
Add any other context or screenshots about the feature request here.

@timlincool timlincool added the enhancement New feature or request label Apr 14, 2023
@momegas
Copy link
Owner

momegas commented Apr 14, 2023

Haven't searched through this specific API. Do I need any special access? Can you point me to some relevant documentation?

@timlincool
Copy link
Author

timlincool commented Apr 17, 2023

Thank you for your hard work on this project! I was wondering if it's possible to add support for Azure OpenAI API. I noticed that Auto-GPT supports Azure API, which might be a helpful reference for implementation. Here's the GitHub repository link for Auto-GPT: https://github.com/Significant-Gravitas/Auto-GPT

I hope this feature can be considered, and I'm looking forward to seeing the project grow. Thank you!

@momegas
Copy link
Owner

momegas commented Apr 17, 2023

Thank you for your kind words. I'll have a look 😁
A post in any community you take part in would help a lot the project grow.

@momegas momegas removed their assignment Apr 18, 2023
@momegas momegas added the bot This issue is about bot features label Apr 18, 2023
@Blubbaa
Copy link

Blubbaa commented Jul 11, 2023

I think this feature would be very helpful and could also greatly extend the number of potential users of this library.

I have already tested to switch the endpoints to Azure OpenAI, but it involved some "hacking" in the library code, beside setting the respective environment variables. If needed I can share exactly what I have changed to make it work, but in general I don't like the approach since it's quite hacky and the integration should be done more thoughtfully I think. As a summary it involved setting these environment variables:

os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_KEY"] = "661xxxxxxxxxxxxxxxxxxxxx80c8"
os.environ["OPENAI_API_BASE"] = "https://xxxxxxxxx.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = "2023-05-15"

And then adding the AzureChatOpenAI LLM from langchain in the select_model function, as well as setting the deployment arg for the OpenAIEmbeddings models.

@momegas, here is some more information on differences between OpenAI and Azure OpenAI enpoints: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/switching-endpoints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot This issue is about bot features enhancement New feature or request
Projects
Status: 👀 Todo
Development

No branches or pull requests

3 participants