diff --git a/litellm/llms/openai.py b/litellm/llms/openai.py index 1a1dc4e6dd2..81bbf3cab17 100644 --- a/litellm/llms/openai.py +++ b/litellm/llms/openai.py @@ -349,7 +349,6 @@ class OpenAIConfig: "top_p", "tools", "tool_choice", - "user", "function_call", "functions", "max_retries", @@ -362,6 +361,12 @@ class OpenAIConfig: ): # gpt-4 does not support 'response_format' model_specific_params.append("response_format") + if ( + model in litellm.open_ai_chat_completion_models + ) or model in litellm.open_ai_text_completion_models: + model_specific_params.append( + "user" + ) # user is not a param supported by all openai-compatible endpoints - e.g. azure ai return base_params + model_specific_params def map_openai_params( diff --git a/litellm/proxy/_super_secret_config.yaml b/litellm/proxy/_super_secret_config.yaml index f0a7ba82724..95cf05e7101 100644 --- a/litellm/proxy/_super_secret_config.yaml +++ b/litellm/proxy/_super_secret_config.yaml @@ -52,5 +52,10 @@ model_list: api_version: '2023-05-15' model: azure/chatgpt-v-2 model_name: gpt-3.5-turbo +- model_name: mistral + litellm_params: + model: azure/mistral-large-latest + api_base: https://Mistral-large-nmefg-serverless.eastus2.inference.ai.azure.com/v1/ + api_key: zEJhgmw1FAKk0XzPWoLEg7WU1cXbWYYn router_settings: enable_pre_call_checks: true diff --git a/litellm/tests/test_optional_params.py b/litellm/tests/test_optional_params.py index 31ee3d99b6c..2ce9228fb8a 100644 --- a/litellm/tests/test_optional_params.py +++ b/litellm/tests/test_optional_params.py @@ -97,6 +97,18 @@ def test_databricks_optional_params(): assert "user" not in optional_params +def test_azure_ai_mistral_optional_params(): + litellm.drop_params = True + optional_params = get_optional_params( + model="mistral-large-latest", + user="John", + custom_llm_provider="openai", + max_tokens=10, + temperature=0.2, + ) + assert "user" not in optional_params + + def test_azure_gpt_optional_params_gpt_vision(): # for OpenAI, Azure all extra params need to get passed as extra_body to OpenAI python. We assert we actually set extra_body here optional_params = litellm.utils.get_optional_params(