-
Notifications
You must be signed in to change notification settings - Fork 335
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
✨ feat(api.ts): add support for Azure OpenAI API #167
base: dev
Are you sure you want to change the base?
Conversation
The Azure OpenAI API is now supported in addition to the OpenAI API. The API type can be specified in the configuration file using the OPENAI_API_TYPE key. If the key is not specified, the default value is 'openai'. The AzureOpenAIApi class is added to the utils folder to handle the Azure OpenAI API calls. The createChatCompletion method is implemented in the AzureOpenAIApi class to handle the chat completion requests. The method is called in the generateCommitMessage method in the OpenAi class if the apiType is set to 'azure'.
…d conflicts with openai's axios dependency In AzureOpenAI.ts, the import path for AxiosRequestConfig was changed to avoid conflicts with openai's axios dependency, which was causing lint errors.
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.
thanks for that! some minor comments added
… remove commented out debug code The RequiredError class was not being imported from the openai/dist/base module, causing errors to be thrown incorrectly. This has been fixed by importing the RequiredError class. Debug code has been removed and comments have been updated to reflect the changes made.
…apanese comment The commented console.log statement was removed to improve code cleanliness.
I found a simpler way utilizing the OpenAI npm package. Also, I forgot to patch the length of the API_KEY. |
🐛 fix(config.ts): API Key string validation
Refactoring has been completed, resulting in a simpler implementation. |
@di-sukharev Will this be merged into the master branch soon? I would like to use OpenCommit with Azure OpenAI |
Stale pull request message |
@takuya-o hey 👋 sorry for being so late, could you please fix the conflicts and I will merge it :) |
Stale pull request message |
"api-key": apiKey, | ||
}, | ||
params: { | ||
'api-version': '2023-03-15-preview', |
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 needs to be configurable, depending on the specifics of the deployment. Another valid value is '2023-07-01-preview' and new ones will be added as time goes on.
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.
agree, @takuya-o please take a look
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.
can we make this a configurable variable param?
please solve conflicts @takuya-o <3 |
@SamOyeAH any chance you could fork this project and add your Azure OpenAI support please ? |
cant wait to integrate once it is released. thank you. |
@takuya-o hi again, please resolve the conflict and i will merge this |
@takuya-o hello, please follow up, let's merge it when comments are addressed and conflicts are solved ❤️ |
there was a refactoring to AzureAiEngine done, please refer to this PR for details there was a refactoring #391, your changes should follow the same implementation |
The Azure OpenAI API is now supported in addition to the OpenAI API.
The API type can be specified in the configuration file using the OPENAI_API_TYPE key. If the key is not specified, the default value is 'openai'. The AzureOpenAIApi class is added to the utils folder to handle the Azure OpenAI API calls. The createChatCompletion method is implemented in the AzureOpenAIApi class to handle the chat completion requests. The method is called in the generateCommitMessage method in the OpenAi class if the apiType is set to 'azure'.
Related: #150 comment