-
Notifications
You must be signed in to change notification settings - Fork 711
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
Fix/support litellm extra headers #1564
base: main
Are you sure you want to change the base?
Fix/support litellm extra headers #1564
Conversation
…eption handling to check if extra_headers is in dict format
line 253-258, pass extra_headers fields from settings to litellm, exception handling to check if extra_headers is in dict format
…eption handling to check if extra_headers is in dict format
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
Description
With reference to issue - #1557
This pull request modifies the
litellm_ai_handler.py
script to allow passingextra_headers
when making requests through LiteLLM. This is particularly useful when using an API management gateway that requires specific headers for security and authorization.Changes:
Modified:
pr_agent/algo/ai_handlers/litellm_ai_handler.py
Lines 253-261:
Purpose:
This change introduces the ability to pass
extra_headers
in pr-agent config for LiteLLM AI Client via theLITELLM.EXTRA_HEADERS
setting. The value of this setting should be a JSON string representing the desired headers.This enables users to pass custom headers, such as authorization tokens or API keys, when routing requests through an API management gateway.
PR Type
Enhancement, Bug fix
Description
Added support for
extra_headers
in LiteLLM requests.Validated
LITELLM.EXTRA_HEADERS
as a JSON object.Introduced error handling for invalid
extra_headers
configuration.Enabled passing custom headers for security and authorization.
Changes walkthrough 📝
litellm_ai_handler.py
Support and validate extra headers for LiteLLM
pr_agent/algo/ai_handlers/litellm_ai_handler.py
LITELLM.EXTRA_HEADERS
from settings.extra_headers
as a JSON object.kwargs["extra_headers"]
.