mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-21 03:51:42 +00:00
docs: add Google-style docstrings to tools and llms modules (zapier, … (#31957)
**Description:** Added standardized Google-style docstrings to improve documentation consistency across key modules. Updated files: - `tools/zapier/tool.py` - `tools/jira/tool.py` - `tools/json/tool.py` - `llms/base.py` These changes enhance readability and maintain consistency with LangChain’s documentation style guide. **Issue:** Fixes #21983 **Dependencies:** None **Twitter handle :** @Akshara_p_
This commit is contained in:
parent
612ccf847a
commit
103fd6ac0c
@ -1,9 +1,17 @@
|
|||||||
# Backwards compatibility.
|
"""
|
||||||
|
This module provides backward-compatible exports of core language model classes.
|
||||||
|
|
||||||
|
These classes are re-exported for compatibility with older versions of LangChain
|
||||||
|
and allow users to import language model interfaces from a stable path.
|
||||||
|
|
||||||
|
Exports:
|
||||||
|
- LLM: Abstract base class for all LLMs
|
||||||
|
- BaseLLM: Deprecated or foundational class for legacy LLMs
|
||||||
|
- BaseLanguageModel: Base class for core language model implementations
|
||||||
|
"""
|
||||||
|
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
from langchain_core.language_models.llms import (
|
from langchain_core.language_models.llms import LLM, BaseLLM
|
||||||
LLM,
|
|
||||||
BaseLLM,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"LLM",
|
"LLM",
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
"""
|
||||||
|
This module provides dynamic access to deprecated Jira tools.
|
||||||
|
|
||||||
|
When attributes like `JiraAction` are accessed, they are redirected to their new
|
||||||
|
locations in `langchain_community.tools`. This ensures backward compatibility
|
||||||
|
while warning developers about deprecation.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
JiraAction (deprecated): Dynamically loaded from langchain_community.tools.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from langchain._api import create_importer
|
from langchain._api import create_importer
|
||||||
@ -14,7 +25,15 @@ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_L
|
|||||||
|
|
||||||
|
|
||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Look up attributes dynamically."""
|
"""
|
||||||
|
Dynamically retrieve attributes from the updated module path.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): The name of the attribute to import.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any: The resolved attribute from the updated path.
|
||||||
|
"""
|
||||||
return _import_attribute(name)
|
return _import_attribute(name)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
"""
|
||||||
|
This module provides dynamic access to deprecated JSON tools in LangChain.
|
||||||
|
|
||||||
|
It ensures backward compatibility by forwarding references such as
|
||||||
|
`JsonGetValueTool`, `JsonListKeysTool`, and `JsonSpec` to their updated
|
||||||
|
locations within the `langchain_community.tools` namespace.
|
||||||
|
|
||||||
|
This setup allows legacy code to continue working while guiding developers
|
||||||
|
toward using the updated module paths.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from langchain._api import create_importer
|
from langchain._api import create_importer
|
||||||
@ -19,7 +30,18 @@ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_L
|
|||||||
|
|
||||||
|
|
||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Look up attributes dynamically."""
|
"""
|
||||||
|
Dynamically retrieve attributes from the updated module path.
|
||||||
|
|
||||||
|
This method is used to resolve deprecated attribute imports
|
||||||
|
at runtime and forward them to their new locations.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): The name of the attribute to import.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any: The resolved attribute from the appropriate updated module.
|
||||||
|
"""
|
||||||
return _import_attribute(name)
|
return _import_attribute(name)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
"""
|
||||||
|
This module provides dynamic access to deprecated Zapier tools in LangChain.
|
||||||
|
|
||||||
|
It supports backward compatibility by forwarding references such as
|
||||||
|
`ZapierNLAListActions` and `ZapierNLARunAction` to their updated locations
|
||||||
|
in the `langchain_community.tools` package.
|
||||||
|
|
||||||
|
Developers using older import paths will continue to function, while LangChain
|
||||||
|
internally redirects access to the newer, supported module structure.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from langchain._api import create_importer
|
from langchain._api import create_importer
|
||||||
@ -17,7 +28,18 @@ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_L
|
|||||||
|
|
||||||
|
|
||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Look up attributes dynamically."""
|
"""
|
||||||
|
Dynamically retrieve attributes from the updated module path.
|
||||||
|
|
||||||
|
This method is used to resolve deprecated attribute imports
|
||||||
|
at runtime and forward them to their new locations.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): The name of the attribute to import.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any: The resolved attribute from the appropriate updated module.
|
||||||
|
"""
|
||||||
return _import_attribute(name)
|
return _import_attribute(name)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user