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: add custom openai api endpoint #40

Merged
merged 3 commits into from
Apr 12, 2023

Conversation

kingzez
Copy link

@kingzez kingzez commented Apr 12, 2023

If you can't access the OpenAI API directly (due to firewall or other issues), you can use it.

And you can custom OpenAI API endpoint to set OPENAI_API_ENDPOINT (default: https://api.openai.com/v1)

ai-shell config set OPENAI_API_ENDPOINT=<your proxy endpoint>

@steve8708
Copy link
Contributor

This is great! Can you add it to the new config UI as well? https://github.com/BuilderIO/ai-shell/blob/main/src/helpers/config.ts#L105-L134

@steve8708
Copy link
Contributor

looks great! we've just got a merge conflict now, then ready to merge

@kingzez
Copy link
Author

kingzez commented Apr 12, 2023

done ~

@steve8708 steve8708 merged commit 67e115e into BuilderIO:main Apr 12, 2023
@steve8708
Copy link
Contributor

thanks for this great contribution @kingzez! will release shortyly

@lzhgus
Copy link
Contributor

lzhgus commented Apr 12, 2023

Hi @steve8708,

With Azure OpenAI endpoint, I got this error '✖ Invalid config property OPENAI_KEY: Must start with "sk-"', probably you need to change the logic here . Can you please take a look at it? Thanks!

@steve8708
Copy link
Contributor

oh, they handle different keys too, I'll go back and reopen your issue, as it sounds like the scope of this is larger than first thought

I would had to remove the validation of openai keys, I gues an alternative is if you use azure (e.g. detecting an azure url configured) we add different logic for validating keys (or remove the validation)

interested in sending a PR @lzhgus?

lzhgus added a commit to lzhgus/ai-shell that referenced this pull request Apr 27, 2023
…ENAI_KEY to start with 'sk-.'

If the proxy endpoint is Azure, the openai_key should not start with 'sk'.
@lzhgus
Copy link
Contributor

lzhgus commented Apr 27, 2023

@steve8708 , I raised the PR to remove the restriction that require OPENAI_KEY to start with 'SK'. This is because we cannot determine whether the proxy endpoint is for Azure or OpenAI without introducing another configuration setting such as "USEAZURE: boolean". Therefore, I believe it would be better to remove the validation of openai keys. Please review. Thanks!

steve8708 added a commit that referenced this pull request Apr 27, 2023
#37 #40 Remove the restriction that requires the Key to start with 'sk-.'
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.

3 participants