Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.3 KB
Raw Blame
"""
Content Fetcher Module.

Provides unified content fetching from various sources:
- Academic papers (arXiv, PubMed, Semantic Scholar, bioRxiv)
- Web pages (HTML)
- Direct PDF links

Usage:
    from local_deep_research.content_fetcher import ContentFetcher

    fetcher = ContentFetcher()
    result = fetcher.fetch("https://arxiv.org/abs/2301.12345")
    print(result["content"])
"""

from .url_classifier import URLClassifier, URLType

__all__ = ["ContentFetcher", "URLClassifier", "URLType"]


def __getattr__(name):
    """Lazily resolve ``ContentFetcher`` on first attribute access.

    ``fetcher`` transitively pulls in the full web/DB stack
    (requests, playwright, … via ``research_library.downloaders``).
    Deferring the import lets
    ``from ...content_fetcher.url_classifier import URLClassifier``
    stay cheap and lets minimal test setups import the package
    without that dependency tree. See issue #4992.
    """
    if name == "ContentFetcher":
        from .fetcher import ContentFetcher as _ContentFetcher

        globals()["ContentFetcher"] = _ContentFetcher
        return _ContentFetcher
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


def __dir__():
    """Expose lazily-resolved names to ``dir()`` and tab completion."""
    return sorted(set(globals()) | {"ContentFetcher"})