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

@ -1494,3 +1494,26 @@ def test_get_num_retries(num_retries):
"num_retries": num_retries,
},
)
@pytest.mark.parametrize("filter_invalid_headers", [True, False])
@pytest.mark.parametrize(
"custom_llm_provider, expected_result",
[("anthropic", {"anthropic-beta": "123"}), ("bedrock", {}), ("vertex_ai", {})],
)
def test_get_clean_extra_headers(
filter_invalid_headers, custom_llm_provider, expected_result, monkeypatch
):
from litellm.utils import get_clean_extra_headers
monkeypatch.setattr(litellm, "filter_invalid_headers", filter_invalid_headers)
if filter_invalid_headers:
assert (
get_clean_extra_headers({"anthropic-beta": "123"}, custom_llm_provider)
== expected_result
)
else:
assert get_clean_extra_headers(
{"anthropic-beta": "123"}, custom_llm_provider
) == {"anthropic-beta": "123"}