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

OpenAI organization keys #54

Open
cpfiffer opened this issue Jan 19, 2024 · 2 comments
Open

OpenAI organization keys #54

cpfiffer opened this issue Jan 19, 2024 · 2 comments

Comments

@cpfiffer
Copy link
Collaborator

I have a personal & private account with OpenAI, and I would like to set an organization key when requesting usage from OpenAI. See the docs for more.

Looks like I just need to add a header to the llm_openai.jl code. Here's the curl stuff from OpenAI:

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Organization: org-Q557wG3tc1TZvSp4D3AWAamJ"

Should this be addressed in this library or upstream in OpenAI.jl? Either way I suspect it's a pretty easy task (I can do it) but would love some input.

@svilupp
Copy link
Owner

svilupp commented Jan 19, 2024

I think this is OpenAI specific, so it would be better to upstream to OpenAI.jl for others.

All API provider kwargs (‘api_kwargs=(; a=1…)’) from ai* functions are passed directly, so it should just work.

@svilupp
Copy link
Owner

svilupp commented Jan 19, 2024

After considering, I think it might be best to adapt the Providers in OpenAI.jl (eg, OpenAIProvider) to have the optional org key and then customize OpenAI.auth_header to add it to your HTTP header if available.

Then on the PT side, I'll probably need to allow the api_key kwarg to be not only a string but also an OpenAI.Provider object.

That's the "easiest" way I can think of, because api_kwargs actually just send parameters directly to the model. They don't tend to change the headers etc.

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

No branches or pull requests

2 participants