test(transports): assert Moonshot wire schema carries required:[]

Transport-level regression for #66835 — verifies the outgoing tool
schema at the chat_completions build_kwargs boundary, not just the
sanitizer unit.
This commit is contained in:
Teknium 2026-07-20 10:25:00 -07:00
parent acc1b6e76a
commit a5b9803a51

View file

@ -747,6 +747,28 @@ class TestChatCompletionsKimi:
)
assert kw["tools"][0]["function"]["parameters"]["properties"]["q"]["type"] == "string"
def test_moonshot_outgoing_schema_carries_required_array(self, transport):
"""Moonshot 400s on object schemas without an explicit `required` array
(#66835). Assert the wire-level tool schema — what actually leaves the
transport carries `required: []` on a zero-required-param tool."""
tools = [
{
"type": "function",
"function": {
"name": "browser_snapshot",
"description": "Snapshot",
"parameters": {"type": "object", "properties": {}},
},
},
]
kw = transport.build_kwargs(
model="moonshotai/kimi-k3",
messages=[{"role": "user", "content": "Hi"}],
tools=tools,
max_tokens_param_fn=lambda n: {"max_tokens": n},
)
assert kw["tools"][0]["function"]["parameters"]["required"] == []
def test_non_moonshot_tools_are_not_mutated(self, transport):
"""Other models don't go through the Moonshot sanitizer."""
original_params = {