Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: skip dbrx claude 3-7 sonnet test - rate limit errors

Krrish Dholakia16af2d9a50a7
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
)
[email protected](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"}