Skip to content

The agent engineering platform.

community: make old stub for QuerySQLDataBaseTool private to skip api ref (#28711)

Erick Friis86b3c6e81c60
diff --git a/libs/community/langchain_community/chat_models/outlines.py b/libs/community/langchain_community/chat_models/outlines.py
index 00aa05adfe..64894ff237 100644
--- a/libs/community/langchain_community/chat_models/outlines.py
+++ b/libs/community/langchain_community/chat_models/outlines.py
@@ -122,13 +122,13 @@ class ChatOutlines(BaseChatModel):
This can be useful for generating structured outputs like IP addresses, dates, etc.
Example: (valid IP address)
- regex = r"((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)"
+ regex = r"((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)"
Note: Computing the regex index can take some time, so it's recommended to reuse
the same regex for multiple generations if possible.
For more details, see: https://dottxt-ai.github.io/outlines/reference/generation/regex/
- """
+ """ # noqa: E501
type_constraints: Optional[Union[type, str]] = None
"""Type constraints for structured generation.
diff --git a/libs/community/langchain_community/tools/sql_database/tool.py b/libs/community/langchain_community/tools/sql_database/tool.py
index 1c72b6e991..8bbc595581 100644
--- a/libs/community/langchain_community/tools/sql_database/tool.py
+++ b/libs/community/langchain_community/tools/sql_database/tool.py
@@ -7,6 +7,7 @@ from sqlalchemy.engine import Result
from pydantic import BaseModel, Field, root_validator, model_validator, ConfigDict
+from langchain_core._api.deprecation import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.callbacks import (
AsyncCallbackManagerForToolRun,
@@ -58,8 +59,17 @@ class QuerySQLDatabaseTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[overr
return self.db.run_no_throw(query)
-# Backwards compatibility.
-QuerySQLDataBaseTool = QuerySQLDatabaseTool
+@deprecated(
+ since="0.3.12",
+ removal="1.0",
+ alternative_import="langchain_community.tools.QuerySQLDatabaseTool",
+)
+class QuerySQLDataBaseTool(QuerySQLDatabaseTool): # type: ignore[override]
+ """
+ Equivalent stub to QuerySQLDatabaseTool for backwards compatibility.
+ :private:"""
+
+ ...
class _InfoSQLDatabaseToolInput(BaseModel):