Resolve OpenAI ApiKey for every request#3364
Resolve OpenAI ApiKey for every request#3364filiphr wants to merge 1 commit intospring-projects:mainfrom
Conversation
Signed-off-by: Filip Hrisafov <filip.hrisafov@gmail.com>
|
This is a super important fix! We had some internal users at vmware that were supposed to have an implementation with rotating keys ,but that never materialized in time. Sorry for the oversight and we will get this bug fixed asap. |
|
Also, back-ported the changes into 1.0.x via be79b89 |
|
Thanks a lot @ilayaperumalg |
|
@filiphr Sorry, I had to revert the changes as the support for setting the http header via OpenAI chat option is broken with this change. While your PR introduced the right approach to set the API keys for the client requests, we need to investigate and decide how to proceed to support the issue of supporting case which can be replicated via |
|
Thanks for letting me know @ilayaperumalg. Thanks for letting me know @ilayaperumalg. Those IT tests are a bit tricky to run without an API Key. In any case. I have provided #3398, which should solve that problem as well. |
I am working on adding some dynamic support for using the
OpenAiApifrom Spring AI. Reading theApiKeyjavadoc, it looks like a great fit for us, since we want to support dynamic resolving of it.However, I realized that it's value is not resolved on every request, but only once in the constructor when the headers are set.
While adding this to the
OpenAiApiI realized that the rest of the Open AI API classes were also not resolving it so I added it there as well.I did apply the spring format, but I am not sure that the imports are correct. Please let me know if I need to adjust something