Include search results & webpage content in online context for chat response

Previously if a web page was read for a sub-query, only the extracted
web page content was provided as context for the given sub-query. But
the google results themselves have relevant snippets. So include them
This commit is contained in:
Debanjum Singh Solanky
2024-03-10 02:34:46 +05:30
parent d136a6be44
commit dc86e44a07

View File

@@ -146,12 +146,9 @@ def converse(
return iter([prompts.no_online_results_found.format()]) return iter([prompts.no_online_results_found.format()])
if ConversationCommand.Online in conversation_commands: if ConversationCommand.Online in conversation_commands:
simplified_online_results = online_results.copy() conversation_primer = (
for result in online_results: f"{prompts.online_search_conversation.format(online_results=str(online_results))}\n{conversation_primer}"
if online_results[result].get("extracted_content"): )
simplified_online_results[result] = online_results[result]["extracted_content"]
conversation_primer = f"{prompts.online_search_conversation.format(online_results=str(simplified_online_results))}\n{conversation_primer}"
if not is_none_or_empty(compiled_references): if not is_none_or_empty(compiled_references):
conversation_primer = f"{prompts.notes_conversation.format(query=user_query, references=compiled_references)}\n{conversation_primer}" conversation_primer = f"{prompts.notes_conversation.format(query=user_query, references=compiled_references)}\n{conversation_primer}"