litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: drop_params does not work

Open gustavz opened this issue 6 months ago • 1 comments

What happened?

My understanding of drop_params is that it should drop unsupported params before making a call to the LLM provider. Is this correct? if yes then it does not work. If not please explain what it should actually do 🙏

Relevant log output

import litellm

response = litellm.completion(
    model="gpt-4", 
    messages=[{"role": "user", "content": "Hey, how's it going?"}],
    system_prompt="you are a bad pirate", # NOT SUPPORTED PARAM
    drop_params=True,
    )

>>
BadRequestError: litellm.BadRequestError: OpenAIException - Unrecognized request argument supplied: system_prompt

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

1.67.4.post1

Twitter / LinkedIn details

No response

gustavz avatar May 13 '25 09:05 gustavz

@krrishdholakia

gustavz avatar May 13 '25 09:05 gustavz

Same issue but going through config

model_list:
  - model_name: openai:gpt-4o
    litellm_params:
      model: openai/gpt-4o
      api_key: os.environ/OPENAI_API_KEY
      drop_params: true
      additional_drop_params:
        - red

On running

import requests

url = "http://0.0.0.0:4000/chat/completions"

headers = {"Content-Type": "application/json", "Authorization": "Bearer sk-..."}
body = {
    "model": "openai:gpt-4o",
    "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Tell me "}
    ],
    "max_tokens": 2000,
    "red": False
}

resp = requests.post(url, headers=headers, json=body)
print(resp.json())

{'error': {'message': 'litellm.BadRequestError: OpenAIException - Unrecognized request argument supplied: red. Received Model Group=openai:gpt-4o\nAvailable Model Group Fallbacks=None', 'type': 'invalid_request_error', 'param': None, 'code': '400'}}

version: 1.71.2

amoghnalwaya avatar May 29 '25 20:05 amoghnalwaya

@gustavz drop params only covers openai params - if you pass in a non-openai param, we pass that straight through considering it a provider specific param

krrishdholakia avatar May 29 '25 22:05 krrishdholakia

@amoghnalwaya additional_drop_params follows the same principal. But your flow makes sense, so i've modified this ticket to cover that.

krrishdholakia avatar May 29 '25 22:05 krrishdholakia

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Aug 28 '25 00:08 github-actions[bot]