Skip to content

Commit

Permalink
Deprecate langhchain community ucfunctiontoolkit in favor for databri…
Browse files Browse the repository at this point in the history
…cks_langchain
  • Loading branch information
sunishsheth2009 committed Feb 12, 2025
1 parent f4e3e86 commit 9e7257b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
27 changes: 13 additions & 14 deletions docs/docs/integrations/tools/databricks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,20 @@
"metadata": {},
"outputs": [],
"source": [
"from databricks.sdk import WorkspaceClient\n",
"from langchain_community.tools.databricks import UCFunctionToolkit\n",
"from databricks_langchain.uc_ai import (\n",
" DatabricksFunctionClient,\n",
" set_uc_function_client,\n",
" UCFunctionToolkit,\n",
")\n",
"\n",
"client = DatabricksFunctionClient()\n",
"set_uc_function_client(client)\n",
"\n",
"tools = (\n",
" UCFunctionToolkit(\n",
" # You can find the SQL warehouse ID in its UI after creation.\n",
" warehouse_id=\"xxxx123456789\"\n",
" )\n",
" .include(\n",
" # Include functions as tools using their qualified names.\n",
" # You can use \"{catalog_name}.{schema_name}.*\" to get all functions in a schema.\n",
" \"main.tools.python_exec\",\n",
" )\n",
" .get_tools()\n",
")"
"tools = UCFunctionToolkit(\n",
" # Include functions as tools using their qualified names.\n",
" # You can use \"{catalog_name}.{schema_name}.*\" to get all functions in a schema.\n",
" function_names=[\"main.tools.python_exec\"]\n",
").tools"
]
},
{
Expand Down
6 changes: 6 additions & 0 deletions libs/community/langchain_community/tools/databricks/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from hashlib import md5
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union

from langchain_core._api import deprecated
from langchain_core.tools import BaseTool, StructuredTool
from langchain_core.tools.base import BaseToolkit
from pydantic import BaseModel, Field, create_model
Expand Down Expand Up @@ -131,6 +132,11 @@ def _get_default_workspace_client() -> Any:
return WorkspaceClient()


@deprecated(
since="0.3.18",
removal="1.0",
alternative_import="databricks_langchain.uc_ai.UCFunctionToolkit",
)
class UCFunctionToolkit(BaseToolkit):
warehouse_id: str = Field(
description="The ID of a Databricks SQL Warehouse to execute functions."
Expand Down

0 comments on commit 9e7257b

Please sign in to comment.