[CI] Fix test_tool_id_kimi_k2 (#26787)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
Chauncey 2025-10-14 18:27:07 +08:00 committed by GitHub
parent ef9676a1f1
commit 780eb03d9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -247,10 +247,10 @@ async def test_tool_id_kimi_k2(
) )
assert chat_completion.choices[0].message.tool_calls is not None assert chat_completion.choices[0].message.tool_calls is not None
assert len(chat_completion.choices[0].message.tool_calls) > 0 assert len(chat_completion.choices[0].message.tool_calls) > 0
assert ( assert chat_completion.choices[0].message.tool_calls[0].id in [
chat_completion.choices[0].message.tool_calls[0].id "functions.get_current_weather:0",
== "functions.get_current_weather:0" "functions.get_forecast:1",
) ]
else: else:
# Streaming test # Streaming test
output_stream = await k2_client.chat.completions.create( output_stream = await k2_client.chat.completions.create(
@ -266,7 +266,10 @@ async def test_tool_id_kimi_k2(
if chunk.choices and chunk.choices[0].delta.tool_calls: if chunk.choices and chunk.choices[0].delta.tool_calls:
output.extend(chunk.choices[0].delta.tool_calls) output.extend(chunk.choices[0].delta.tool_calls)
for o in output: for o in output:
assert o.id is None or o.id == "functions.get_current_weather:0" assert o.id is None or o.id in [
"functions.get_current_weather:0",
"functions.get_forecast:1",
]
@pytest.mark.asyncio @pytest.mark.asyncio