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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(databricks/common_utils.py): fix custom endpoint check (#9925)
Krish Dholakiab9f01c9f5bee
diff --git a/litellm/llms/databricks/common_utils.py b/litellm/llms/databricks/common_utils.pyindex eab9e2f825d..1353b5b13f6 100644--- a/litellm/llms/databricks/common_utils.py+++ b/litellm/llms/databricks/common_utils.py@@ -68,7 +68,7 @@ class DatabricksBase:headers: Optional[dict],) -> Tuple[str, dict]:if api_key is None and not headers: # handle empty headers- if custom_endpoint is not None:+ if custom_endpoint is True:raise DatabricksException(status_code=400,message="Missing API Key - A call is being made to LLM Provider but no key is set either in the environment variables ({LLM_PROVIDER}_API_KEY) or via params",diff --git a/tests/litellm/llms/databricks/test_databricks_common_utils.py b/tests/litellm/llms/databricks/test_databricks_common_utils.pynew file mode 100644index 00000000000..7f7ec8e9000--- /dev/null+++ b/tests/litellm/llms/databricks/test_databricks_common_utils.py@@ -0,0 +1,32 @@+import json+import os+import sys++import pytest+from fastapi.testclient import TestClient++sys.path.insert(+ 0, os.path.abspath("../../../..")+) # Adds the parent directory to the system path+from unittest.mock import MagicMock, patch++from litellm.llms.databricks.common_utils import DatabricksBase+++def test_databricks_validate_environment():+ databricks_base = DatabricksBase()++ with patch.object(+ databricks_base, "_get_databricks_credentials"+ ) as mock_get_credentials:+ try:+ databricks_base.databricks_validate_environment(+ api_key=None,+ api_base="my_api_base",+ endpoint_type="chat_completions",+ custom_endpoint=False,+ headers=None,+ )+ except Exception:+ pass+ mock_get_credentials.assert_called_once()