INNER CODE UNIT · Python
websearch
SPThole/CoexistAI · app.py:507
async def websearch(request: WebSearchRequest):
"""
Performs a web search and retrieves results, then generates a response based on those results.
It also throws back the next steps, you should carry out your research until there are no next steps left.
RECOMMENDATION: Be specific with the query to get the most relevant results. and Set num_results to 2 (for better results)
Args:
query (str): The input query.
rerank (bool): Whether to rerank results.
num_results (int, optional): Number of search results to retrieve. Defaults to 3. (can take values from 1-5)
document_paths (list of str, optional): List of paths for local documents/folders. Defaults to empty list. for an example [path1,path2,path3]. if different tasks are related to different documents
local_mode (bool, optional): Whether to process local documents. Defaults to False.
split (bool, optional): Whether to split documents into chunks. Defaults to True.
vectordb (str, optional): Name of an existing vector database to query instead of performing search. Defaults to None.
quick_answer (bool, optional): Whether to force quick answer mode (disables summary mode). Defaults to False.
Returns:
str: Generated response to query based on the retrieved and reranked search results and sources
"""