forked from phoenix/litellm-mirror
fix(utils.py): allow dropping extra_body in additional_drop_params
Fixes https://github.com/BerriAI/litellm/issues/4769
This commit is contained in:
parent
00d431ea42
commit
f10af7596c
2 changed files with 21 additions and 16 deletions
|
@ -1,9 +1,5 @@
|
||||||
model_list:
|
model_list:
|
||||||
- model_name: azure-mistral
|
- model_name: groq-llama3
|
||||||
litellm_params:
|
litellm_params:
|
||||||
model: azure_ai/mistral
|
model: groq/llama3-groq-70b-8192-tool-use-preview
|
||||||
api_key: os.environ/AZURE_AI_MISTRAL_API_KEY
|
api_key: os.environ/GROQ_API_KEY
|
||||||
api_base: os.environ/AZURE_AI_MISTRAL_API_BASE
|
|
||||||
|
|
||||||
litellm_settings:
|
|
||||||
drop_params: true
|
|
||||||
|
|
|
@ -3667,16 +3667,25 @@ def get_optional_params(
|
||||||
+ litellm.openai_compatible_providers
|
+ 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
|
# 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", {})
|
if (
|
||||||
for k in passed_params.keys():
|
_should_drop_param(
|
||||||
if k not in default_params.keys():
|
k="extra_body", additional_drop_params=additional_drop_params
|
||||||
extra_body[k] = passed_params[k]
|
)
|
||||||
optional_params.setdefault("extra_body", {})
|
is False
|
||||||
optional_params["extra_body"] = {**optional_params["extra_body"], **extra_body}
|
):
|
||||||
|
extra_body = passed_params.pop("extra_body", {})
|
||||||
|
for k in passed_params.keys():
|
||||||
|
if k not in default_params.keys():
|
||||||
|
extra_body[k] = passed_params[k]
|
||||||
|
optional_params.setdefault("extra_body", {})
|
||||||
|
optional_params["extra_body"] = {
|
||||||
|
**optional_params["extra_body"],
|
||||||
|
**extra_body,
|
||||||
|
}
|
||||||
|
|
||||||
optional_params["extra_body"] = _ensure_extra_body_is_safe(
|
optional_params["extra_body"] = _ensure_extra_body_is_safe(
|
||||||
extra_body=optional_params["extra_body"]
|
extra_body=optional_params["extra_body"]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# if user passed in non-default kwargs for specific providers/models, pass them along
|
# if user passed in non-default kwargs for specific providers/models, pass them along
|
||||||
for k in passed_params.keys():
|
for k in passed_params.keys():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue