diff --git a/tests/llm_translation/test_xai.py b/tests/llm_translation/test_xai.py index ba360d71788..727a76b16c9 100644 --- a/tests/llm_translation/test_xai.py +++ b/tests/llm_translation/test_xai.py @@ -111,6 +111,7 @@ def test_xai_chat_config_map_openai_params(): # Assert unsupported parameter is not in the result assert "unsupported_param" not in result + def test_xai_check_for_stop_in_supported_params(): supported_params = XAIChatConfig().get_supported_openai_params( model="xai/grok-3-mini" @@ -125,14 +126,10 @@ def test_xai_grok_4_stop_not_supported(model): Issue: https://github.com/BerriAI/litellm/issues/12635 """ - supported_params = XAIChatConfig().get_supported_openai_params( - model=model - ) + supported_params = XAIChatConfig().get_supported_openai_params(model=model) assert "stop" not in supported_params - - @pytest.mark.parametrize("stream", [False, True]) def test_completion_xai(stream): try: @@ -144,11 +141,7 @@ def test_completion_xai(stream): "content": "Hey", }, ] - response = completion( - model="xai/grok-4", - messages=messages, - stream=stream - ) + response = completion(model="xai/grok-4", messages=messages, stream=stream) print(response) if stream is True: @@ -162,6 +155,8 @@ def test_completion_xai(stream): assert response is not None assert isinstance(response, litellm.ModelResponse) assert response.choices[0].message.content is not None + except litellm.ServiceUnavailableError as e: + pytest.fail(f"Timeout occurred: {e}") except Exception as e: pytest.fail(f"Error occurred: {e}") @@ -171,7 +166,7 @@ def test_xai_message_name_filtering(): { "role": "system", "content": "*I press the green button*", - "name": "example_user" + "name": "example_user", }, {"role": "user", "content": "Hello", "name": "John"}, {"role": "assistant", "content": "Hello", "name": "Jane"}, @@ -190,12 +185,14 @@ class TestXAIReasoningEffort(BaseReasoningLLMTests): "model": "xai/grok-3-mini-beta", "messages": [{"role": "user", "content": "Hello"}], } - + + class TestXAIChat(BaseLLMChatTest): def get_base_completion_call_args(self): return { "model": "xai/grok-3-mini-beta", } + def test_tool_call_no_arguments(self, tool_call_no_arguments): """Test that tool calls with no arguments is translated correctly. Relevant issue: https://github.com/BerriAI/litellm/issues/6833""" pass