emacs-openai / openai

Elisp library for the OpenAI API
GNU General Public License v3.0
100 stars 17 forks source link

feat: Allow openai-key to be retrieved via a function #10

Closed sw1nn closed 1 year ago

sw1nn commented 1 year ago

Enhance the handling of the openai-key variable. If it is a string it will be interpreted as the raw key. If it is a function then that function will be called to retrieve the key. This allows storing the key in some secure store (e.g. auth-source)

sw1nn commented 1 year ago

baba8fc moves the headers construction around, but the change is getting bigger now than I envisioned at first. It somewhat cleans up all the calls to openai-request but possibly some clarity is lost.

sw1nn commented 1 year ago

Change has become bigger than I thought - I'll keep chipping away in my local repo, but probably not worth a PR until the major restructuring discussed in #5 is fleshed out. Closing.

jcs090218 commented 1 year ago

Sorry for not being able to merge this feature request! I will make sure to add this feature once we've done restructuring the code base! 😓

jcs090218 commented 1 year ago

I've used some of your code, and the feature is integrated in #13. Hope you like it! :D