fix(pattern_match_deployments.py): default to user input if unable to map based on wildcards (#6646)

This commit is contained in:
Krish Dholakia 2024-11-07 23:57:37 +05:30 committed by GitHub
parent 9cb02513b4
commit 44840d615d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 6 deletions

View file

@ -182,6 +182,14 @@ async def test_route_with_no_matching_pattern():
)
assert result.choices[0].message.content == "Works"
## WORKS
result = await router.acompletion(
model="meta.llama3-70b-instruct-v1:0",
messages=[{"role": "user", "content": "Hello, world!"}],
mock_response="Works",
)
assert result.choices[0].message.content == "Works"
## FAILS
with pytest.raises(litellm.BadRequestError) as e:
await router.acompletion(
@ -198,6 +206,7 @@ async def test_route_with_no_matching_pattern():
input="Hello, world!",
)
def test_router_pattern_match_e2e():
"""
Tests the end to end flow of the router
@ -228,4 +237,3 @@ def test_router_pattern_match_e2e():
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello, how are you?"}],
}