mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 02:45:18 +00:00
Update litellm_ai_handler.py
line 253-258, pass extra_headers fields from settings to litellm, exception handling to check if extra_headers is in dict format
This commit is contained in:
parent
0e4a1d9ab8
commit
71451de156
1 changed files with 5 additions and 4 deletions
|
|
@ -251,6 +251,7 @@ class LiteLLMAIHandler(BaseAiHandler):
|
||||||
get_logger().info(f"\nUser prompt:\n{user}")
|
get_logger().info(f"\nUser prompt:\n{user}")
|
||||||
|
|
||||||
#Added support for extra_headers while using litellm to call underlying model, via a api management gateway, would allow for passing custom headers for security and authorization
|
#Added support for extra_headers while using litellm to call underlying model, via a api management gateway, would allow for passing custom headers for security and authorization
|
||||||
|
if get_settings().get("LITELLM.EXTRA_HEADERS", None):
|
||||||
litellm_extra_headers = json.loads(get_settings().litellm.extra_headers)
|
litellm_extra_headers = json.loads(get_settings().litellm.extra_headers)
|
||||||
if not isinstance(litellm_extra_headers, dict):
|
if not isinstance(litellm_extra_headers, dict):
|
||||||
raise ValueError("LITELLM.EXTRA_HEADERS must be a JSON object")
|
raise ValueError("LITELLM.EXTRA_HEADERS must be a JSON object")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue