mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(groq): add test_litellm regression for assistant metadata strip
This commit is contained in:
parent
fe656d8d4f
commit
6170840a35
1 changed files with 31 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
from typing import List, cast
|
||||
|
||||
from litellm.llms.groq.chat.transformation import GroqChatConfig
|
||||
from litellm.types.llms.openai import AllMessageValues
|
||||
|
||||
|
||||
def test_transform_messages_strips_assistant_provider_specific_fields() -> None:
|
||||
"""Groq payloads should not include LiteLLM internal assistant metadata."""
|
||||
config = GroqChatConfig()
|
||||
messages = cast(
|
||||
List[AllMessageValues],
|
||||
[
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Tool metadata",
|
||||
"provider_specific_fields": {
|
||||
"mcp_list_tools": [{"name": "weather"}],
|
||||
"mcp_tool_calls": [{"id": "call_123"}],
|
||||
},
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
transformed = cast(
|
||||
List[AllMessageValues],
|
||||
config._transform_messages(messages=messages, model="qwen/qwen3-32b"),
|
||||
)
|
||||
|
||||
assert transformed[0]["role"] == "assistant"
|
||||
assert transformed[0].get("content") == "Tool metadata"
|
||||
assert "provider_specific_fields" not in transformed[0]
|
||||
Loading…
Add table
Reference in a new issue