The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: migrate phase 9 legacy llm provider tests to tests/unit
yunengad523edb254f
diff --git a/tests/test_litellm/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.py b/tests/unit/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.pyrename to tests/unit/llms/litellm_proxy/chat/test_litellm_proxy_chat_transformation.pydiff --git a/tests/test_litellm/llms/litellm_proxy/skills/test_code_execution.py b/tests/unit/llms/litellm_proxy/skills/test_code_execution.pysimilarity index 100%rename from tests/test_litellm/llms/litellm_proxy/skills/test_code_execution.pyrename to tests/unit/llms/litellm_proxy/skills/test_code_execution.pydiff --git a/tests/test_litellm/llms/litellm_proxy/skills/test_skill_search.py b/tests/unit/llms/litellm_proxy/skills/test_skill_search.pysimilarity index 100%rename from tests/test_litellm/llms/litellm_proxy/skills/test_skill_search.pyrename to tests/unit/llms/litellm_proxy/skills/test_skill_search.pydiff --git a/tests/test_litellm/llms/llamafile/chat/test_llamafile_chat_transformation.py b/tests/unit/llms/llamafile/chat/test_llamafile_chat_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/llamafile/chat/test_llamafile_chat_transformation.pyrename to tests/unit/llms/llamafile/chat/test_llamafile_chat_transformation.pydiff --git a/tests/unit/llms/manus/__init__.py b/tests/unit/llms/manus/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/unit/llms/manus/responses/__init__.py b/tests/unit/llms/manus/responses/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/manus/responses/test_manus_responses_transformation.py b/tests/unit/llms/manus/responses/test_manus_responses_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/manus/responses/test_manus_responses_transformation.pyrename to tests/unit/llms/manus/responses/test_manus_responses_transformation.pydiff --git a/tests/test_litellm/llms/meta/realtime/test_meta_realtime_transformation.py b/tests/unit/llms/meta/realtime/test_meta_realtime_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/meta/realtime/test_meta_realtime_transformation.pyrename to tests/unit/llms/meta/realtime/test_meta_realtime_transformation.pydiff --git a/tests/test_litellm/llms/meta_llama/test_meta_llama_chat_transformation.py b/tests/unit/llms/meta_llama/test_meta_llama_chat_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/meta_llama/test_meta_llama_chat_transformation.pyrename to tests/unit/llms/meta_llama/test_meta_llama_chat_transformation.pydiff --git a/tests/unit/llms/minimax/__init__.py b/tests/unit/llms/minimax/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/unit/llms/minimax/chat/__init__.py b/tests/unit/llms/minimax/chat/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/minimax/chat/test_transformation.py b/tests/unit/llms/minimax/chat/test_transformation.pysimilarity index 54%rename from tests/test_litellm/llms/minimax/chat/test_transformation.pyrename to tests/unit/llms/minimax/chat/test_transformation.pyindex 9d51b556500..2645b2832aa 100644--- a/tests/test_litellm/llms/minimax/chat/test_transformation.py+++ b/tests/unit/llms/minimax/chat/test_transformation.py@@ -2,14 +2,9 @@Test MiniMax OpenAI-compatible API support"""-import osfrom unittest.mock import MagicMock, patch-import pytest--import litellm-from litellm import completionfrom litellm.llms.minimax.chat.transformation import MinimaxChatConfig@@ -107,97 +102,6 @@ def test_minimax_provider_config_manager():assert isinstance(config, MinimaxChatConfig)[email protected](reason="Requires actual MiniMax API key")-def test_minimax_chat_completion_basic():- """Test basic chat completion with MiniMax OpenAI-compatible API"""- response = completion(- model="minimax/MiniMax-M2.1",- messages=[- {"role": "system", "content": "You are a helpful assistant."},- {"role": "user", "content": "Hello, how are you?"},- ],- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/v1",- )-- assert response is not None- assert hasattr(response, "choices")- assert len(response.choices) > 0--[email protected](reason="Requires actual MiniMax API key")-def test_minimax_chat_completion_with_reasoning_split():- """Test completion with reasoning_split parameter (MiniMax M2.1 feature)"""- response = completion(- model="minimax/MiniMax-M2.1",- messages=[- {"role": "system", "content": "You are a helpful assistant."},- {"role": "user", "content": "Solve this problem: 2+2=?"},- ],- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/v1",- extra_body={"reasoning_split": True},- )-- assert response is not None- # Check if reasoning_details is present in response- if hasattr(response.choices[0].message, "reasoning_details"):- assert response.choices[0].message.reasoning_details is not None--[email protected](reason="Requires actual MiniMax API key")-def test_minimax_chat_completion_with_tools():- """Test completion with tool calling (function calling)"""- tools = [- {- "type": "function",- "function": {- "name": "get_weather",- "description": "Get the current weather in a location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- }- },- "required": ["location"],- },- },- }- ]-- response = completion(- model="minimax/MiniMax-M2.1",- messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],- tools=tools,- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/v1",- )-- assert response is not None- assert hasattr(response, "choices")--[email protected](reason="Requires actual MiniMax API key")-def test_minimax_chat_completion_streaming():- """Test streaming completion"""- response = completion(- model="minimax/MiniMax-M2.1",- messages=[{"role": "user", "content": "Count to 5"}],- stream=True,- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/v1",- )-- chunks = []- for chunk in response:- chunks.append(chunk)-- assert len(chunks) > 0--if __name__ == "__main__":# Run basic tests that don't require API keyprint("Testing MiniMax Chat Config...")diff --git a/tests/unit/llms/minimax/messages/__init__.py b/tests/unit/llms/minimax/messages/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/minimax/messages/test_transformation.py b/tests/unit/llms/minimax/messages/test_transformation.pysimilarity index 57%rename from tests/test_litellm/llms/minimax/messages/test_transformation.pyrename to tests/unit/llms/minimax/messages/test_transformation.pyindex c7435a52890..a4b075414e3 100644--- a/tests/test_litellm/llms/minimax/messages/test_transformation.py+++ b/tests/unit/llms/minimax/messages/test_transformation.py@@ -2,14 +2,9 @@Test MiniMax Anthropic-compatible API support"""-import osfrom unittest.mock import MagicMock, patch-import pytest--import litellm-from litellm import completionfrom litellm.llms.minimax.messages.transformation import MinimaxMessagesConfig@@ -58,75 +53,6 @@ def test_minimax_provider_config_manager():assert config.custom_llm_provider == "minimax"[email protected](reason="Requires actual MiniMax API key")-def test_minimax_completion_basic():- """Test basic completion with MiniMax Anthropic-compatible API"""- response = completion(- model="minimax/MiniMax-M2.1",- messages=[{"role": "user", "content": "Hello, how are you?"}],- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/anthropic/v1/messages",- )-- assert response is not None- assert hasattr(response, "choices")- assert len(response.choices) > 0--[email protected](reason="Requires actual MiniMax API key")-def test_minimax_completion_with_thinking():- """Test completion with thinking parameter (MiniMax M2.1 feature)"""- response = completion(- model="minimax/MiniMax-M2.1",- messages=[{"role": "user", "content": "Solve this problem: 2+2=?"}],- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/anthropic/v1/messages",- thinking={"type": "enabled", "budget_tokens": 1000},- )-- assert response is not None- # Check if thinking content is present in response- for choice in response.choices:- if hasattr(choice.message, "content"):- # MiniMax returns thinking blocks similar to Anthropic- assert choice.message.content is not None--[email protected](reason="Requires actual MiniMax API key")-def test_minimax_completion_with_tools():- """Test completion with tool calling (function calling)"""- tools = [- {- "type": "function",- "function": {- "name": "get_weather",- "description": "Get the current weather in a location",- "parameters": {- "type": "object",- "properties": {- "location": {- "type": "string",- "description": "The city and state, e.g. San Francisco, CA",- }- },- "required": ["location"],- },- },- }- ]-- response = completion(- model="minimax/MiniMax-M2.1",- messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],- tools=tools,- api_key=os.getenv("MINIMAX_API_KEY"),- api_base="https://api.minimax.io/anthropic/v1/messages",- )-- assert response is not None- assert hasattr(response, "choices")--if __name__ == "__main__":# Run basic tests that don't require API keyprint("Testing MiniMax Anthropic Config...")diff --git a/tests/unit/llms/mistral/__init__.py b/tests/unit/llms/mistral/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.py b/tests/unit/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.pyrename to tests/unit/llms/mistral/audio_speech/test_mistral_audio_speech_transformation.pydiff --git a/tests/unit/llms/mistral/batches/__init__.py b/tests/unit/llms/mistral/batches/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/mistral/batches/test_mistral_batches_transformation.py b/tests/unit/llms/mistral/batches/test_mistral_batches_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/mistral/batches/test_mistral_batches_transformation.pyrename to tests/unit/llms/mistral/batches/test_mistral_batches_transformation.pydiff --git a/tests/unit/llms/mistral/files/__init__.py b/tests/unit/llms/mistral/files/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/mistral/files/test_mistral_files_transformation.py b/tests/unit/llms/mistral/files/test_mistral_files_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/mistral/files/test_mistral_files_transformation.pyrename to tests/unit/llms/mistral/files/test_mistral_files_transformation.pydiff --git a/tests/unit/llms/mistral/ocr/__init__.py b/tests/unit/llms/mistral/ocr/__init__.pynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py b/tests/unit/llms/mistral/ocr/test_mistral_ocr_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.pyrename to tests/unit/llms/mistral/ocr/test_mistral_ocr_transformation.pydiff --git a/tests/test_litellm/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.py b/tests/unit/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.pyrename to tests/unit/llms/modelscope/image_generation/test_modelscope_image_gen_transformation.pydiff --git a/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py b/tests/unit/llms/mongodb/vector_stores/test_mongodb_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.pyrename to tests/unit/llms/mongodb/vector_stores/test_mongodb_transformation.pydiff --git a/tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py b/tests/unit/llms/moonshot/test_moonshot_chat_transformation.pysimilarity index 96%rename from tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.pyrename to tests/unit/llms/moonshot/test_moonshot_chat_transformation.pyindex f94ea5e3db2..c39affc18a8 100644--- a/tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py+++ b/tests/unit/llms/moonshot/test_moonshot_chat_transformation.py@@ -19,31 +19,6 @@ from litellm.llms.moonshot.chat.transformation import MoonshotChatConfigclass TestMoonshotConfig:"""Test class for Moonshot AI functionality"""- def test_default_api_base(self):- """Test that default API base is used when none is provided"""- config = MoonshotChatConfig()- headers = {}- api_key = "fake-moonshot-key"-- # Call validate_environment without specifying api_base- result = config.validate_environment(- headers=headers,- model="moonshot-v1-8k",- messages=[{"role": "user", "content": "Hey"}],- optional_params={},- litellm_params={},- api_key=api_key,- api_base=None, # Not providing api_base- )-- # Verify headers are still set correctly- assert result["Authorization"] == f"Bearer {api_key}"- assert result["Content-Type"] == "application/json"-- # We can't directly test the api_base value here since validate_environment- # only returns the headers, but we can verify it doesn't raise an exception- # which would happen if api_base handling was incorrect-def test_get_supported_openai_params(self):"""Test that get_supported_openai_params returns correct params"""config = MoonshotChatConfig()diff --git a/tests/test_litellm/llms/neosantara/test_neosantara.py b/tests/unit/llms/neosantara/test_neosantara.pysimilarity index 100%rename from tests/test_litellm/llms/neosantara/test_neosantara.pyrename to tests/unit/llms/neosantara/test_neosantara.pydiff --git a/tests/test_litellm/llms/nimble/search/test_nimble_search_transformation.py b/tests/unit/llms/nimble/search/test_nimble_search_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/nimble/search/test_nimble_search_transformation.pyrename to tests/unit/llms/nimble/search/test_nimble_search_transformation.pydiff --git a/tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.py b/tests/unit/llms/novita/chat/test_novita_chat_transformation.pysimilarity index 85%rename from tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.pyrename to tests/unit/llms/novita/chat/test_novita_chat_transformation.pyindex 3f2a3f77c41..1381cf95a5d 100644--- a/tests/test_litellm/llms/novita/chat/test_novita_chat_transformation.py+++ b/tests/unit/llms/novita/chat/test_novita_chat_transformation.py@@ -54,12 +54,3 @@ class TestNovitaConfig:)assert "Missing Novita AI API Key" in str(excinfo.value)-- def test_inheritance(self):- """Test proper inheritance from OpenAIGPTConfig"""- config = NovitaConfig()-- from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig-- assert isinstance(config, OpenAIGPTConfig)- assert hasattr(config, "get_supported_openai_params")diff --git a/tests/test_litellm/llms/nscale/chat/test_nscale_chat_transformation.py b/tests/unit/llms/nscale/chat/test_nscale_chat_transformation.pysimilarity index 100%rename from tests/test_litellm/llms/nscale/chat/test_nscale_chat_transformation.pyrename to tests/unit/llms/nscale/chat/test_nscale_chat_transformation.py