Skip to content

Commit

Permalink
Update based on comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sunish Sheth <[email protected]>
  • Loading branch information
sunishsheth2009 committed Dec 16, 2024
1 parent d887b79 commit d861da6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/databricks_ai_bridge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from databricks_ai_bridge.external_tool_request import http_request

__all__ = ["http_request"]
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def http_request(
params: Optional[Dict[str, Any]] = None,
) -> requests.Response:
"""
Makes an HTTP request to an external function through the Databricks Workspace.
Makes an HTTP request to a remote API using authentication from a Unity Catalog HTTP connection.
Args:
conn (str): The connection name to use. This is required to identify the external connection.
Expand Down
2 changes: 2 additions & 0 deletions src/databricks_ai_bridge/utils/annotations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This code is copied from MLflow: https://github.com/mlflow/mlflow/blob/v2.19.0/mlflow/utils/annotations.py#L31

import inspect
import re
import types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from unittest.mock import MagicMock, patch

from databricks_ai_bridge import http_request
from databricks_ai_bridge.external_tools import http_request


@patch("databricks_ai_bridge.external_tool_request.WorkspaceClient")
@patch("databricks_ai_bridge.external_tool_request.requests.post")
@patch("databricks_ai_bridge.external_tools.WorkspaceClient")
@patch("databricks_ai_bridge.external_tools.requests.post")
def test_http_request_success(mock_post, mock_workspace_client):
# Mock the WorkspaceClient config
mock_workspace_config = MagicMock()
Expand Down Expand Up @@ -49,8 +49,8 @@ def test_http_request_success(mock_post, mock_workspace_client):
)


@patch("databricks_ai_bridge.external_tool_request.WorkspaceClient")
@patch("databricks_ai_bridge.external_tool_request.requests.post")
@patch("databricks_ai_bridge.external_tools.WorkspaceClient")
@patch("databricks_ai_bridge.external_tools.requests.post")
def test_http_request_error_response(mock_post, mock_workspace_client):
# Mock the WorkspaceClient config
mock_workspace_config = MagicMock()
Expand Down

0 comments on commit d861da6

Please sign in to comment.