feat(xai): add parallel_tool_calls to supported params (#25106)
This commit is contained in:
parent
f49c91ea92
commit
ec38f2b17b
@ -43,6 +43,7 @@ class XAIChatConfig(OpenAIGPTConfig):
|
||||
"logprobs",
|
||||
"max_tokens",
|
||||
"n",
|
||||
"parallel_tool_calls",
|
||||
"presence_penalty",
|
||||
"response_format",
|
||||
"seed",
|
||||
|
||||
39
tests/test_litellm/llms/xai/test_xai_chat_transformation.py
Normal file
39
tests/test_litellm/llms/xai/test_xai_chat_transformation.py
Normal file
@ -0,0 +1,39 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../../../..")
|
||||
) # Adds the parent directory to the system path
|
||||
|
||||
from litellm.llms.xai.chat.transformation import XAIChatConfig
|
||||
|
||||
|
||||
class TestXAIParallelToolCalls:
|
||||
"""Test suite for XAI parallel tool calls functionality."""
|
||||
|
||||
def test_get_supported_openai_params_includes_parallel_tool_calls(self):
|
||||
"""Test that parallel_tool_calls is in supported parameters."""
|
||||
config = XAIChatConfig()
|
||||
supported_params = config.get_supported_openai_params(
|
||||
"xai/grok-4.20"
|
||||
)
|
||||
assert "parallel_tool_calls" in supported_params
|
||||
|
||||
def test_transform_request_preserves_parallel_tool_calls(self):
|
||||
"""Test that transform_request preserves parallel_tool_calls parameter."""
|
||||
config = XAIChatConfig()
|
||||
|
||||
messages = [{"role": "user", "content": "What's the weather like?"}]
|
||||
optional_params = {"parallel_tool_calls": True}
|
||||
|
||||
result = config.transform_request(
|
||||
model="xai/grok-4.20",
|
||||
messages=messages,
|
||||
optional_params=optional_params,
|
||||
litellm_params={},
|
||||
headers={},
|
||||
)
|
||||
|
||||
assert result.get("parallel_tool_calls") is True
|
||||
assert len(result["messages"]) == 1
|
||||
assert result["messages"][0]["role"] == "user"
|
||||
Loading…
Reference in New Issue
Block a user