mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge b053bae9d9 into 40ff01b987
This commit is contained in:
commit
5675b0f6cf
2 changed files with 26 additions and 2 deletions
|
|
@ -1962,8 +1962,13 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
|
|||
optional_params.pop("metadata")
|
||||
|
||||
# Remove internal LiteLLM parameters that should not be sent to Anthropic API
|
||||
optional_params.pop("is_vertex_request", None)
|
||||
optional_params.pop("client_metadata", None)
|
||||
for internal_param in (
|
||||
"is_vertex_request",
|
||||
"client_metadata",
|
||||
"vector_store_ids",
|
||||
"vector_store_id",
|
||||
):
|
||||
optional_params.pop(internal_param, None)
|
||||
|
||||
# ``top_k`` is a provider-specific kwarg that bypasses
|
||||
# ``map_openai_params``; gate it here, the single boundary shared by
|
||||
|
|
|
|||
|
|
@ -5996,6 +5996,25 @@ def test_client_metadata_stripped_from_anthropic_request():
|
|||
assert "client_metadata" not in result
|
||||
|
||||
|
||||
def test_transform_request_strips_vector_store_ids():
|
||||
"""vector_store_ids injected by proxy vector store hooks must not reach the Anthropic payload."""
|
||||
config = AnthropicConfig()
|
||||
result = config.transform_request(
|
||||
model="claude-3-5-haiku-20241022",
|
||||
messages=[{"role": "user", "content": "hello"}],
|
||||
optional_params={
|
||||
"max_tokens": 10,
|
||||
"vector_store_ids": ["vs_abc123"],
|
||||
"vector_store_id": "vs_abc123",
|
||||
},
|
||||
litellm_params={},
|
||||
headers={},
|
||||
)
|
||||
assert "vector_store_ids" not in result
|
||||
assert "vector_store_id" not in result
|
||||
assert result["max_tokens"] == 10
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model",
|
||||
["claude-fable-5", "claude-opus-4-7", "claude-opus-4-8-20260120"],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue