pvanand commited on
Commit
00eb6f3
1 Parent(s): 5909acd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -4
main.py CHANGED
@@ -62,13 +62,15 @@ async def generate_report(request: Request, query: QueryModel):
62
  internet = "online" if query.internet else "offline"
63
  sys_prompt_output_format = sys_prompts[internet][query.output_format]
64
  data_format = query.data_format
65
-
 
 
66
  # Combine query with user keywords
67
  if query.internet:
68
  search_query = description
69
  # Search for relevant URLs
70
  try:
71
- urls = search_brave(search_query, num_results=4)
72
  # Fetch and extract content from the URLs
73
  all_text_with_urls = fetch_and_extract_content(data_format, urls, query_str)
74
  # Prepare the prompt for generating the report
@@ -81,7 +83,6 @@ async def generate_report(request: Request, query: QueryModel):
81
 
82
  if not query.internet:
83
  prompt = f"#### COMPLETE THE TASK: {description} #### IN THE CONTEXT OF ### CONTEXT: {query_str}"
84
- all_text_with_urls = [("","")]
85
 
86
  md_report = together_response(prompt, model=llm_default_medium, SysPrompt=sys_prompt_output_format)
87
 
@@ -95,7 +96,8 @@ async def generate_report(request: Request, query: QueryModel):
95
  # Return the generated report
96
  return {
97
  "report": md_to_html(md_report),
98
- "references": references_html
 
99
  }
100
 
101
  app.add_middleware(
 
62
  internet = "online" if query.internet else "offline"
63
  sys_prompt_output_format = sys_prompts[internet][query.output_format]
64
  data_format = query.data_format
65
+ optimized_search_query = ""
66
+ all_text_with_urls = [("","")]
67
+
68
  # Combine query with user keywords
69
  if query.internet:
70
  search_query = description
71
  # Search for relevant URLs
72
  try:
73
+ urls,optimized_search_query = search_brave(search_query, num_results=4)
74
  # Fetch and extract content from the URLs
75
  all_text_with_urls = fetch_and_extract_content(data_format, urls, query_str)
76
  # Prepare the prompt for generating the report
 
83
 
84
  if not query.internet:
85
  prompt = f"#### COMPLETE THE TASK: {description} #### IN THE CONTEXT OF ### CONTEXT: {query_str}"
 
86
 
87
  md_report = together_response(prompt, model=llm_default_medium, SysPrompt=sys_prompt_output_format)
88
 
 
96
  # Return the generated report
97
  return {
98
  "report": md_to_html(md_report),
99
+ "references": references_html,
100
+ "search_qury":optimized_search_query
101
  }
102
 
103
  app.add_middleware(