Skip to content

Commit

Permalink
test(base_llm_unit_tests.py): add 'response_format={"type": "text"}' …
Browse files Browse the repository at this point in the history
…test to base_llm_unit_tests

adds complete coverage for all 'response_format' values to ci/cd
  • Loading branch information
krrishdholakia committed Nov 26, 2024
1 parent 69955d4 commit 3f48aaa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/llm_translation/base_llm_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ def test_message_with_name(self):
response = litellm.completion(**base_completion_call_args, messages=messages)
assert response is not None

def test_json_response_format(self):
@pytest.mark.parametrize(
"response_format",
[
{"type": "json_object"},
{"type": "text"},
],
)
def test_json_response_format(self, response_format):
"""
Test that the JSON response format is supported by the LLM API
"""
Expand All @@ -83,7 +90,7 @@ def test_json_response_format(self):
response = litellm.completion(
**base_completion_call_args,
messages=messages,
response_format={"type": "json_object"},
response_format=response_format,
)

print(response)
Expand Down

0 comments on commit 3f48aaa

Please sign in to comment.