Update app.py
Browse files
app.py
CHANGED
@@ -189,9 +189,9 @@ async def web_search_and_extract(
|
|
189 |
timelimit: Optional[str] = None,
|
190 |
safesearch: str = "moderate",
|
191 |
region: str = "wt-wt",
|
192 |
-
backend: str = "
|
193 |
max_chars: int = 6000,
|
194 |
-
extract_only: bool =
|
195 |
):
|
196 |
"""
|
197 |
Searches using WEBS, extracts text from the top results, and returns both.
|
@@ -207,7 +207,7 @@ async def web_search_and_extract(
|
|
207 |
extracted_results = await asyncio.gather(*tasks)
|
208 |
|
209 |
if extract_only:
|
210 |
-
return JSONResponse(content=jsonable_encoder(
|
211 |
else:
|
212 |
return JSONResponse(content=jsonable_encoder({"search_results": search_results, "extracted_results": extracted_results}))
|
213 |
except Exception as e:
|
@@ -221,7 +221,7 @@ async def adv_web_search(
|
|
221 |
timelimit: Optional[str] = None,
|
222 |
safesearch: str = "moderate",
|
223 |
region: str = "wt-wt",
|
224 |
-
backend: str = "
|
225 |
max_chars: int = 6000,
|
226 |
system_prompt: str = "You are Most Advanced and Powerful Ai chatbot, User ask you questions and you have to answer that, You are also provided with Google Search Results, To increase your accuracy and providing real time data. Your task is to answer in best way to user."
|
227 |
):
|
|
|
189 |
timelimit: Optional[str] = None,
|
190 |
safesearch: str = "moderate",
|
191 |
region: str = "wt-wt",
|
192 |
+
backend: str = "html",
|
193 |
max_chars: int = 6000,
|
194 |
+
extract_only: bool = True
|
195 |
):
|
196 |
"""
|
197 |
Searches using WEBS, extracts text from the top results, and returns both.
|
|
|
207 |
extracted_results = await asyncio.gather(*tasks)
|
208 |
|
209 |
if extract_only:
|
210 |
+
return JSONResponse(content=jsonable_encoder(extracted_results))
|
211 |
else:
|
212 |
return JSONResponse(content=jsonable_encoder({"search_results": search_results, "extracted_results": extracted_results}))
|
213 |
except Exception as e:
|
|
|
221 |
timelimit: Optional[str] = None,
|
222 |
safesearch: str = "moderate",
|
223 |
region: str = "wt-wt",
|
224 |
+
backend: str = "html",
|
225 |
max_chars: int = 6000,
|
226 |
system_prompt: str = "You are Most Advanced and Powerful Ai chatbot, User ask you questions and you have to answer that, You are also provided with Google Search Results, To increase your accuracy and providing real time data. Your task is to answer in best way to user."
|
227 |
):
|