Litellm dev 01 21 2025 p1 (#7898)

* fix(utils.py): don't pass 'anthropic-beta' header to vertex - will cause request to fail

* fix(utils.py): add flag to allow user to disable filtering invalid headers

ensure user can control behaviour

* style(utils.py): cleanup message

* test(test_utils.py): add unit test to cover invalid header filtering

* fix(proxy_server.py): fix custom openapi schema generation

* fix(utils.py): pass extra headers if set

* fix(main.py): fix image variation to use 'client' param
This commit is contained in:
Krish Dholakia 2025-01-21 20:36:11 -08:00 committed by GitHub
parent b73980ecd5
commit dec558ba4c
9 changed files with 161 additions and 21 deletions

View file

@ -844,9 +844,6 @@ def completion( # type: ignore # noqa: PLR0915
)
if headers is None:
headers = {}
if extra_headers is not None:
headers.update(extra_headers)
num_retries = kwargs.get(
"num_retries", None
) ## alt. param for 'max_retries'. Use this to pass retries w/ instructor.
@ -1042,9 +1039,14 @@ def completion( # type: ignore # noqa: PLR0915
api_version=api_version,
parallel_tool_calls=parallel_tool_calls,
messages=messages,
extra_headers=extra_headers,
**non_default_params,
)
extra_headers = optional_params.pop("extra_headers", None)
if extra_headers is not None:
headers.update(extra_headers)
if litellm.add_function_to_prompt and optional_params.get(
"functions_unsupported_model", None
): # if user opts to add it to prompt, when API doesn't support function calling
@ -4670,7 +4672,7 @@ def image_variation(
**kwargs,
) -> ImageResponse:
# get non-default params
client = kwargs.get("client", None)
# get logging object
litellm_logging_obj = cast(LiteLLMLoggingObj, kwargs.get("litellm_logging_obj"))
@ -4744,6 +4746,7 @@ def image_variation(
logging_obj=litellm_logging_obj,
optional_params={},
litellm_params=litellm_params,
client=client,
)
# return the response