mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields'
This commit is contained in:
parent
9202870e14
commit
3765d88809
2 changed files with 33 additions and 0 deletions
|
|
@ -236,6 +236,10 @@ class FireworksAIConfig(OpenAIGPTConfig):
|
|||
disable_add_transform_inline_image_block=disable_add_transform_inline_image_block,
|
||||
)
|
||||
filter_value_from_dict(cast(dict, message), "cache_control")
|
||||
# Remove fields not permitted by FireworksAI that may cause:
|
||||
# "Not permitted, field: 'messages[n].provider_specific_fields'"
|
||||
if isinstance(message, dict) and "provider_specific_fields" in message:
|
||||
message.pop("provider_specific_fields", None)
|
||||
|
||||
return messages
|
||||
|
||||
|
|
|
|||
|
|
@ -108,3 +108,32 @@ def test_get_supported_openai_params_reasoning_effort():
|
|||
"fireworks_ai/accounts/fireworks/models/llama-v3-70b-instruct"
|
||||
)
|
||||
assert "reasoning_effort" not in unsupported_params
|
||||
|
||||
|
||||
def test_transform_messages_helper_removes_provider_specific_fields():
|
||||
"""
|
||||
Test that _transform_messages_helper removes provider_specific_fields from messages.
|
||||
"""
|
||||
config = FireworksAIConfig()
|
||||
# Simulated messages, as dicts, including provider_specific_fields
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Hello!",
|
||||
"provider_specific_fields": {"extra": "should be removed"},
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Hi there!",
|
||||
"provider_specific_fields": {"more": "remove this"},
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "How are you?",
|
||||
# no provider_specific_fields
|
||||
}
|
||||
]
|
||||
# Call helper
|
||||
out = config._transform_messages_helper(messages, model="fireworks/test", litellm_params={})
|
||||
for msg in out:
|
||||
assert "provider_specific_fields" not in msg
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue