From d8d19fac09cd93c6bc8bc89986f7415345a02075 Mon Sep 17 00:00:00 2001 From: dbczumar Date: Fri, 1 Dec 2023 10:02:52 -0800 Subject: [PATCH 1/2] fix Signed-off-by: dbczumar --- mlflow/gateway/providers/anthropic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlflow/gateway/providers/anthropic.py b/mlflow/gateway/providers/anthropic.py index 9d2027d923164..ec3705e0d22b5 100644 --- a/mlflow/gateway/providers/anthropic.py +++ b/mlflow/gateway/providers/anthropic.py @@ -63,7 +63,7 @@ def completions_to_model(cls, payload, config): detail="Setting the 'stream' parameter to 'true' is not supported with the MLflow " "Gateway.", ) - n = payload.get("n", 1) + n = payload.pop("n", 1) if n != 1: raise HTTPException( status_code=422, From c78da02e038213e3783a75525a483b94f6919715 Mon Sep 17 00:00:00 2001 From: dbczumar Date: Fri, 1 Dec 2023 11:28:52 -0800 Subject: [PATCH 2/2] fix test Signed-off-by: dbczumar --- tests/gateway/providers/test_anthropic.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/gateway/providers/test_anthropic.py b/tests/gateway/providers/test_anthropic.py index 6aa8ff122c643..8b20ab0af1bd7 100644 --- a/tests/gateway/providers/test_anthropic.py +++ b/tests/gateway/providers/test_anthropic.py @@ -84,7 +84,6 @@ async def test_completions(): json={ "model": "claude-instant-1", "temperature": 0.5, - "n": 1, "max_tokens_to_sample": 200, "prompt": "\n\nHuman: How does a car work?\n\nAssistant:", "stop_sequences": ["foobazbardiddly"], @@ -109,7 +108,6 @@ async def test_completions_with_default_max_tokens(): json={ "model": "claude-instant-1", "temperature": 0.0, - "n": 1, "max_tokens_to_sample": 200000, "prompt": "\n\nHuman: How does a car work?\n\nAssistant:", },