mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-26 06:03:19 +00:00
Merge 7f9f92434d into 8b9cd12a89
This commit is contained in:
commit
c2ede42307
2 changed files with 15 additions and 0 deletions
|
|
@ -86,4 +86,6 @@ class AiohttpOpenAIChatConfig(OpenAILikeChatConfig):
|
|||
model_response.model = _json_response.get("model")
|
||||
model_response.object = _json_response.get("object")
|
||||
model_response.system_fingerprint = _json_response.get("system_fingerprint")
|
||||
if "service_tier" in _json_response:
|
||||
model_response.service_tier = _json_response.get("service_tier")
|
||||
return model_response
|
||||
|
|
|
|||
|
|
@ -99,3 +99,16 @@ async def test_transform_response_rejects_choices_that_are_not_a_list_of_objects
|
|||
async def test_transform_response_rejects_a_choice_whose_message_is_not_an_object():
|
||||
with pytest.raises(ValidationError, match="validation error for Choices"):
|
||||
await _transform({"choices": [{"message": "text"}]})
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tier", ["flex", "priority", "default"])
|
||||
async def test_transform_response_forwards_service_tier(tier: str):
|
||||
response = await _transform({"id": "chatcmpl-1", "choices": [{}], "service_tier": tier})
|
||||
|
||||
assert response.service_tier == tier
|
||||
|
||||
|
||||
async def test_transform_response_service_tier_is_none_when_omitted():
|
||||
response = await _transform({"id": "chatcmpl-1", "choices": [{}]})
|
||||
|
||||
assert getattr(response, "service_tier", None) is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue