Spaces:
Running
Running
Update utils.py
Browse files
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
|
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
|