fix(o_series_transformation.py): fix optional param check for o-serie… (#8787)

* fix(o_series_transformation.py): fix optional param check for o-series models

o3-mini and o-1 do not support parallel tool calling

* fix(utils.py): support 'drop_params' for 'thinking' param across models

allows switching to older claude versions (or non-anthropic models) and param to be safely dropped

* fix: fix passing thinking param in optional params

allows dropping thinking_param where not applicable

* test: update old model

* fix(utils.py): fix linting errors

* fix(main.py): add param to acompletion
This commit is contained in:
Krish Dholakia 2025-02-26 12:26:55 -08:00 committed by GitHub
parent aabb5c0df4
commit 017c482d7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 87 additions and 31 deletions

View file

@ -1069,7 +1069,6 @@ def test_gemini_frequency_penalty():
assert optional_params["frequency_penalty"] == 0.5
def test_azure_prediction_param():
optional_params = get_optional_params(
model="chatgpt-v2",
@ -1084,6 +1083,7 @@ def test_azure_prediction_param():
"content": "LiteLLM is a very useful way to connect to a variety of LLMs.",
}
def test_vertex_ai_ft_llama():
optional_params = get_optional_params(
model="1984786713414729728",
@ -1093,3 +1093,24 @@ def test_vertex_ai_ft_llama():
)
assert optional_params["frequency_penalty"] == 0.5
assert "max_retries" not in optional_params
@pytest.mark.parametrize(
"model, expected_thinking",
[
("claude-3-5-sonnet", False),
("claude-3-7-sonnet", True),
("gpt-3.5-turbo", False),
],
)
def test_anthropic_thinking_param(model, expected_thinking):
optional_params = get_optional_params(
model=model,
custom_llm_provider="anthropic",
thinking={"type": "enabled", "budget_tokens": 1024},
drop_params=True,
)
if expected_thinking:
assert "thinking" in optional_params
else:
assert "thinking" not in optional_params