-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Possible fix for issue #2218, allowing to disable setting the Authorization header #2219
Conversation
…ing the Authorization header. Signed-off-by: pbakker <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, merging. will follow up with a PR to use ApiKey for the other OpenAi APIs.
import org.springframework.ai.model.ChatModelDescription; | ||
import org.springframework.ai.model.ModelOptionsUtils; | ||
import org.springframework.ai.model.SimpleApiKey; | ||
import org.springframework.ai.model.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wildcard import isn't allowed and will fix when merging.
@paulbakker Thanks for the PR! |
PR to use ApiKey for other OpenAI APIs: #2226 |
Thanks for the super quick follow up @ilayaperumalg 🙏 |
@@ -200,7 +192,10 @@ public OpenAiApi(String baseUrl, ApiKey apiKey, MultiValueMap<String, String> he | |||
this.embeddingsPath = embeddingsPath; | |||
// @formatter:off | |||
Consumer<HttpHeaders> finalHeaders = h -> { | |||
h.setBearerAuth(apiKey.getValue()); | |||
if(!(apiKey instanceof NoopApiKey)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of checking for a specific impl, we should check for the return value, if it is empty then don't set header.
Allow disabling setting the Authorization header in OpenAi models.
Possible fix for #2218