Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deprecate langhchain community ucfunctiontoolkit in favor for databricks_langchain #29746

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
" UCFunctionToolkit,\n",
" set_uc_function_client,\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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use unitycatalog-langchain package? databricks_langchain.uc_ai imports from it and it doesn't seem needed to rely on another package (databricks-langchain) here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Eric, we wanted all the imports to be from one place so its easier for users to just install and know about 1 package. That is why we re-exported from databricks-ai-bridge package. So I guess documenting only one package makes sense. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to the direction of a single package interface. In the backend, we're using unitycatalog-langchain for the toolkit implementation. Having everything all go through a unified namespace of databricks.ai makes a ton of sense to me.

)
class UCFunctionToolkit(BaseToolkit):
warehouse_id: str = Field(
description="The ID of a Databricks SQL Warehouse to execute functions."
Expand Down
Loading