siddhartharyaai commited on
Commit
7383a6e
·
verified ·
1 Parent(s): 1b49e7c

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +4 -1
utils.py CHANGED
@@ -541,6 +541,9 @@ def run_research_agent(
541
  print("[LOG] Could not retrieve content from any search results. Exiting.")
542
  return "Could not retrieve content from any of the search results."
543
 
 
 
 
544
  # Step 3: Truncate to 12k tokens total
545
  print("[LOG] Step 3: Truncating combined text to 12,000 tokens if needed.")
546
  combined_content = truncate_text_tokens(combined_content, max_tokens=12000)
@@ -588,7 +591,7 @@ include key data points and context:
588
 
589
  final_prompt = f"""
590
  IMPORTANT: Do NOT include chain-of-thought or hidden planning.
591
- Produce a long, academic-style research paper with the following structure:
592
  - Title Page (concise descriptive title)
593
  - Table of Contents
594
  - Executive Summary
 
541
  print("[LOG] Could not retrieve content from any search results. Exiting.")
542
  return "Could not retrieve content from any of the search results."
543
 
544
+ # Step 2.5: Input Sanitization - Remove any chain-of-thought markers from the scraped content.
545
+ combined_content = re.sub(r"<think>.*?</think>", "", combined_content, flags=re.DOTALL)
546
+
547
  # Step 3: Truncate to 12k tokens total
548
  print("[LOG] Step 3: Truncating combined text to 12,000 tokens if needed.")
549
  combined_content = truncate_text_tokens(combined_content, max_tokens=12000)
 
591
 
592
  final_prompt = f"""
593
  IMPORTANT: Do NOT include chain-of-thought or hidden planning.
594
+ Produce a long, academic-style research report with the following structure:
595
  - Title Page (concise descriptive title)
596
  - Table of Contents
597
  - Executive Summary