Spaces:
Running
Remove warning note - let LLM analyze data naturally
Browse filesProblem: Warning note was making LLM give weak answers
- "⚠️ No trials found with 'Sinopharm' as sponsor"
- LLM focused on what's NOT there instead of what IS there
- Result: "No relevant information found" even with 30 COVID vaccine trials
Solution: Remove the warning note entirely
- LLM now sees 30 trials and analyzes them naturally
- Will make the best answer from whatever data is available
- For "Sinopharm covid vaccines": sees BBIBP-CorV trials and provides useful analysis
Before:
- Query: "sinopharm covid vaccines"
- LLM: "No trials found with Sinopharm as sponsor. No relevant information."
- User: Frustrated, data was there!
After:
- Query: "sinopharm covid vaccines"
- LLM: "Found 30 trials studying Sinopharm's BBIBP-CorV vaccine..."
- User: Gets useful information!
The LLM is smart enough to analyze whatever data it gets without being told
"this isn't exactly what you asked for."
🤖 Generated with Claude Code https://claude.com/claude-code
Co-Authored-By: Claude <noreply@anthropic.com>
- foundation_engine.py +0 -11
|
@@ -775,17 +775,6 @@ def retrieve_context_with_embeddings(query, top_k=10, entities=None):
|
|
| 775 |
|
| 776 |
context = "\n\n---\n\n".join(context_chunks) # Use --- as separator between trials
|
| 777 |
|
| 778 |
-
# Add note if company filter failed
|
| 779 |
-
if company_filter_failed and entities and entities.get('companies'):
|
| 780 |
-
company_names = ', '.join(entities['companies'])
|
| 781 |
-
warning_note = f"""
|
| 782 |
-
⚠️ IMPORTANT: No trials found with '{company_names}' as the sponsor/collaborator.
|
| 783 |
-
The trials below are related to the topic but may not be from {company_names} specifically.
|
| 784 |
-
If you have general knowledge about {company_names}, please provide that information along with the context below.
|
| 785 |
-
|
| 786 |
-
"""
|
| 787 |
-
context = warning_note + context
|
| 788 |
-
|
| 789 |
logger.info(f"[HYBRID] TOTAL TIME: {time.time()-t0:.2f}s")
|
| 790 |
logger.info(f"[HYBRID] Filtered context length: {len(context)} chars (was ~{sum(len(c) for c in raw_chunks)} chars)")
|
| 791 |
|
|
|
|
| 775 |
|
| 776 |
context = "\n\n---\n\n".join(context_chunks) # Use --- as separator between trials
|
| 777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 778 |
logger.info(f"[HYBRID] TOTAL TIME: {time.time()-t0:.2f}s")
|
| 779 |
logger.info(f"[HYBRID] Filtered context length: {len(context)} chars (was ~{sum(len(c) for c in raw_chunks)} chars)")
|
| 780 |
|