This commit is contained in:
Tuan Pham 2026-10-28 14:50:37 +00:00 • committed by GitHub
commit fcdbf99518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 1 deletions

View file

@ -349,7 +349,9 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig):
if "delimiters" in stream_options:
stream_config["delimiters"] = stream_options["delimiters"]
optional_params.pop("tool_choice", None)
# tool_choice is forwarded via model.params for Anthropic and GPT models
if not model.startswith(("anthropic", "gpt")):
optional_params.pop("tool_choice", None)
modules: Final = [
self._build_prompt_module(

View file

@ -641,6 +641,38 @@ class TestSAPTransformationIntegration:
== "sap_document_translation"
)
@pytest.mark.parametrize("model", ["anthropic--claude-4.5-sonnet", "gpt-4o"])
@pytest.mark.parametrize(
"tool_choice",
["auto", "required", {"type": "function", "function": {"name": "get_pump"}}],
)
def test_tool_choice_forwarded_in_model_params(
self, mock_config, model, tool_choice
):
result = mock_config.transform_request(
model=model,
messages=[{"role": "user", "content": "Hello"}],
optional_params={
"tools": [
{
"type": "function",
"function": {
"name": "get_pump",
"parameters": {"type": "object", "properties": {}},
},
}
],
"tool_choice": tool_choice,
},
litellm_params={},
headers={},
)
model_params = result["config"]["modules"]["prompt_templating"]["model"][
"params"
]
assert model_params["tool_choice"] == tool_choice
class TestCacheControl:
"""Unit tests for cache_control preservation on message content parts."""