-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix azure openai support and remove redundant semicolon #67
Conversation
return openai.AzureOpenAI(api_key=config["openai_api_key"]) | ||
return openai.AzureOpenAI( | ||
api_key=config["openai_api_key"], | ||
azure_deployment=os.environ.get("OPENAI_API_AZURE_ENGINE"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary. If you set the env variable OPENAI_API_MODEL
to the value of OPENAI_API_AZURE_ENGINE
, you get the same results as the code change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is introduced because the official openai-python
library requires initialization with deployment name for an azure client and such name doesn't seem to get picked up by chatblade
when initializing it. Although error handling might become tricky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why it's working for me on Azure without your change…hmm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out why. The model I thought I was selecting isn't being used. I've been using the default deployment without realizing it. I need your patch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that was possible, but glad you have figured it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes work well for me. I've confirmed the base_url is now computed properly with the OpenAI API.
Sorry, I intended to make two separate commits but removed their branches too soon.