MCPcopy
hub / github.com/aiming-lab/AutoResearchClaw / search

Method search

researchclaw/web/search.py:94–113  ·  view source on GitHub ↗

Search the web for a query.

(
        self,
        query: str,
        *,
        max_results: int | None = None,
        include_domains: list[str] | None = None,
        exclude_domains: list[str] | None = None,
    )

Source from the content-addressed store, hash-verified

92 self.include_answer = include_answer
93
94 def search(
95 self,
96 query: str,
97 *,
98 max_results: int | None = None,
99 include_domains: list[str] | None = None,
100 exclude_domains: list[str] | None = None,
101 ) -> WebSearchResponse:
102 """Search the web for a query."""
103 limit = max_results or self.max_results
104 t0 = time.monotonic()
105
106 # Tavily is the primary engine
107 if self.api_key:
108 try:
109 return self._search_tavily(query, limit, include_domains, exclude_domains, t0)
110 except Exception as exc: # noqa: BLE001
111 logger.warning("Tavily search failed, falling back to DuckDuckGo: %s", exc)
112
113 return self._search_duckduckgo(query, limit, t0)
114
115 def search_multi(
116 self,

Callers 15

search_multiMethod · 0.95
_extract_jsonFunction · 0.45
_extract_jsonFunction · 0.45
_is_negated_contextFunction · 0.45
test_search_by_queryMethod · 0.45
test_search_by_typeMethod · 0.45

Calls 2

_search_tavilyMethod · 0.95
_search_duckduckgoMethod · 0.95