Spaces:
Build error
Build error
|
Download docs/contributing/prompt-engineering.md from DataQuests/DeepCritical: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/ce99b59ee0af99837fca92bf8a1c70b9fe477f4e/docs/contributing/prompt-engineering.md
- Command line
-
hf download hf://spaces/DataQuests/DeepCritical@ce99b59ee0af99837fca92bf8a1c70b9fe477f4e/docs/contributing/prompt-engineering.md
-
curl -L -o prompt-engineering.md https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/ce99b59ee0af99837fca92bf8a1c70b9fe477f4e/docs/contributing/prompt-engineering.md
1.99 kB
Prompt Engineering & Citation Validation
This document outlines prompt engineering guidelines and citation validation rules.
Judge Prompts
- System prompt in
src/prompts/judge.py - Format evidence with truncation (1500 chars per item)
- Handle empty evidence case separately
- Always request structured JSON output
- Use
format_user_prompt()andformat_empty_evidence_prompt()helpers
Hypothesis Prompts
- Use diverse evidence selection (MMR algorithm)
- Sentence-aware truncation (
truncate_at_sentence()) - Format: Drug → Target → Pathway → Effect
- System prompt emphasizes mechanistic reasoning
- Use
format_hypothesis_prompt()with embeddings for diversity
Report Prompts
- Include full citation details for validation
- Use diverse evidence selection (n=20)
- CRITICAL: Emphasize citation validation rules
- Format hypotheses with support/contradiction counts
- System prompt includes explicit JSON structure requirements
Citation Validation
- ALWAYS validate references before returning reports
- Use
validate_references()fromsrc/utils/citation_validator.py - Remove hallucinated citations (URLs not in evidence)
- Log warnings for removed citations
- Never trust LLM-generated citations without validation
Citation Validation Rules
- Every reference URL must EXACTLY match a provided evidence URL
- Do NOT invent, fabricate, or hallucinate any references
- Do NOT modify paper titles, authors, dates, or URLs
- If unsure about a citation, OMIT it rather than guess
- Copy URLs exactly as provided - do not create similar-looking URLs
Evidence Selection
- Use
select_diverse_evidence()for MMR-based selection - Balance relevance vs diversity (lambda=0.7 default)
- Sentence-aware truncation preserves meaning
- Limit evidence per prompt to avoid context overflow
See Also
- Code Quality - Code quality guidelines
- Error Handling - Error handling guidelines