forked from phoenix/litellm-mirror
Litellm dev 11 08 2024 (#6658)
* fix(deepseek/chat): convert content list to str Fixes https://github.com/BerriAI/litellm/issues/6642 * test(test_deepseek_completion.py): implement base llm unit tests increase robustness across providers * fix(router.py): support content policy violation fallbacks with default fallbacks * fix(opentelemetry.py): refactor to move otel imports behing flag Fixes https://github.com/BerriAI/litellm/issues/6636 * fix(opentelemtry.py): close span on success completion * fix(user_api_key_auth.py): allow user_role to default to none * fix: mark flaky test * fix(opentelemetry.py): move otelconfig.from_env to inside the init prevent otel errors raised just by importing the litellm class * fix(user_api_key_auth.py): fix auth error
This commit is contained in:
parent
1bef6457c7
commit
73531f4815
19 changed files with 287 additions and 34 deletions
|
@ -1120,9 +1120,10 @@ async def test_client_side_fallbacks_list(sync_mode):
|
|||
|
||||
@pytest.mark.parametrize("sync_mode", [True, False])
|
||||
@pytest.mark.parametrize("content_filter_response_exception", [True, False])
|
||||
@pytest.mark.parametrize("fallback_type", ["model-specific", "default"])
|
||||
@pytest.mark.asyncio
|
||||
async def test_router_content_policy_fallbacks(
|
||||
sync_mode, content_filter_response_exception
|
||||
sync_mode, content_filter_response_exception, fallback_type
|
||||
):
|
||||
os.environ["LITELLM_LOG"] = "DEBUG"
|
||||
|
||||
|
@ -1152,6 +1153,14 @@ async def test_router_content_policy_fallbacks(
|
|||
"mock_response": "This works!",
|
||||
},
|
||||
},
|
||||
{
|
||||
"model_name": "my-default-fallback-model",
|
||||
"litellm_params": {
|
||||
"model": "openai/my-fake-model",
|
||||
"api_key": "",
|
||||
"mock_response": "This works 2!",
|
||||
},
|
||||
},
|
||||
{
|
||||
"model_name": "my-general-model",
|
||||
"litellm_params": {
|
||||
|
@ -1169,9 +1178,14 @@ async def test_router_content_policy_fallbacks(
|
|||
},
|
||||
},
|
||||
],
|
||||
content_policy_fallbacks=[{"claude-2": ["my-fallback-model"]}],
|
||||
fallbacks=[{"claude-2": ["my-general-model"]}],
|
||||
context_window_fallbacks=[{"claude-2": ["my-context-window-model"]}],
|
||||
content_policy_fallbacks=(
|
||||
[{"claude-2": ["my-fallback-model"]}]
|
||||
if fallback_type == "model-specific"
|
||||
else None
|
||||
),
|
||||
default_fallbacks=(
|
||||
["my-default-fallback-model"] if fallback_type == "default" else None
|
||||
),
|
||||
)
|
||||
|
||||
if sync_mode is True:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue