Skip to content

Commit d53b740

Browse files
committed
Improve online search and allow server to skip auto webpage read
1 parent 1775606 commit d53b740

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/khoj/processor/tools/online_search.py

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
GOOGLE_SEARCH_API_KEY = os.getenv("GOOGLE_SEARCH_API_KEY")
3434
GOOGLE_SEARCH_ENGINE_ID = os.getenv("GOOGLE_SEARCH_ENGINE_ID")
3535
SERPER_DEV_API_KEY = os.getenv("SERPER_DEV_API_KEY")
36+
AUTO_READ_WEBPAGE = is_env_var_true("AUTO_READ_WEBPAGE")
3637
SERPER_DEV_URL = "https://google.serper.dev/search"
3738

3839
JINA_SEARCH_API_URL = "https://s.jina.ai/"
@@ -131,6 +132,10 @@ async def search_online(
131132
logger.error(f"Error searching with {search_engine}: {e}")
132133
response_dict = {}
133134

135+
if not AUTO_READ_WEBPAGE:
136+
yield response_dict
137+
return
138+
134139
# Gather distinct web pages from organic results for subqueries without an instant answer.
135140
webpages: Dict[str, Dict] = {}
136141
for subquery in response_dict:

0 commit comments

Comments
 (0)