Update main.py
Browse files
main.py
CHANGED
|
@@ -40,19 +40,7 @@ def llm(prompt, model):
|
|
| 40 |
response = llm(prompt)
|
| 41 |
return response
|
| 42 |
|
| 43 |
-
|
| 44 |
def gpt_with_google_search(prompt, model):
|
| 45 |
-
search_results = search_google(prompt)
|
| 46 |
-
text = ""
|
| 47 |
-
ref = ""
|
| 48 |
-
for item in search_results:
|
| 49 |
-
text += item['title'] + "\n" + item['snippet'] + "\n\n"
|
| 50 |
-
ref += "- {} ({})\n".format(item['title'], item['link'])
|
| 51 |
-
results = llm(prompt = f'Summarize: {text}', model = model)
|
| 52 |
-
res = "{} \n\n {}".format(results, ref)
|
| 53 |
-
return res
|
| 54 |
-
|
| 55 |
-
def gpt_with_google_search(prompt):
|
| 56 |
search_results = search_google(prompt)
|
| 57 |
text = ""
|
| 58 |
ref = ""
|
|
@@ -61,7 +49,7 @@ def gpt_with_google_search(prompt):
|
|
| 61 |
text += item['title'] + "\n" + item['snippet'] + "\n\n"
|
| 62 |
ref += " [{}] {} ({})\n".format(ref_count, item['title'], item['link'])
|
| 63 |
ref_count += 1
|
| 64 |
-
results =
|
| 65 |
res = "{} \n\n{}".format(results, ref)
|
| 66 |
return res
|
| 67 |
|
|
|
|
| 40 |
response = llm(prompt)
|
| 41 |
return response
|
| 42 |
|
|
|
|
| 43 |
def gpt_with_google_search(prompt, model):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
search_results = search_google(prompt)
|
| 45 |
text = ""
|
| 46 |
ref = ""
|
|
|
|
| 49 |
text += item['title'] + "\n" + item['snippet'] + "\n\n"
|
| 50 |
ref += " [{}] {} ({})\n".format(ref_count, item['title'], item['link'])
|
| 51 |
ref_count += 1
|
| 52 |
+
results = llm(prompt = f'Summarize: {text}', model = model)
|
| 53 |
res = "{} \n\n{}".format(results, ref)
|
| 54 |
return res
|
| 55 |
|