From 16af2d9a50a789c97afd45a7b027ec91dc59586e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 28 Jul 2025 17:34:42 -0700 Subject: [PATCH] test: skip dbrx claude 3-7 sonnet test - rate limit errors --- tests/llm_translation/test_databricks.py | 54 ++++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/tests/llm_translation/test_databricks.py b/tests/llm_translation/test_databricks.py index 0ca1028a556..7828314baa3 100644 --- a/tests/llm_translation/test_databricks.py +++ b/tests/llm_translation/test_databricks.py @@ -276,8 +276,13 @@ def test_completions_with_sync_http_handler(monkeypatch): extraparam="testpassingextraparam", ) - assert mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" - assert mock_post.call_args.kwargs["headers"]["Authorization"] == f"Bearer {api_key}" + assert ( + mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" + ) + assert ( + mock_post.call_args.kwargs["headers"]["Authorization"] + == f"Bearer {api_key}" + ) assert mock_post.call_args.kwargs["url"] == f"{base_url}/chat/completions" assert mock_post.call_args.kwargs["stream"] == False @@ -292,6 +297,7 @@ def test_completions_with_sync_http_handler(monkeypatch): } assert actual_data == expected_data, f"Unexpected JSON data: {actual_data}" + def test_completions_with_async_http_handler(monkeypatch): base_url = "https://my.workspace.cloud.databricks.com/serving-endpoints" api_key = "dapimykey" @@ -325,8 +331,13 @@ def test_completions_with_async_http_handler(monkeypatch): ) ) - assert mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" - assert mock_post.call_args.kwargs["headers"]["Authorization"] == f"Bearer {api_key}" + assert ( + mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" + ) + assert ( + mock_post.call_args.kwargs["headers"]["Authorization"] + == f"Bearer {api_key}" + ) assert mock_post.call_args.kwargs["url"] == f"{base_url}/chat/completions" assert mock_post.call_args.kwargs["stream"] == False @@ -367,12 +378,16 @@ def test_completions_streaming_with_sync_http_handler(monkeypatch): assert "chatcmpl" in str(response) assert len(response) == 4 - assert mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" - assert mock_post.call_args.kwargs["headers"]["Authorization"] == f"Bearer {api_key}" + assert ( + mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" + ) + assert ( + mock_post.call_args.kwargs["headers"]["Authorization"] + == f"Bearer {api_key}" + ) assert mock_post.call_args.kwargs["url"] == f"{base_url}/chat/completions" assert mock_post.call_args.kwargs["stream"] == True - actual_data = json.loads( mock_post.call_args.kwargs["data"] ) # Deserialize the actual data @@ -420,12 +435,16 @@ def test_completions_streaming_with_async_http_handler(monkeypatch): assert "chatcmpl" in str(response) assert len(response) == 4 - assert mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" - assert mock_post.call_args.kwargs["headers"]["Authorization"] == f"Bearer {api_key}" + assert ( + mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" + ) + assert ( + mock_post.call_args.kwargs["headers"]["Authorization"] + == f"Bearer {api_key}" + ) assert mock_post.call_args.kwargs["url"] == f"{base_url}/chat/completions" assert mock_post.call_args.kwargs["stream"] == True - actual_data = json.loads( mock_post.call_args.kwargs["data"] ) # Deserialize the actual data @@ -484,9 +503,17 @@ def test_completions_uses_databricks_sdk_if_api_key_and_base_not_specified(monke ) assert response.to_dict() == expected_response_json - assert mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" - assert mock_post.call_args.kwargs["headers"]["Authorization"] == f"Bearer {api_key}" - assert mock_post.call_args.kwargs["url"] == f"{base_url}/serving-endpoints/chat/completions" + assert ( + mock_post.call_args.kwargs["headers"]["Content-Type"] == "application/json" + ) + assert ( + mock_post.call_args.kwargs["headers"]["Authorization"] + == f"Bearer {api_key}" + ) + assert ( + mock_post.call_args.kwargs["url"] + == f"{base_url}/serving-endpoints/chat/completions" + ) assert mock_post.call_args.kwargs["stream"] == False assert mock_post.call_args.kwargs["data"] == json.dumps( { @@ -635,6 +662,7 @@ def test_embeddings_uses_databricks_sdk_if_api_key_and_base_not_specified(monkey ) +@pytest.mark.skip(reason="Databricks rate limit errors") class TestDatabricksCompletion(BaseLLMChatTest, BaseAnthropicChatTest): def get_base_completion_call_args(self) -> dict: return {"model": "databricks/databricks-claude-3-7-sonnet"}