Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -105,13 +105,14 @@ async def generate_report(query: QueryModel):
|
|
105 |
data_format = query.data_format
|
106 |
optimized_search_query = ""
|
107 |
all_text_with_urls = [("", "")]
|
|
|
108 |
generate_charts = query.generate_charts
|
109 |
output_as_md = query.output_as_md
|
110 |
|
111 |
if query.internet:
|
112 |
search_query = re.sub(r'[^\w\s]', '', description).strip()
|
113 |
try:
|
114 |
-
urls, optimized_search_query = search_brave(search_query, num_results=8)
|
115 |
all_text_with_urls = fetch_and_extract_content(data_format, urls, optimized_search_query)
|
116 |
reference = limit_tokens(str(all_text_with_urls),token_limit=5000)
|
117 |
user_prompt_final = user_prompt_final.format(description=description, reference=reference)
|
@@ -156,6 +157,7 @@ async def generate_report(query: QueryModel):
|
|
156 |
"report": final_report,
|
157 |
"references": references_html,
|
158 |
"search_query": optimized_search_query
|
|
|
159 |
}
|
160 |
|
161 |
@app.post("/generate_report")
|
|
|
105 |
data_format = query.data_format
|
106 |
optimized_search_query = ""
|
107 |
all_text_with_urls = [("", "")]
|
108 |
+
full_search_object = {}
|
109 |
generate_charts = query.generate_charts
|
110 |
output_as_md = query.output_as_md
|
111 |
|
112 |
if query.internet:
|
113 |
search_query = re.sub(r'[^\w\s]', '', description).strip()
|
114 |
try:
|
115 |
+
urls, optimized_search_query, full_search_object = search_brave(search_query, num_results=8)
|
116 |
all_text_with_urls = fetch_and_extract_content(data_format, urls, optimized_search_query)
|
117 |
reference = limit_tokens(str(all_text_with_urls),token_limit=5000)
|
118 |
user_prompt_final = user_prompt_final.format(description=description, reference=reference)
|
|
|
157 |
"report": final_report,
|
158 |
"references": references_html,
|
159 |
"search_query": optimized_search_query
|
160 |
+
"search_data_full":full_search_object
|
161 |
}
|
162 |
|
163 |
@app.post("/generate_report")
|