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

Add support for custom OpenAI URL #277

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

abbra
Copy link

@abbra abbra commented Mar 13, 2024

Allows to run local OpenAI-compatible server. Since these local instances most likely lack proper certificates, allow using non-HTTPS endpoints as well.

@toropanov
Copy link

It's quite strange how variables carry varying connotations.

config.openai_url
config.OPENAI_KEY

And etc.

Why not to keep everything in uppercase?

Allows to run local OpenAI-compatible server. Since these local
instances most likely lack proper certificates, allow using non-HTTPS
endpoints as well.

Signed-off-by: Alexander Bokovoy <[email protected]>
@abbra abbra force-pushed the custom-openai-intance branch from f03fc3c to b6ded16 Compare March 13, 2024 12:16
@abbra
Copy link
Author

abbra commented Mar 13, 2024

@toropanov thanks, I updated to use uppercase version for both.

@@ -27,7 +27,7 @@ const configParsers = {
'Please set your OpenAI API key via `aicommits config set OPENAI_KEY=<your token>`'
);
}
parseAssert('OPENAI_KEY', key.startsWith('sk-'), 'Must start with "sk-"');
parseAssert('OPENAI_KEY', /^((sk-|no_api_key){1}[a-zA-Z0-9]*)$/.test(key), 'Must start with "sk-" or "no_api_key"');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we completely remove this check? My OpenAI instance requires an API key which doesn't start by sk-, but still requires an API key.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove it in a separate commit.

The API key format is specific to a particular implementation and
deployment of OPENAI API. There is no way to do common checks for it, so
better to remove it at all and add some general note to the
documentation instead.

Signed-off-by: Alexander Bokovoy <[email protected]>
@tak-bro
Copy link

tak-bro commented Mar 21, 2024

I've created a new project with your options based on aicommits. If you're interested, please check it out.
https://github.com/tak-bro/aicommit2

@ATQQ
Copy link

ATQQ commented Mar 30, 2024

👍🏻 I also plan to do this, it is very useful.

@mrdjohnson
Copy link

Anything blocking this PR? I'd like to attach aicommits to LM Studio so I can keep everything local to my machine 🤞

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.

6 participants