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

✨ feat(api.ts): add support for Azure OpenAI API #167

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

takuya-o
Copy link
Contributor

@takuya-o takuya-o commented May 6, 2023

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

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.
Copy link
Owner

@di-sukharev di-sukharev left a 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

src/utils/AzureOpenAI.ts Outdated Show resolved Hide resolved
src/utils/AzureOpenAI.ts Outdated Show resolved Hide resolved
… 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.
@takuya-o takuya-o requested a review from di-sukharev May 7, 2023 12:10
@takuya-o
Copy link
Contributor Author

takuya-o commented May 9, 2023

I found a simpler way utilizing the OpenAI npm package. Also, I forgot to patch the length of the API_KEY.
Please wait next commit.

@takuya-o takuya-o changed the title ✨ feat(api.ts): add support for Azure OpenAI API [WIP]✨ feat(api.ts): add support for Azure OpenAI API May 9, 2023
🐛 fix(config.ts): API Key string validation
@takuya-o takuya-o changed the title [WIP]✨ feat(api.ts): add support for Azure OpenAI API ✨ feat(api.ts): add support for Azure OpenAI API May 9, 2023
@takuya-o
Copy link
Contributor Author

takuya-o commented May 9, 2023

Refactoring has been completed, resulting in a simpler implementation.
@di-sukharev I would appreciate it if you could review the code again.

@SamOyeAH
Copy link

@di-sukharev Will this be merged into the master branch soon? I would like to use OpenCommit with Azure OpenAI

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Stale pull request message

@di-sukharev
Copy link
Owner

@takuya-o hey 👋 sorry for being so late, could you please fix the conflicts and I will merge it :)

@github-actions
Copy link

Stale pull request message

"api-key": apiKey,
},
params: {
'api-version': '2023-03-15-preview',

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.

@di-sukharev
Copy link
Owner

please solve conflicts @takuya-o <3
then build it npm run build and test build locally npm run start -- config set ....

@JayDoubleu
Copy link

@SamOyeAH any chance you could fork this project and add your Azure OpenAI support please ?

@YunchuWang
Copy link

YunchuWang commented Mar 15, 2024

cant wait to integrate once it is released. thank you.

@di-sukharev
Copy link
Owner

@takuya-o hi again, please resolve the conflict and i will merge this

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

Successfully merging this pull request may close these issues.

None yet

6 participants