mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
(feat) support extra_headers
This commit is contained in:
parent
e049858266
commit
3c8b58bd80
3 changed files with 23 additions and 0 deletions
|
@ -3907,6 +3907,7 @@ def get_optional_params(
|
|||
max_retries=None,
|
||||
logprobs=None,
|
||||
top_logprobs=None,
|
||||
extra_headers=None,
|
||||
**kwargs,
|
||||
):
|
||||
# retrieve all parameters passed to the function
|
||||
|
@ -3946,6 +3947,7 @@ def get_optional_params(
|
|||
"max_retries": None,
|
||||
"logprobs": None,
|
||||
"top_logprobs": None,
|
||||
"extra_headers": None,
|
||||
}
|
||||
# filter out those parameters that were passed with non-default values
|
||||
non_default_params = {
|
||||
|
@ -4753,6 +4755,7 @@ def get_optional_params(
|
|||
"max_retries",
|
||||
"logprobs",
|
||||
"top_logprobs",
|
||||
"extra_headers",
|
||||
]
|
||||
_check_valid_arg(supported_params=supported_params)
|
||||
if functions is not None:
|
||||
|
@ -4793,6 +4796,8 @@ def get_optional_params(
|
|||
optional_params["logprobs"] = logprobs
|
||||
if top_logprobs is not None:
|
||||
optional_params["top_logprobs"] = top_logprobs
|
||||
if extra_headers is not None:
|
||||
optional_params["extra_headers"] = extra_headers
|
||||
if custom_llm_provider in ["openai", "azure"] + litellm.openai_compatible_providers:
|
||||
# for openai, azure we should pass the extra/passed params within `extra_body` https://github.com/openai/openai-python/blob/ac33853ba10d13ac149b1fa3ca6dba7d613065c9/src/openai/resources/models.py#L46
|
||||
extra_body = passed_params.pop("extra_body", {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue