Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
tool.py33 linesDownload Raw Back to ddg_search
1from typing import TYPE_CHECKING, Any2 3from langchain_classic._api import create_importer4 5if TYPE_CHECKING:6    from langchain_community.tools import DuckDuckGoSearchResults, DuckDuckGoSearchRun7    from langchain_community.tools.ddg_search.tool import DDGInput, DuckDuckGoSearchTool8 9# Create a way to dynamically look up deprecated imports.10# Used to consolidate logic for raising deprecation warnings and11# handling optional imports.12DEPRECATED_LOOKUP = {13    "DDGInput": "langchain_community.tools.ddg_search.tool",14    "DuckDuckGoSearchRun": "langchain_community.tools",15    "DuckDuckGoSearchResults": "langchain_community.tools",16    "DuckDuckGoSearchTool": "langchain_community.tools.ddg_search.tool",17}18 19_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)20 21 22def __getattr__(name: str) -> Any:23    """Look up attributes dynamically."""24    return _import_attribute(name)25 26 27__all__ = [28    "DDGInput",29    "DuckDuckGoSearchResults",30    "DuckDuckGoSearchRun",31    "DuckDuckGoSearchTool",32]33 
codekingpro/portable-devtools · Team Ai