Nottybro commited on
Commit
edc7a79
·
verified ·
1 Parent(s): fd88a61

fix: use_web=True skips local entirely — pure web results

Browse files
Files changed (1) hide show
  1. acra.py +4 -5
acra.py CHANGED
@@ -152,14 +152,13 @@ async def query_pipeline(query, namespace, top_k, rerank, user_id, use_web=False
152
 
153
  web_hits, retrieval_source = [], "local"
154
  if use_web:
155
- # Web mode: only keep local docs if they are highly relevant (>0.8).
156
- # Low-scoring local docs just pollute the context and Gemma ignores web results.
157
- hits = [h for h in hits if h.get("similarity", 0) > 0.8]
158
  web_hits = web_search(query, max_results=k)
159
- if not web_hits and not hits:
160
  return {"answer": "Nothing found on the web.", "sources": [],
161
  "complexity": cls, "retrieval_source": "none"}
162
- retrieval_source = "local_and_web" if hits else "web"
163
  elif not hits:
164
  web_hits = web_search(query, max_results=k)
165
  if not web_hits:
 
152
 
153
  web_hits, retrieval_source = [], "local"
154
  if use_web:
155
+ # Web mode: ignore local docs entirely — pure web only
156
+ hits = []
 
157
  web_hits = web_search(query, max_results=k)
158
+ if not web_hits:
159
  return {"answer": "Nothing found on the web.", "sources": [],
160
  "complexity": cls, "retrieval_source": "none"}
161
+ retrieval_source = "web"
162
  elif not hits:
163
  web_hits = web_search(query, max_results=k)
164
  if not web_hits: