mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(main): forward store and prompt_cache_key on the MCP gateway early-return
This commit is contained in:
parent
0e0768df9f
commit
ec35098108
2 changed files with 26 additions and 0 deletions
|
|
@ -5064,6 +5064,8 @@ def completion(
|
|||
verbosity=verbosity,
|
||||
safety_identifier=safety_identifier,
|
||||
service_tier=service_tier,
|
||||
store=store,
|
||||
prompt_cache_key=prompt_cache_key,
|
||||
base_url=base_url,
|
||||
api_version=api_version,
|
||||
api_key=api_key,
|
||||
|
|
|
|||
|
|
@ -2473,6 +2473,30 @@ def test_completion_omits_store_and_prompt_cache_key_when_not_passed():
|
|||
assert "prompt_cache_key" not in request_body
|
||||
|
||||
|
||||
def test_completion_forwards_store_and_prompt_cache_key_to_mcp_gateway():
|
||||
"""
|
||||
Regression test for the MCP gateway early-return in completion(): store and
|
||||
prompt_cache_key are named params, so they no longer travel via **kwargs and
|
||||
must be forwarded explicitly like safety_identifier and service_tier.
|
||||
"""
|
||||
with patch(
|
||||
"litellm.responses.mcp.chat_completions_handler.acompletion_with_mcp"
|
||||
) as mock_mcp:
|
||||
result = litellm.completion(
|
||||
model="openai/gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
tools=[{"type": "mcp", "server_url": "litellm_proxy"}],
|
||||
store=False,
|
||||
prompt_cache_key="test-cache-key",
|
||||
)
|
||||
|
||||
result.close()
|
||||
mock_mcp.assert_called_once()
|
||||
call_kwargs = mock_mcp.call_args.kwargs
|
||||
assert call_kwargs["store"] is False
|
||||
assert call_kwargs["prompt_cache_key"] == "test-cache-key"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"aws_credential_kwargs",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue