Spaces:
Running
Running
pragneshbarik
commited on
Commit
•
d466514
1
Parent(s):
ac9e241
added doc string to function rerank and gen_augmented_prompt_via_websearch
Browse files
utils.py
CHANGED
@@ -69,8 +69,8 @@ def gen_augmented_prompt_via_websearch(
|
|
69 |
vendor,
|
70 |
n_crawl,
|
71 |
top_k,
|
72 |
-
pre_context,
|
73 |
-
post_context,
|
74 |
pre_prompt="",
|
75 |
post_prompt="",
|
76 |
pass_prev=False,
|
@@ -78,24 +78,25 @@ def gen_augmented_prompt_via_websearch(
|
|
78 |
chunk_size=512,
|
79 |
):
|
80 |
"""
|
81 |
-
|
82 |
|
83 |
Args:
|
84 |
-
prompt (str, required):
|
85 |
-
vendor ('Google'
|
86 |
-
n_crawl (int):
|
87 |
-
top_k (int):
|
88 |
-
pre_context (str):
|
89 |
-
post_context (str):
|
90 |
-
pre_prompt (str, optional):
|
91 |
-
post_prompt (str, optional):
|
92 |
-
pass_prev (bool, optional):
|
93 |
-
prev_output (str, optional):
|
94 |
-
chunk_size (int, optional):
|
95 |
|
96 |
Returns:
|
97 |
-
|
98 |
"""
|
|
|
99 |
search_results = []
|
100 |
if vendor == "Google":
|
101 |
search_results = googleSearchClient.search(prompt, n_crawl)
|
|
|
69 |
vendor,
|
70 |
n_crawl,
|
71 |
top_k,
|
72 |
+
pre_context="",
|
73 |
+
post_context="",
|
74 |
pre_prompt="",
|
75 |
post_prompt="",
|
76 |
pass_prev=False,
|
|
|
78 |
chunk_size=512,
|
79 |
):
|
80 |
"""
|
81 |
+
Generates an augmented prompt and a list of links by performing a web search and reranking the results.
|
82 |
|
83 |
Args:
|
84 |
+
prompt (str, required): The prompt for the web search.
|
85 |
+
vendor (str): The search engine to use, either 'Google' or 'Bing'.
|
86 |
+
n_crawl (int): The number of search results to retrieve.
|
87 |
+
top_k (int): The number of top reranked results to return.
|
88 |
+
pre_context (str): The pre-context to be included in the augmented prompt.
|
89 |
+
post_context (str): The post-context to be included in the augmented prompt.
|
90 |
+
pre_prompt (str, optional): The pre-prompt to be included in the augmented prompt. Defaults to "".
|
91 |
+
post_prompt (str, optional): The post-prompt to be included in the augmented prompt. Defaults to "".
|
92 |
+
pass_prev (bool, optional): Whether to include the previous output in the augmented prompt. Defaults to False.
|
93 |
+
prev_output (str, optional): The previous output to be included in the augmented prompt. Defaults to "".
|
94 |
+
chunk_size (int, optional): The size of each chunk for reranking. Defaults to 512.
|
95 |
|
96 |
Returns:
|
97 |
+
tuple: A tuple containing the augmented prompt and a list of links.
|
98 |
"""
|
99 |
+
|
100 |
search_results = []
|
101 |
if vendor == "Google":
|
102 |
search_results = googleSearchClient.search(prompt, n_crawl)
|