refactor(search): remove the Gemini search backend
The user asked to drop it: nobody had the Gemini CLI login or a key set up, and Exa then Wikipedia cover the voice use. webSearch is now live Chrome, Exa, Brave (opt-in), Wikipedia. Removes the CLI/REST backends, the GEMINI_* settings, the Docker login mount and checks, and updates the specs and docs/llm_contexts.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ from ..types import ToolExecutionResult
|
||||
_FETCH_TIMEOUT_SEC = 4.0
|
||||
# Wall-clock cap for the entire cascade when fetches run in parallel.
|
||||
_CASCADE_WALL_CLOCK_SEC = 8.0
|
||||
# Hard ceiling on the whole provider chain (Exa + Gemini + Brave + Wikipedia). Without
|
||||
# Hard ceiling on the whole provider chain (Exa + Brave + Wikipedia). Without
|
||||
# this, a bad day where every provider stalls to timeout could run ~40s —
|
||||
# intolerable for a voice assistant. Past this deadline the tool gives up and
|
||||
# returns the honest-block envelope.
|
||||
@@ -710,7 +710,7 @@ def _results_reply(search_query: str, results: List[Tuple[str, str, str]]) -> st
|
||||
|
||||
|
||||
class WebSearchTool(Tool):
|
||||
"""webSearch: Exa, Gemini, Brave (opt-in) and Wikipedia (web_search.spec.md)."""
|
||||
"""webSearch: Exa, Brave (opt-in) and Wikipedia (web_search.spec.md)."""
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
@@ -731,7 +731,7 @@ class WebSearchTool(Tool):
|
||||
}
|
||||
|
||||
def run(self, args: Optional[Dict[str, Any]], context: ToolContext) -> ToolExecutionResult:
|
||||
"""Search the web: Exa, then Gemini, then Brave (opt-in), then Wikipedia."""
|
||||
"""Search the web: Exa, then Brave (opt-in), then Wikipedia."""
|
||||
cfg = context.cfg
|
||||
search_query = ""
|
||||
try:
|
||||
@@ -782,24 +782,7 @@ class WebSearchTool(Tool):
|
||||
return ToolExecutionResult(success=True, reply_text=_results_reply(search_query, exa))
|
||||
context.user_print("⚠️ Exa returned no results.")
|
||||
|
||||
# 2. Gemini, only when it can work: the CLI with a Google login, or an API key.
|
||||
routed = None
|
||||
if _budget_left() > 0:
|
||||
if getattr(cfg, "gemini_auth", "oauth") == "oauth":
|
||||
if realtime_search.gemini_oauth_ready():
|
||||
routed = realtime_search.gemini_cli_search(
|
||||
search_query, timeout=max(1, int(_budget_left())))
|
||||
elif getattr(cfg, "gemini_api_key", ""):
|
||||
routed = realtime_search.gemini_search(
|
||||
search_query, cfg.gemini_api_key,
|
||||
getattr(cfg, "gemini_model", "gemini-2.0-flash"),
|
||||
timeout=max(1, int(_budget_left())),
|
||||
)
|
||||
if routed:
|
||||
debug_log(" 🌐 answered via Gemini", "web")
|
||||
return ToolExecutionResult(success=True, reply_text=routed)
|
||||
|
||||
# 3. Brave (opt-in, keyed): links, then the parallel page fetch.
|
||||
# 2. Brave (opt-in, keyed): links, then the parallel page fetch.
|
||||
fetched_content: Optional[str] = None
|
||||
search_results: list[str] = []
|
||||
fetch_attempted_any = False
|
||||
@@ -823,7 +806,7 @@ class WebSearchTool(Tool):
|
||||
else:
|
||||
debug_log("Brave returned results but no fetch succeeded", "web")
|
||||
|
||||
# 4. Wikipedia: last resort, only a page whose title the query names.
|
||||
# 3. Wikipedia: last resort, only a page whose title the query names.
|
||||
if (
|
||||
not fetched_content
|
||||
and getattr(cfg, "wikipedia_fallback_enabled", True)
|
||||
|
||||
Reference in New Issue
Block a user